From 694db80d4c8e83ff381af56d2a3dde29e0855c3d Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Fri, 30 Jan 2026 21:58:24 +0100 Subject: Reroute on version removal --- MediaBrowser.Controller/Library/ILibraryManager.cs | 9 +++++++++ MediaBrowser.Controller/Persistence/IItemRepository.cs | 17 +++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'MediaBrowser.Controller') diff --git a/MediaBrowser.Controller/Library/ILibraryManager.cs b/MediaBrowser.Controller/Library/ILibraryManager.cs index c19d15d85f..48859de04b 100644 --- a/MediaBrowser.Controller/Library/ILibraryManager.cs +++ b/MediaBrowser.Controller/Library/ILibraryManager.cs @@ -714,5 +714,14 @@ namespace MediaBrowser.Controller.Library /// The path to the virtualfolder. /// The new virtualfolder. public void CreateShortcut(string virtualFolderPath, MediaPathInfo pathInfo); + + /// + /// Re-routes LinkedChildren references from one child to another. + /// Used when video versions change to maintain playlist/BoxSet integrity. + /// + /// The child ID to re-route from. + /// The child ID to re-route to. + /// Number of references updated. + int RerouteLinkedChildReferences(Guid fromChildId, Guid toChildId); } } diff --git a/MediaBrowser.Controller/Persistence/IItemRepository.cs b/MediaBrowser.Controller/Persistence/IItemRepository.cs index f7ed39730e..504adff86c 100644 --- a/MediaBrowser.Controller/Persistence/IItemRepository.cs +++ b/MediaBrowser.Controller/Persistence/IItemRepository.cs @@ -210,4 +210,21 @@ public interface IItemRepository /// The user ID for access filtering. /// Dictionary mapping parent ID to child count. Dictionary GetChildCountBatch(IReadOnlyList parentIds, Guid? userId); + + /// + /// Gets parent IDs (Playlists/BoxSets) that reference the specified child with LinkedChildType.Manual. + /// + /// The child item ID. + /// List of parent IDs that reference the child. + IReadOnlyList GetManualLinkedParentIds(Guid childId); + + /// + /// Updates LinkedChildren references from one child to another, preserving SortOrder. + /// Handles duplicates: if parent already references toChildId, removes the old reference instead. + /// Used when video versions change to maintain collection integrity. + /// + /// The child ID to re-route from. + /// The child ID to re-route to. + /// Number of references updated. + int RerouteLinkedChildren(Guid fromChildId, Guid toChildId); } -- cgit v1.2.3