diff options
| author | Shadowghost <Ghost_of_Stone@web.de> | 2023-05-25 17:07:43 +0200 |
|---|---|---|
| committer | Shadowghost <Ghost_of_Stone@web.de> | 2023-05-25 17:07:43 +0200 |
| commit | d8d5c86d49cfb81baea5f7219fa495c2b7edf98c (patch) | |
| tree | 5befce0ac43b4f98ca29824641c5bf5fcc27c685 /Jellyfin.Api/Controllers/ItemUpdateController.cs | |
| parent | b37e9209df94dcad757d0b9ad0a7a7076c3cf743 (diff) | |
| parent | d67f10ba8c858626a8c9ea39c7cc48e3aa6ff415 (diff) | |
Merge branch 'master' into network-rewrite
Diffstat (limited to 'Jellyfin.Api/Controllers/ItemUpdateController.cs')
| -rw-r--r-- | Jellyfin.Api/Controllers/ItemUpdateController.cs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Jellyfin.Api/Controllers/ItemUpdateController.cs b/Jellyfin.Api/Controllers/ItemUpdateController.cs index ece053a9a..504f2fa1d 100644 --- a/Jellyfin.Api/Controllers/ItemUpdateController.cs +++ b/Jellyfin.Api/Controllers/ItemUpdateController.cs @@ -251,8 +251,6 @@ public class ItemUpdateController : BaseJellyfinApiController channel.Height = request.Height.Value; } - item.Tags = request.Tags; - if (request.Taglines is not null) { item.Tagline = request.Taglines.FirstOrDefault(); @@ -276,12 +274,19 @@ public class ItemUpdateController : BaseJellyfinApiController item.OfficialRating = request.OfficialRating; item.CustomRating = request.CustomRating; + var currentTags = item.Tags; + var newTags = request.Tags; + var removedTags = currentTags.Except(newTags).ToList(); + var addedTags = newTags.Except(currentTags).ToList(); + item.Tags = newTags; + if (item is Series rseries) { foreach (Season season in rseries.Children) { season.OfficialRating = request.OfficialRating; season.CustomRating = request.CustomRating; + season.Tags = season.Tags.Concat(addedTags).Except(removedTags).Distinct().ToArray(); season.OnMetadataChanged(); await season.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); @@ -289,6 +294,7 @@ public class ItemUpdateController : BaseJellyfinApiController { ep.OfficialRating = request.OfficialRating; ep.CustomRating = request.CustomRating; + ep.Tags = ep.Tags.Concat(addedTags).Except(removedTags).Distinct().ToArray(); ep.OnMetadataChanged(); await ep.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); } @@ -300,6 +306,7 @@ public class ItemUpdateController : BaseJellyfinApiController { ep.OfficialRating = request.OfficialRating; ep.CustomRating = request.CustomRating; + ep.Tags = ep.Tags.Concat(addedTags).Except(removedTags).Distinct().ToArray(); ep.OnMetadataChanged(); await ep.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); } @@ -310,6 +317,7 @@ public class ItemUpdateController : BaseJellyfinApiController { track.OfficialRating = request.OfficialRating; track.CustomRating = request.CustomRating; + track.Tags = track.Tags.Concat(addedTags).Except(removedTags).Distinct().ToArray(); track.OnMetadataChanged(); await track.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); } |
