diff options
Diffstat (limited to 'MediaBrowser.Providers/Lyric/LyricManager.cs')
| -rw-r--r-- | MediaBrowser.Providers/Lyric/LyricManager.cs | 72 |
1 files changed, 37 insertions, 35 deletions
diff --git a/MediaBrowser.Providers/Lyric/LyricManager.cs b/MediaBrowser.Providers/Lyric/LyricManager.cs index f5560b054..06f913d07 100644 --- a/MediaBrowser.Providers/Lyric/LyricManager.cs +++ b/MediaBrowser.Providers/Lyric/LyricManager.cs @@ -1,55 +1,57 @@ -#nullable disable - -#pragma warning disable CS1591 - using System.Collections.Generic; using System.Linq; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Lyrics; -namespace MediaBrowser.Providers.Lyric +namespace MediaBrowser.Providers.Lyric; + +/// <summary> +/// Lyric Manager. +/// </summary> +public class LyricManager : ILyricManager { - public class LyricManager : ILyricManager - { - private readonly ILyricProvider[] _lyricProviders; + private readonly ILyricProvider[] _lyricProviders; - public LyricManager(IEnumerable<ILyricProvider> lyricProviders) - { - _lyricProviders = lyricProviders.ToArray(); - } + /// <summary> + /// Initializes a new instance of the <see cref="LyricManager"/> class. + /// </summary> + /// <param name="lyricProviders">All found lyricProviders.</param> + public LyricManager(IEnumerable<ILyricProvider> lyricProviders) + { + _lyricProviders = lyricProviders.ToArray(); + } - /// <inheritdoc /> - public LyricResponse GetLyrics(BaseItem item) + /// <inheritdoc /> + public LyricResponse GetLyrics(BaseItem item) + { + foreach (ILyricProvider provider in _lyricProviders) { - foreach (ILyricProvider provider in _lyricProviders) + var results = provider.GetLyrics(item); + if (results is not null) { - var results = provider.GetLyrics(item); - if (results is not null) - { - return results; - } + return results; } - - return null; } - /// <inheritdoc /> - public bool HasLyricFile(BaseItem item) + return null; + } + + /// <inheritdoc /> + public bool HasLyricFile(BaseItem item) + { + foreach (ILyricProvider provider in _lyricProviders) { - foreach (ILyricProvider provider in _lyricProviders) + if (item is null) { - if (item is null) - { - continue; - } - - if (LyricInfo.GetLyricFilePath(provider, item.Path) is not null) - { - return true; - } + continue; } - return false; + if (LyricInfo.GetLyricFilePath(provider, item.Path) is not null) + { + return true; + } } + + return false; } } |
