|
@@ -14,7 +14,7 @@ using MediaBrowser.Controller.Lyrics;
|
|
|
namespace MediaBrowser.Providers.Lyric
|
|
|
{
|
|
|
/// <summary>
|
|
|
- /// LRC File Lyric Provider.
|
|
|
+ /// LRC Lyric Provider.
|
|
|
/// </summary>
|
|
|
public class LrcLyricProvider : ILyricProvider
|
|
|
{
|
|
@@ -37,21 +37,15 @@ namespace MediaBrowser.Providers.Lyric
|
|
|
public string Name { get; }
|
|
|
|
|
|
/// <summary>
|
|
|
- /// Gets a value indicating the File Extenstions this provider works with.
|
|
|
+ /// Gets a value indicating the File Extenstions this provider supports.
|
|
|
/// </summary>
|
|
|
public IEnumerable<string> SupportedMediaTypes { get; }
|
|
|
|
|
|
/// <summary>
|
|
|
- /// Gets or Sets Data object generated by Process() method.
|
|
|
- /// </summary>
|
|
|
- /// <returns><c>Object</c> with data if no error occured; otherwise, <c>null</c>.</returns>
|
|
|
- public object? Data { get; set; }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// Opens lyric file for [the specified item], and processes it for API return.
|
|
|
+ /// Opens lyric file for the requested item, and processes it for API return.
|
|
|
/// </summary>
|
|
|
/// <param name="item">The item to to process.</param>
|
|
|
- /// <returns><placeholder>A <see cref="Task"/> representing the asynchronous operation.</placeholder></returns>
|
|
|
+ /// <returns>If provider can determine lyrics, returns a <see cref="LyricResponse"/> with or without metadata; otherwise, null.</returns>
|
|
|
public LyricResponse? GetLyrics(BaseItem item)
|
|
|
{
|
|
|
string? lyricFilePath = LyricInfo.GetLyricFilePath(this, item.Path);
|
|
@@ -61,9 +55,9 @@ namespace MediaBrowser.Providers.Lyric
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- List<MediaBrowser.Controller.Lyrics.Lyric> lyricsList = new List<MediaBrowser.Controller.Lyrics.Lyric>();
|
|
|
-
|
|
|
+ List<Controller.Lyrics.Lyric> lyricList = new List<Controller.Lyrics.Lyric>();
|
|
|
List<LrcParser.Model.Lyric> sortedLyricData = new List<LrcParser.Model.Lyric>();
|
|
|
+
|
|
|
var metaData = new ExpandoObject() as IDictionary<string, object>;
|
|
|
string lrcFileContent = System.IO.File.ReadAllText(lyricFilePath);
|
|
|
|
|
@@ -105,15 +99,15 @@ namespace MediaBrowser.Providers.Lyric
|
|
|
{
|
|
|
var timeData = sortedLyricData[i].TimeTags.ToArray()[0].Value;
|
|
|
double ticks = Convert.ToDouble(timeData, new NumberFormatInfo()) * 10000;
|
|
|
- lyricsList.Add(new MediaBrowser.Controller.Lyrics.Lyric { Start = Math.Ceiling(ticks), Text = sortedLyricData[i].Text });
|
|
|
+ lyricList.Add(new Controller.Lyrics.Lyric { Start = Math.Ceiling(ticks), Text = sortedLyricData[i].Text });
|
|
|
}
|
|
|
|
|
|
if (metaData.Any())
|
|
|
{
|
|
|
- return new LyricResponse { MetaData = metaData, Lyrics = lyricsList };
|
|
|
+ return new LyricResponse { MetaData = metaData, Lyrics = lyricList };
|
|
|
}
|
|
|
|
|
|
- return new LyricResponse { Lyrics = lyricsList };
|
|
|
+ return new LyricResponse { Lyrics = lyricList };
|
|
|
}
|
|
|
}
|
|
|
}
|