using System.IO;
using System.Linq;
namespace MediaBrowser.Controller.Lyrics
{
///
/// Lyric helper methods.
///
public static class LyricInfo
{
///
/// Gets matching lyric file for a requested item.
///
/// The lyricProvider interface to use.
/// Path of requested item.
/// Lyric file path if passed lyric provider's supported media type is found; otherwise, null.
public static string? GetLyricFilePath(ILyricProvider lyricProvider, string itemPath)
{
if (lyricProvider.SupportedMediaTypes.Any())
{
foreach (string lyricFileExtension in lyricProvider.SupportedMediaTypes)
{
string lyricFilePath = @Path.ChangeExtension(itemPath, lyricFileExtension);
if (System.IO.File.Exists(lyricFilePath))
{
return lyricFilePath;
}
}
}
return null;
}
}
}