diff options
| author | Shadowghost <Ghost_of_Stone@web.de> | 2026-06-07 22:37:34 +0200 |
|---|---|---|
| committer | Shadowghost <Ghost_of_Stone@web.de> | 2026-06-07 23:06:14 +0200 |
| commit | 09723bd123b767b7d99157faa86df0fc305c87ea (patch) | |
| tree | 447c08df31b82a3b79e08610475dd1b958664864 /MediaBrowser.Controller/Entities/Video.cs | |
| parent | c242533f4ecdbf1fb04c172751007aab89a8645e (diff) | |
Aggregate alternate versions via GetAllVersions
Diffstat (limited to 'MediaBrowser.Controller/Entities/Video.cs')
| -rw-r--r-- | MediaBrowser.Controller/Entities/Video.cs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index 168ef7d817..f48de0869a 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -409,16 +409,26 @@ namespace MediaBrowser.Controller.Entities } /// <summary> + /// Gets this video together with all of its alternate versions (local and linked and, when this + /// is itself an alternate, the primary and the primary's other versions), deduplicated. + /// </summary> + /// <returns>This video and every alternate version of it.</returns> + public IReadOnlyList<Video> GetAllVersions() + { + return GetAllItemsForMediaSources() + .Select(i => i.Item) + .OfType<Video>() + .ToList(); + } + + /// <summary> /// Gets the alternate version of this video that matches the supplied item id. /// </summary> /// <param name="itemId">The version item id (the playback media source id).</param> /// <returns>The matching version, or <c>null</c> when the id is not a version of this video.</returns> public Video GetAlternateVersion(Guid itemId) { - return GetAllItemsForMediaSources() - .Select(i => i.Item) - .OfType<Video>() - .FirstOrDefault(i => i.Id.Equals(itemId)); + return GetAllVersions().FirstOrDefault(i => i.Id.Equals(itemId)); } public override string CreatePresentationUniqueKey() |
