From 64b013b121f472d2658e5f2b3a672c4c4ced342d Mon Sep 17 00:00:00 2001 From: 1hitsong <3330318+1hitsong@users.noreply.github.com> Date: Sat, 17 Sep 2022 17:48:27 -0400 Subject: [PATCH] Resolve Azure build issues --- MediaBrowser.Controller/Lyrics/ILyricManager.cs | 2 +- MediaBrowser.Providers/Lyric/LrcLyricProvider.cs | 7 ++++++- MediaBrowser.Providers/Lyric/LyricManager.cs | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/MediaBrowser.Controller/Lyrics/ILyricManager.cs b/MediaBrowser.Controller/Lyrics/ILyricManager.cs index dad0250f6..5920bcc62 100644 --- a/MediaBrowser.Controller/Lyrics/ILyricManager.cs +++ b/MediaBrowser.Controller/Lyrics/ILyricManager.cs @@ -12,7 +12,7 @@ public interface ILyricManager /// /// The media item. /// Lyrics for passed item. - LyricResponse GetLyrics(BaseItem item); + LyricResponse? GetLyrics(BaseItem item); /// /// Checks if requested item has a matching local lyric file. diff --git a/MediaBrowser.Providers/Lyric/LrcLyricProvider.cs b/MediaBrowser.Providers/Lyric/LrcLyricProvider.cs index 9bacfc296..db87d9236 100644 --- a/MediaBrowser.Providers/Lyric/LrcLyricProvider.cs +++ b/MediaBrowser.Providers/Lyric/LrcLyricProvider.cs @@ -87,7 +87,12 @@ public class LrcLyricProvider : ILyricProvider for (int i = 0; i < sortedLyricData.Count; i++) { - var timeData = sortedLyricData[i].TimeTags.ToArray()[0].Value; + var timeData = sortedLyricData[i].TimeTags.First().Value; + if (timeData is null) + { + continue; + } + long ticks = TimeSpan.FromMilliseconds((double)timeData).Ticks; lyricList.Add(new Controller.Lyrics.Lyric(sortedLyricData[i].Text, ticks)); } diff --git a/MediaBrowser.Providers/Lyric/LyricManager.cs b/MediaBrowser.Providers/Lyric/LyricManager.cs index 06f913d07..0de008db7 100644 --- a/MediaBrowser.Providers/Lyric/LyricManager.cs +++ b/MediaBrowser.Providers/Lyric/LyricManager.cs @@ -22,7 +22,7 @@ public class LyricManager : ILyricManager } /// - public LyricResponse GetLyrics(BaseItem item) + public LyricResponse? GetLyrics(BaseItem item) { foreach (ILyricProvider provider in _lyricProviders) {