using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Lyrics;
using MediaBrowser.Controller.Net;
using Microsoft.AspNetCore.Mvc;
namespace MediaBrowser.Controller.Lyrics
{
///
/// Item helper.
///
public static class LyricInfo
{
///
/// Checks if requested item has a matching lyric file.
///
/// The current lyricProvider interface.
/// Path of requested item.
/// True if item has a matching lyrics file.
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;
}
}
}