aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShadowghost <Shadowghost@users.noreply.github.com>2024-05-25 11:46:21 -0400
committerJoshua M. Boniface <joshua@boniface.me>2024-05-25 11:46:21 -0400
commit2af1ae5d8a083a5b95f150ce284d17d0c77df272 (patch)
tree9e97f5f3bc52c8a50fc1e9e036d1666841df0b57
parent833a1da355f7e1d4c734df94d1e286015403427b (diff)
Backport pull request #11792 from jellyfin/release-10.9.z
Improve reliability of HasChanged check Original-merge: b2d54b82fac0954a201c092ea4d5efd7219fbbf2 Merged-by: crobibero <cody@robibe.ro> Backported-by: Joshua M. Boniface <joshua@boniface.me>
-rw-r--r--MediaBrowser.Providers/MediaInfo/ProbeProvider.cs27
1 files changed, 12 insertions, 15 deletions
diff --git a/MediaBrowser.Providers/MediaInfo/ProbeProvider.cs b/MediaBrowser.Providers/MediaInfo/ProbeProvider.cs
index 8bb8d5bb4..04da8fb88 100644
--- a/MediaBrowser.Providers/MediaInfo/ProbeProvider.cs
+++ b/MediaBrowser.Providers/MediaInfo/ProbeProvider.cs
@@ -1,6 +1,7 @@
#nullable disable
using System;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
@@ -141,19 +142,15 @@ namespace MediaBrowser.Providers.MediaInfo
&& item.SupportsLocalMetadata
&& !video.IsPlaceHolder)
{
- if (!video.SubtitleFiles.SequenceEqual(
- _subtitleResolver.GetExternalFiles(video, directoryService, false)
- .Select(info => info.Path).ToList(),
- StringComparer.Ordinal))
+ var externalFiles = new HashSet<string>(_subtitleResolver.GetExternalFiles(video, directoryService, false).Select(info => info.Path), StringComparer.OrdinalIgnoreCase);
+ if (!new HashSet<string>(video.SubtitleFiles, StringComparer.Ordinal).SetEquals(externalFiles))
{
_logger.LogDebug("Refreshing {ItemPath} due to external subtitles change.", item.Path);
return true;
}
- if (!video.AudioFiles.SequenceEqual(
- _audioResolver.GetExternalFiles(video, directoryService, false)
- .Select(info => info.Path).ToList(),
- StringComparer.Ordinal))
+ externalFiles = new HashSet<string>(_audioResolver.GetExternalFiles(video, directoryService, false).Select(info => info.Path), StringComparer.OrdinalIgnoreCase);
+ if (!new HashSet<string>(video.AudioFiles, StringComparer.Ordinal).SetEquals(externalFiles))
{
_logger.LogDebug("Refreshing {ItemPath} due to external audio change.", item.Path);
return true;
@@ -161,14 +158,14 @@ namespace MediaBrowser.Providers.MediaInfo
}
if (item is Audio audio
- && item.SupportsLocalMetadata
- && !audio.LyricFiles.SequenceEqual(
- _lyricResolver.GetExternalFiles(audio, directoryService, false)
- .Select(info => info.Path).ToList(),
- StringComparer.Ordinal))
+ && item.SupportsLocalMetadata)
{
- _logger.LogDebug("Refreshing {ItemPath} due to external lyrics change.", item.Path);
- return true;
+ var externalFiles = new HashSet<string>(_lyricResolver.GetExternalFiles(audio, directoryService, false).Select(info => info.Path), StringComparer.OrdinalIgnoreCase);
+ if (!new HashSet<string>(audio.LyricFiles, StringComparer.Ordinal).SetEquals(externalFiles))
+ {
+ _logger.LogDebug("Refreshing {ItemPath} due to external lyrics change.", item.Path);
+ return true;
+ }
}
return false;