Respect locked fields when updating children from parent
This commit is contained in:
parent
95a6291c34
commit
cc2c00d764
|
@ -289,18 +289,36 @@ public class ItemUpdateController : BaseJellyfinApiController
|
||||||
if (item is Series rseries)
|
if (item is Series rseries)
|
||||||
{
|
{
|
||||||
foreach (var season in rseries.Children.OfType<Season>())
|
foreach (var season in rseries.Children.OfType<Season>())
|
||||||
|
{
|
||||||
|
if (!season.LockedFields.Contains(MetadataField.OfficialRating))
|
||||||
{
|
{
|
||||||
season.OfficialRating = request.OfficialRating;
|
season.OfficialRating = request.OfficialRating;
|
||||||
|
}
|
||||||
|
|
||||||
season.CustomRating = request.CustomRating;
|
season.CustomRating = request.CustomRating;
|
||||||
|
|
||||||
|
if (!season.LockedFields.Contains(MetadataField.Tags))
|
||||||
|
{
|
||||||
season.Tags = season.Tags.Concat(addedTags).Except(removedTags).Distinct().ToArray();
|
season.Tags = season.Tags.Concat(addedTags).Except(removedTags).Distinct().ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
season.OnMetadataChanged();
|
season.OnMetadataChanged();
|
||||||
await season.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
|
await season.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
|
||||||
|
|
||||||
foreach (var ep in season.Children.OfType<Episode>())
|
foreach (var ep in season.Children.OfType<Episode>())
|
||||||
|
{
|
||||||
|
if (!ep.LockedFields.Contains(MetadataField.OfficialRating))
|
||||||
{
|
{
|
||||||
ep.OfficialRating = request.OfficialRating;
|
ep.OfficialRating = request.OfficialRating;
|
||||||
|
}
|
||||||
|
|
||||||
ep.CustomRating = request.CustomRating;
|
ep.CustomRating = request.CustomRating;
|
||||||
|
|
||||||
|
if (!ep.LockedFields.Contains(MetadataField.Tags))
|
||||||
|
{
|
||||||
ep.Tags = ep.Tags.Concat(addedTags).Except(removedTags).Distinct().ToArray();
|
ep.Tags = ep.Tags.Concat(addedTags).Except(removedTags).Distinct().ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
ep.OnMetadataChanged();
|
ep.OnMetadataChanged();
|
||||||
await ep.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
|
await ep.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
@ -309,10 +327,19 @@ public class ItemUpdateController : BaseJellyfinApiController
|
||||||
else if (item is Season season)
|
else if (item is Season season)
|
||||||
{
|
{
|
||||||
foreach (var ep in season.Children.OfType<Episode>())
|
foreach (var ep in season.Children.OfType<Episode>())
|
||||||
|
{
|
||||||
|
if (!ep.LockedFields.Contains(MetadataField.OfficialRating))
|
||||||
{
|
{
|
||||||
ep.OfficialRating = request.OfficialRating;
|
ep.OfficialRating = request.OfficialRating;
|
||||||
|
}
|
||||||
|
|
||||||
ep.CustomRating = request.CustomRating;
|
ep.CustomRating = request.CustomRating;
|
||||||
|
|
||||||
|
if (!ep.LockedFields.Contains(MetadataField.Tags))
|
||||||
|
{
|
||||||
ep.Tags = ep.Tags.Concat(addedTags).Except(removedTags).Distinct().ToArray();
|
ep.Tags = ep.Tags.Concat(addedTags).Except(removedTags).Distinct().ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
ep.OnMetadataChanged();
|
ep.OnMetadataChanged();
|
||||||
await ep.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
|
await ep.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
@ -320,10 +347,19 @@ public class ItemUpdateController : BaseJellyfinApiController
|
||||||
else if (item is MusicAlbum album)
|
else if (item is MusicAlbum album)
|
||||||
{
|
{
|
||||||
foreach (BaseItem track in album.Children)
|
foreach (BaseItem track in album.Children)
|
||||||
|
{
|
||||||
|
if (!track.LockedFields.Contains(MetadataField.OfficialRating))
|
||||||
{
|
{
|
||||||
track.OfficialRating = request.OfficialRating;
|
track.OfficialRating = request.OfficialRating;
|
||||||
|
}
|
||||||
|
|
||||||
track.CustomRating = request.CustomRating;
|
track.CustomRating = request.CustomRating;
|
||||||
|
|
||||||
|
if (!track.LockedFields.Contains(MetadataField.Tags))
|
||||||
|
{
|
||||||
track.Tags = track.Tags.Concat(addedTags).Except(removedTags).Distinct().ToArray();
|
track.Tags = track.Tags.Concat(addedTags).Except(removedTags).Distinct().ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
track.OnMetadataChanged();
|
track.OnMetadataChanged();
|
||||||
await track.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
|
await track.UpdateToRepositoryAsync(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user