diff options
| author | Shadowghost <Shadowghost@users.noreply.github.com> | 2024-06-01 18:40:56 -0400 |
|---|---|---|
| committer | Joshua M. Boniface <joshua@boniface.me> | 2024-06-01 18:40:56 -0400 |
| commit | 5d4880c4974a8399d178147fcc4e78e1aed191e9 (patch) | |
| tree | a4fdbba504f062d46b0bc7b69395ccf641b5d465 /MediaBrowser.Providers/Playlists | |
| parent | c0364fc76696d759c761577a0b703426d0ca29ca (diff) | |
Backport pull request #11743 from jellyfin/release-10.9.z
Fix replace logic
Original-merge: 2ddb15c7845a944d980364209c2304f03cebf025
Merged-by: joshuaboniface <joshua@boniface.me>
Backported-by: Joshua M. Boniface <joshua@boniface.me>
Diffstat (limited to 'MediaBrowser.Providers/Playlists')
| -rw-r--r-- | MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs b/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs index 1bd000a48..43889bfbf 100644 --- a/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs +++ b/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs @@ -1,6 +1,7 @@ #pragma warning disable CS1591 using System.Collections.Generic; +using System.Linq; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; @@ -49,8 +50,24 @@ namespace MediaBrowser.Providers.Playlists if (mergeMetadataSettings) { targetItem.PlaylistMediaType = sourceItem.PlaylistMediaType; - targetItem.LinkedChildren = sourceItem.LinkedChildren; - targetItem.Shares = sourceItem.Shares; + + if (replaceData || targetItem.LinkedChildren.Length == 0) + { + targetItem.LinkedChildren = sourceItem.LinkedChildren; + } + else + { + targetItem.LinkedChildren = sourceItem.LinkedChildren.Concat(targetItem.LinkedChildren).Distinct().ToArray(); + } + + if (replaceData || targetItem.Shares.Count == 0) + { + targetItem.Shares = sourceItem.Shares; + } + else + { + targetItem.Shares = sourceItem.Shares.Concat(targetItem.Shares).DistinctBy(s => s.UserId).ToArray(); + } } } } |
