add new scheduling engine, basic scripted schedule system (#2337)
* start to add content to scheduling engine * add first content instruction * add search content * allow scripted schedule creation * don't use scheduling engine in sequential playout builder, yet
This commit is contained in:
@@ -1,22 +1,33 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using ErsatzTV.Core.Interfaces.Scheduling;
|
||||
using ErsatzTV.Core.Domain;
|
||||
using ErsatzTV.Core.Scheduling.Engine;
|
||||
|
||||
namespace ErsatzTV.Core.Scheduling.ScriptedScheduling.Modules;
|
||||
|
||||
[SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores")]
|
||||
public class ContentModule
|
||||
[SuppressMessage("Usage", "VSTHRD002:Avoid problematic synchronous waits")]
|
||||
public class ContentModule(ISchedulingEngine schedulingEngine)
|
||||
{
|
||||
private Dictionary<string, IMediaCollectionEnumerator> _contentEnumerators = [];
|
||||
|
||||
public bool add_collection(string key, string name, string order)
|
||||
public bool add_search(string key, string query, string order)
|
||||
{
|
||||
if (_contentEnumerators.ContainsKey(key))
|
||||
if (!Enum.TryParse(order, ignoreCase: true, out PlaybackOrder playbackOrder))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Console.WriteLine($"Adding collection '{name}' with key '{key}' and order '{order}'");
|
||||
_contentEnumerators.Clear();
|
||||
schedulingEngine.AddSearch(key, query, playbackOrder).GetAwaiter().GetResult();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool add_collection(string key, string collection, string order)
|
||||
{
|
||||
if (!Enum.TryParse(order, ignoreCase: true, out PlaybackOrder playbackOrder))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
schedulingEngine.AddCollection(key, collection, playbackOrder).GetAwaiter().GetResult();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user