aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs13
1 files changed, 13 insertions, 0 deletions
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);
});