Stream custom live channels using your own media
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

23 lines
715 B

namespace ErsatzTV.Core.Scheduling;
public static class MultiCollectionGrouper
{
public static List<GroupedMediaItem> GroupMediaItems(IEnumerable<CollectionWithItems> collections)
{
var result = new List<GroupedMediaItem>();
foreach (CollectionWithItems collection in collections.Where(collection => collection.MediaItems.Any()))
{
if (collection.ScheduleAsGroup)
{
result.Add(new MultiCollectionGroup(collection));
}
else
{
result.AddRange(collection.MediaItems.Map(i => new GroupedMediaItem { First = i }));
}
}
return result.Distinct().ToList();
}
}