diff --git a/MediaBrowser.Controller/Lyrics/Lyric.cs b/MediaBrowser.Controller/Lyrics/Lyric.cs index 56a0a8a72..35cdabbb9 100644 --- a/MediaBrowser.Controller/Lyrics/Lyric.cs +++ b/MediaBrowser.Controller/Lyrics/Lyric.cs @@ -8,7 +8,7 @@ namespace MediaBrowser.Controller.Lyrics /// /// Gets or sets the start time in ticks. /// - public double? Start { get; set; } + public long? Start { get; set; } /// /// Gets or sets the text. diff --git a/MediaBrowser.Controller/Lyrics/LyricResponse.cs b/MediaBrowser.Controller/Lyrics/LyricResponse.cs index 59ee5c7f2..796ca3bc3 100644 --- a/MediaBrowser.Controller/Lyrics/LyricResponse.cs +++ b/MediaBrowser.Controller/Lyrics/LyricResponse.cs @@ -10,9 +10,9 @@ namespace MediaBrowser.Controller.Lyrics public class LyricResponse { /// - /// Gets or sets MetaData. + /// Gets or sets Metadata. /// - public IDictionary MetaData { get; set; } + public IDictionary Metadata { get; set; } /// /// Gets or sets Lyrics. diff --git a/MediaBrowser.Providers/Lyric/LrcLyricProvider.cs b/MediaBrowser.Providers/Lyric/LrcLyricProvider.cs index ea42d7525..59a172cee 100644 --- a/MediaBrowser.Providers/Lyric/LrcLyricProvider.cs +++ b/MediaBrowser.Providers/Lyric/LrcLyricProvider.cs @@ -8,6 +8,7 @@ using LrcParser.Model; using LrcParser.Parser; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Lyrics; +using Swashbuckle.AspNetCore.SwaggerGen; namespace MediaBrowser.Providers.Lyric { @@ -56,7 +57,7 @@ namespace MediaBrowser.Providers.Lyric List lyricList = new List(); List sortedLyricData = new List(); - var metaData = new ExpandoObject() as IDictionary; + IDictionary metaData = new Dictionary(); string lrcFileContent = System.IO.File.ReadAllText(lyricFilePath); try @@ -77,8 +78,8 @@ namespace MediaBrowser.Providers.Lyric { var metaDataField = metaDataRow.Split(":"); - string metaDataFieldName = metaDataField[0].Replace("[", string.Empty, StringComparison.Ordinal); - string metaDataFieldValue = metaDataField[1].Replace("]", string.Empty, StringComparison.Ordinal); + string metaDataFieldName = metaDataField[0].Replace("[", string.Empty, StringComparison.Ordinal).Trim(); + string metaDataFieldValue = metaDataField[1].Replace("]", string.Empty, StringComparison.Ordinal).Trim(); metaData.Add(metaDataFieldName, metaDataFieldValue); } @@ -96,13 +97,13 @@ namespace MediaBrowser.Providers.Lyric for (int i = 0; i < sortedLyricData.Count; i++) { var timeData = sortedLyricData[i].TimeTags.ToArray()[0].Value; - double ticks = Convert.ToDouble(timeData, new NumberFormatInfo()) * 10000; - lyricList.Add(new Controller.Lyrics.Lyric { Start = Math.Ceiling(ticks), Text = sortedLyricData[i].Text }); + long ticks = Convert.ToInt64(timeData, new NumberFormatInfo()) * 10000; + lyricList.Add(new Controller.Lyrics.Lyric { Start = ticks, Text = sortedLyricData[i].Text }); } if (metaData.Any()) { - return new LyricResponse { MetaData = metaData, Lyrics = lyricList }; + return new LyricResponse { Metadata = metaData, Lyrics = lyricList }; } return new LyricResponse { Lyrics = lyricList };