From ca1f7af4458feffa7b9800d536b536e544fc4b7c Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Tue, 21 Jul 2026 20:27:04 +0200 Subject: Fix incorrect year on local trailers --- MediaBrowser.Controller/Entities/BaseItem.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 49a4ed4bf6..cc2a425a4d 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -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); }); -- cgit v1.2.3