diff options
| author | 1hitsong <3330318+1hitsong@users.noreply.github.com> | 2022-09-19 17:57:03 -0400 |
|---|---|---|
| committer | 1hitsong <3330318+1hitsong@users.noreply.github.com> | 2022-09-19 17:57:03 -0400 |
| commit | 3ba8218e45899c7d3622092ed92dc60b4c28803e (patch) | |
| tree | 1201fc0c1aec507dee55b630d0b911e38f372e0b | |
| parent | df85b2fe651ce060cf3b7c4a20c5254c9c80f3aa (diff) | |
Use field instead of property
| -rw-r--r-- | MediaBrowser.Providers/Lyric/LrcLyricProvider.cs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/MediaBrowser.Providers/Lyric/LrcLyricProvider.cs b/MediaBrowser.Providers/Lyric/LrcLyricProvider.cs index debf982cba..3657cf8943 100644 --- a/MediaBrowser.Providers/Lyric/LrcLyricProvider.cs +++ b/MediaBrowser.Providers/Lyric/LrcLyricProvider.cs @@ -18,6 +18,8 @@ public class LrcLyricProvider : ILyricProvider { private readonly ILogger<LrcLyricProvider> _logger; + private static readonly IReadOnlyList<string> _acceptedTimeFormats = new string[] { "HH:mm:ss", "H:mm:ss", "mm:ss", "m:ss" }; + /// <summary> /// Initializes a new instance of the <see cref="LrcLyricProvider"/> class. /// </summary> @@ -39,8 +41,6 @@ public class LrcLyricProvider : ILyricProvider /// <inheritdoc /> public IReadOnlyCollection<string> SupportedMediaTypes { get; } = new[] { "lrc", "elrc" }; - private static readonly IReadOnlyList<string> _acceptedTimeFormats = new string[] { "HH:mm:ss", "H:mm:ss", "mm:ss", "m:ss" }; - /// <summary> /// Opens lyric file for the requested item, and processes it for API return. /// </summary> @@ -83,8 +83,7 @@ public class LrcLyricProvider : ILyricProvider foreach (string metaDataRow in metaDataRows) { - int colonCount = metaDataRow.Count(f => (f == ':')); - if (colonCount == 0) + if (!metaDataRow.Contains(':', StringComparison.OrdinalIgnoreCase)) { continue; } @@ -157,7 +156,7 @@ public class LrcLyricProvider : ILyricProvider if (metaData.TryGetValue("length", out var length) && !string.IsNullOrEmpty(length)) { - if (DateTime.TryParseExact(length, AcceptedTimeFormats, null, DateTimeStyles.None, out var value)) + if (DateTime.TryParseExact(length, _acceptedTimeFormats.ToArray(), null, DateTimeStyles.None, out var value)) { lyricMetadata.Length = value.TimeOfDay.Ticks; } |
