separate handlers
This commit is contained in:
parent
f7478e1ae7
commit
ea06956780
20
Program.cs
20
Program.cs
@ -127,7 +127,7 @@ namespace director
|
||||
|
||||
if (!workQueue.TryDequeue(out todo)) { continue; }
|
||||
|
||||
Console.WriteLine($"threadwork consumes! showtime at {todo.Showtime}; wake me at {todo.Showtime - conf.preshowBufferTime}");
|
||||
Console.WriteLine($"threadwork consumes! showtime at {todo.Showtime}; napping until {todo.Showtime - conf.preshowBufferTime}");
|
||||
switch(todo.ScedulableType)
|
||||
{
|
||||
case Schedulable.ScedulableType.TwitchStream:
|
||||
@ -137,25 +137,31 @@ namespace director
|
||||
Console.WriteLine("it's a yt release");
|
||||
break;
|
||||
}
|
||||
//Task.WaitAll(Task.Delay((todo.Showtime - conf.preshowBufferTime) - DateTime.Now));
|
||||
Task.WaitAll(Task.Delay((todo.Showtime - conf.preshowBufferTime) - DateTime.Now));
|
||||
Console.WriteLine("time to prep!");
|
||||
|
||||
|
||||
switch (todo.ScedulableType)
|
||||
{
|
||||
case Schedulable.ScedulableType.TwitchStream:
|
||||
try
|
||||
{
|
||||
var handler = new TwitchStreamHandler(todo.Occurrence);
|
||||
handler.Handle();
|
||||
TwitchStreamHandler.Handle(todo.Occurrence);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Log.Panic($"error in twitch stream handler! Panicking!\n{JsonConvert.SerializeObject(e)}");
|
||||
}
|
||||
break;
|
||||
// case Schedulable.ScedulableType.YTRelease:
|
||||
// break;
|
||||
case Schedulable.ScedulableType.YTRelease:
|
||||
try
|
||||
{
|
||||
YoutubeHandler.Handle(todo.Occurrence);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
Log.Panic($"error in youtube release handler! Panicking!\n{JsonConvert.SerializeObject(e)}");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Log.Panic($"unknown schedulable type! abandoning!");
|
||||
break;
|
||||
|
@ -1,19 +1,15 @@
|
||||
using System;
|
||||
using director;
|
||||
using Ical.Net.CalendarComponents;
|
||||
|
||||
namespace ShowHandlers
|
||||
{
|
||||
public class TwitchStreamHandler
|
||||
{
|
||||
public TwitchStreamHandler(iCalHoopJumping.CalendarOccurrence evt)
|
||||
{
|
||||
Event = evt;
|
||||
}
|
||||
|
||||
public iCalHoopJumping.CalendarOccurrence Event { get; }
|
||||
|
||||
public void Handle()
|
||||
public static void Handle(iCalHoopJumping.CalendarOccurrence evt)
|
||||
{
|
||||
Console.WriteLine("I am a twitch stream handler, it falls to me to...");
|
||||
Console.WriteLine(" H A N D L E ");
|
||||
Console.WriteLine($"current time is {DateTime.Now}");
|
||||
}
|
||||
}
|
||||
}
|
15
showHandlers/YoutubeHandler.cs
Normal file
15
showHandlers/YoutubeHandler.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using director;
|
||||
|
||||
namespace ShowHandlers
|
||||
{
|
||||
public class YoutubeHandler
|
||||
{
|
||||
public static void Handle(iCalHoopJumping.CalendarOccurrence evt)
|
||||
{
|
||||
Console.WriteLine("I am a YT handler, it falls to me to...");
|
||||
Console.WriteLine(" H A N D L E ");
|
||||
Console.WriteLine($"current time is {DateTime.Now}");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user