From 56a98a3bb0cc6efcc0d533164aeb8879045d646f Mon Sep 17 00:00:00 2001 From: gnattu Date: Wed, 17 Jul 2024 03:40:07 +0800 Subject: [PATCH] Make internal value separator a constant Signed-off-by: gnattu --- MediaBrowser.Providers/MediaInfo/AudioFileProber.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/MediaBrowser.Providers/MediaInfo/AudioFileProber.cs b/MediaBrowser.Providers/MediaInfo/AudioFileProber.cs index 40ff5551d4..13e5310dee 100644 --- a/MediaBrowser.Providers/MediaInfo/AudioFileProber.cs +++ b/MediaBrowser.Providers/MediaInfo/AudioFileProber.cs @@ -27,6 +27,7 @@ namespace MediaBrowser.Providers.MediaInfo /// public class AudioFileProber { + private const char InternalValueSeparator = '\u001F'; private readonly IMediaEncoder _mediaEncoder; private readonly IItemRepository _itemRepo; private readonly ILibraryManager _libraryManager; @@ -61,6 +62,7 @@ namespace MediaBrowser.Providers.MediaInfo _mediaSourceManager = mediaSourceManager; _lyricResolver = lyricResolver; _lyricManager = lyricManager; + ATL.Settings.DisplayValueSeparator = InternalValueSeparator; } /// @@ -156,7 +158,7 @@ namespace MediaBrowser.Providers.MediaInfo /// Whether to extract embedded lyrics to lrc file. private async Task FetchDataFromTags(Audio audio, Model.MediaInfo.MediaInfo mediaInfo, MetadataRefreshOptions options, bool tryExtractEmbeddedLyrics) { - ATL.Settings.DisplayValueSeparator = '\u001F'; + var test = ATL.Settings.DisplayValueSeparator; Track track = new Track(audio.Path); // ATL will fall back to filename as title when it does not understand the metadata @@ -173,7 +175,7 @@ namespace MediaBrowser.Providers.MediaInfo if (audio.SupportsPeople && !audio.LockedFields.Contains(MetadataField.Cast)) { var people = new List(); - var albumArtists = string.IsNullOrEmpty(track.AlbumArtist) ? mediaInfo.AlbumArtists : track.AlbumArtist.Split('\u001F'); + var albumArtists = string.IsNullOrEmpty(track.AlbumArtist) ? mediaInfo.AlbumArtists : track.AlbumArtist.Split(InternalValueSeparator); foreach (var albumArtist in albumArtists) { if (!string.IsNullOrEmpty(albumArtist)) @@ -186,7 +188,7 @@ namespace MediaBrowser.Providers.MediaInfo } } - var performers = string.IsNullOrEmpty(track.Artist) ? mediaInfo.Artists : track.Artist.Split('\u001F'); + var performers = string.IsNullOrEmpty(track.Artist) ? mediaInfo.Artists : track.Artist.Split(InternalValueSeparator); foreach (var performer in performers) { if (!string.IsNullOrEmpty(performer)) @@ -199,7 +201,7 @@ namespace MediaBrowser.Providers.MediaInfo } } - foreach (var composer in track.Composer.Split('\u001F')) + foreach (var composer in track.Composer.Split(InternalValueSeparator)) { if (!string.IsNullOrEmpty(composer)) { @@ -283,7 +285,7 @@ namespace MediaBrowser.Providers.MediaInfo if (!audio.LockedFields.Contains(MetadataField.Genres)) { - var genres = string.IsNullOrEmpty(track.Genre) ? mediaInfo.Genres : track.Genre.Split('\u001F').Distinct(StringComparer.OrdinalIgnoreCase).ToArray(); + var genres = string.IsNullOrEmpty(track.Genre) ? mediaInfo.Genres : track.Genre.Split(InternalValueSeparator).Distinct(StringComparer.OrdinalIgnoreCase).ToArray(); audio.Genres = options.ReplaceAllMetadata || audio.Genres == null || audio.Genres.Length == 0 ? genres : audio.Genres;