add all content sources to scripted schedules (#2340)
* add show content * add multi collection content * add smart collection content * add playlist content * fix infinite loop * add marathon content
This commit is contained in:
@@ -2,6 +2,7 @@ using ErsatzTV.Core.Domain;
|
||||
using ErsatzTV.Core.Interfaces.Repositories;
|
||||
using ErsatzTV.Core.Interfaces.Scheduling;
|
||||
using ErsatzTV.Core.Scheduling.BlockScheduling;
|
||||
using ErsatzTV.Core.Scheduling.Engine;
|
||||
using ErsatzTV.Core.Scheduling.YamlScheduling.Models;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
@@ -96,19 +97,42 @@ public class EnumeratorCache(IMediaCollectionRepository mediaCollectionRepositor
|
||||
// marathon is a special case that needs to be handled on its own
|
||||
if (content is YamlPlayoutContentMarathonItem marathon)
|
||||
{
|
||||
var helper = new YamlPlayoutMarathonHelper(mediaCollectionRepository);
|
||||
Option<YamlMarathonContentResult> maybeResult = await helper.GetEnumerator(
|
||||
marathon,
|
||||
var helper = new MarathonHelper(mediaCollectionRepository);
|
||||
var guids = new Dictionary<string, List<string>>();
|
||||
foreach (var guid in marathon.Guids)
|
||||
{
|
||||
if (!guids.TryGetValue(guid.Source, out List<string> value))
|
||||
{
|
||||
value = [];
|
||||
guids.Add(guid.Source, value);
|
||||
}
|
||||
|
||||
value.Add(guid.Value);
|
||||
}
|
||||
|
||||
if (!Enum.TryParse(marathon.ItemOrder, true, out PlaybackOrder itemPlaybackOrder))
|
||||
{
|
||||
itemPlaybackOrder = PlaybackOrder.Shuffle;
|
||||
}
|
||||
|
||||
Option<MarathonContentResult> maybeResult = await helper.GetEnumerator(
|
||||
guids,
|
||||
marathon.Searches,
|
||||
marathon.GroupBy,
|
||||
marathon.ShuffleGroups,
|
||||
itemPlaybackOrder,
|
||||
marathon.PlayAllItems,
|
||||
state,
|
||||
cancellationToken);
|
||||
foreach (YamlMarathonContentResult result in maybeResult)
|
||||
|
||||
foreach (MarathonContentResult result in maybeResult)
|
||||
{
|
||||
foreach ((CollectionKey collectionKey, List<MediaItem> mediaItems) in result.Content)
|
||||
{
|
||||
_playlistMediaItems.Add(new PlaylistKey(contentKey, collectionKey), mediaItems);
|
||||
}
|
||||
|
||||
return Some(result.PlaylistEnumerator);
|
||||
return result.PlaylistEnumerator;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user