Backport pull request #15472 from jellyfin/release-10.11.z

Fix series DateLastMediaAdded not updating when new episodes are added

Original-merge: abfbaca336

Merged-by: crobibero <cody@robibe.ro>

Backported-by: Bond_009 <bond.009@outlook.com>
This commit is contained in:
theguymadmax 2025-11-17 14:09:06 -05:00 committed by Bond_009
parent 99c68ddd50
commit 4e68a5a078
1 changed files with 42 additions and 32 deletions

View File

@ -317,12 +317,8 @@ namespace MediaBrowser.Providers.Manager
{
if (EnableUpdateMetadataFromChildren(item, isFullRefresh, updateType))
{
if (isFullRefresh || updateType > ItemUpdateType.None)
{
var children = GetChildrenForMetadataUpdates(item);
updateType = UpdateMetadataFromChildren(item, children, isFullRefresh, updateType);
}
var children = GetChildrenForMetadataUpdates(item);
updateType = UpdateMetadataFromChildren(item, children, isFullRefresh, updateType);
}
var presentationUniqueKey = item.CreatePresentationUniqueKey();
@ -362,16 +358,24 @@ namespace MediaBrowser.Providers.Manager
protected virtual bool EnableUpdateMetadataFromChildren(TItemType item, bool isFullRefresh, ItemUpdateType currentUpdateType)
{
if (isFullRefresh || currentUpdateType > ItemUpdateType.None)
if (item is Folder folder)
{
if (EnableUpdatingPremiereDateFromChildren || EnableUpdatingGenresFromChildren || EnableUpdatingStudiosFromChildren || EnableUpdatingOfficialRatingFromChildren)
if (!isFullRefresh && currentUpdateType == ItemUpdateType.None)
{
return true;
return folder.SupportsDateLastMediaAdded;
}
if (item is Folder folder)
if (isFullRefresh || currentUpdateType > ItemUpdateType.None)
{
return folder.SupportsDateLastMediaAdded || folder.SupportsCumulativeRunTimeTicks;
if (EnableUpdatingPremiereDateFromChildren || EnableUpdatingGenresFromChildren || EnableUpdatingStudiosFromChildren || EnableUpdatingOfficialRatingFromChildren)
{
return true;
}
if (folder.SupportsDateLastMediaAdded || folder.SupportsCumulativeRunTimeTicks)
{
return true;
}
}
}
@ -392,36 +396,42 @@ namespace MediaBrowser.Providers.Manager
{
var updateType = ItemUpdateType.None;
if (isFullRefresh || currentUpdateType > ItemUpdateType.None)
if (item is Folder folder)
{
updateType |= UpdateCumulativeRunTimeTicks(item, children);
updateType |= UpdateDateLastMediaAdded(item, children);
// don't update user-changeable metadata for locked items
if (item.IsLocked)
if (folder.SupportsDateLastMediaAdded)
{
return updateType;
updateType |= UpdateDateLastMediaAdded(item, children);
}
if (EnableUpdatingPremiereDateFromChildren)
if ((isFullRefresh || currentUpdateType > ItemUpdateType.None) && folder.SupportsCumulativeRunTimeTicks)
{
updateType |= UpdatePremiereDate(item, children);
updateType |= UpdateCumulativeRunTimeTicks(item, children);
}
}
if (EnableUpdatingGenresFromChildren)
{
updateType |= UpdateGenres(item, children);
}
if (!(isFullRefresh || currentUpdateType > ItemUpdateType.None) || item.IsLocked)
{
return updateType;
}
if (EnableUpdatingStudiosFromChildren)
{
updateType |= UpdateStudios(item, children);
}
if (EnableUpdatingPremiereDateFromChildren)
{
updateType |= UpdatePremiereDate(item, children);
}
if (EnableUpdatingOfficialRatingFromChildren)
{
updateType |= UpdateOfficialRating(item, children);
}
if (EnableUpdatingGenresFromChildren)
{
updateType |= UpdateGenres(item, children);
}
if (EnableUpdatingStudiosFromChildren)
{
updateType |= UpdateStudios(item, children);
}
if (EnableUpdatingOfficialRatingFromChildren)
{
updateType |= UpdateOfficialRating(item, children);
}
return updateType;