diff --git a/Program.cs b/Program.cs index 94db0fb..0d7fb2b 100644 --- a/Program.cs +++ b/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; diff --git a/showHandlers/TwitchStreamHandler.cs b/showHandlers/TwitchStreamHandler.cs index 177078b..d8271e4 100644 --- a/showHandlers/TwitchStreamHandler.cs +++ b/showHandlers/TwitchStreamHandler.cs @@ -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}"); } } } \ No newline at end of file diff --git a/showHandlers/YoutubeHandler.cs b/showHandlers/YoutubeHandler.cs new file mode 100644 index 0000000..e18dcd0 --- /dev/null +++ b/showHandlers/YoutubeHandler.cs @@ -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}"); + } + } +} \ No newline at end of file