Fix incorrect year on local trailers

This commit is contained in:
Shadowghost
2026-07-21 20:27:04 +02:00
parent 65836cc844
commit ca1f7af445
4 changed files with 68 additions and 3 deletions
@@ -1557,6 +1557,19 @@ namespace MediaBrowser.Controller.Entities
i.OwnerId = ownerId;
i.ParentId = Guid.Empty;
// Extras (e.g. trailers) frequently have no reliable date metadata of their own and
// would otherwise fall back to the file's container creation date. Inherit the owner's
// year/premiere date when the extra doesn't have one, so it stays consistent with the
// media it belongs to. Setting it before the refresh means the media info provider
// won't overwrite it from the file creation date.
if (!i.ProductionYear.HasValue && item.ProductionYear.HasValue)
{
i.ProductionYear = item.ProductionYear;
i.PremiereDate ??= item.PremiereDate;
subOptions.ForceSave = true;
}
return RefreshMetadataForOwnedItem(i, true, subOptions, cancellationToken);
});