|
|
@ -509,35 +509,35 @@ namespace MediaBrowser.Controller.Entities
|
|
|
|
}).FirstOrDefault();
|
|
|
|
}).FirstOrDefault();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override List<Tuple<BaseItem, MediaSourceType>> GetAllItemsForMediaSources()
|
|
|
|
protected override IEnumerable<(BaseItem, MediaSourceType)> GetAllItemsForMediaSources()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var list = new List<Tuple<BaseItem, MediaSourceType>>();
|
|
|
|
var list = new List<(BaseItem, MediaSourceType)>
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
(this, MediaSourceType.Default)
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
list.Add(new Tuple<BaseItem, MediaSourceType>(this, MediaSourceType.Default));
|
|
|
|
list.AddRange(GetLinkedAlternateVersions().Select(i => ((BaseItem)i, MediaSourceType.Grouping)));
|
|
|
|
list.AddRange(GetLinkedAlternateVersions().Select(i => new Tuple<BaseItem, MediaSourceType>(i, MediaSourceType.Grouping)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(PrimaryVersionId))
|
|
|
|
if (!string.IsNullOrEmpty(PrimaryVersionId))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var primary = LibraryManager.GetItemById(PrimaryVersionId) as Video;
|
|
|
|
if (LibraryManager.GetItemById(PrimaryVersionId) is Video primary)
|
|
|
|
if (primary != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var existingIds = list.Select(i => i.Item1.Id).ToList();
|
|
|
|
var existingIds = list.Select(i => i.Item1.Id).ToList();
|
|
|
|
list.Add(new Tuple<BaseItem, MediaSourceType>(primary, MediaSourceType.Grouping));
|
|
|
|
list.Add((primary, MediaSourceType.Grouping));
|
|
|
|
list.AddRange(primary.GetLinkedAlternateVersions().Where(i => !existingIds.Contains(i.Id)).Select(i => new Tuple<BaseItem, MediaSourceType>(i, MediaSourceType.Grouping)));
|
|
|
|
list.AddRange(primary.GetLinkedAlternateVersions().Where(i => !existingIds.Contains(i.Id)).Select(i => ((BaseItem)i, MediaSourceType.Grouping)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var localAlternates = list
|
|
|
|
var localAlternates = list
|
|
|
|
.SelectMany(i =>
|
|
|
|
.SelectMany(i =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var video = i.Item1 as Video;
|
|
|
|
return i.Item1 is Video video ? video.GetLocalAlternateVersionIds() : Enumerable.Empty<Guid>();
|
|
|
|
return video == null ? new List<Guid>() : video.GetLocalAlternateVersionIds();
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.Select(LibraryManager.GetItemById)
|
|
|
|
.Select(LibraryManager.GetItemById)
|
|
|
|
.Where(i => i != null)
|
|
|
|
.Where(i => i != null)
|
|
|
|
.ToList();
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
list.AddRange(localAlternates.Select(i => new Tuple<BaseItem, MediaSourceType>(i, MediaSourceType.Default)));
|
|
|
|
list.AddRange(localAlternates.Select(i => (i, MediaSourceType.Default)));
|
|
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
}
|
|
|
|