yt handler theoretically works

This commit is contained in:
Adam R. Grey 2021-10-07 08:51:52 -04:00
parent a3722980e7
commit 58b2560051
2 changed files with 8 additions and 6 deletions

View File

@ -24,7 +24,7 @@ namespace director
private static HttpClient httpClient;
private static readonly ConcurrentQueue<Schedulable.Schedulable> workQueue = new ConcurrentQueue<Schedulable.Schedulable>();
private static readonly AutoResetEvent _signal = new AutoResetEvent(false);
private const int concurrentWorkers = 2;
private const int concurrentWorkers = 5;
static void Main(string[] args)
{
if (!File.Exists("appsettings.json"))
@ -97,11 +97,13 @@ namespace director
}
Console.WriteLine("calendars checked");
#if (DEBUG)
for (int i = 0; i < 0; i++)
//if(true)
{
Console.WriteLine("debug test");
var psuedo = new Schedulable.Schedulable();
psuedo.Showtime = DateTime.Now + TimeSpan.FromSeconds(30);
var partiallyCopiable = scratch.agenda?.FirstOrDefault(s => s.ScedulableType == Schedulable.ScedulableType.YTRelease);
var partiallyCopiable = scratch.agenda?.FirstOrDefault(s => s.ScedulableType == Schedulable.ScedulableType.TwitchStream);
psuedo.Occurrence = partiallyCopiable.Occurrence;
psuedo.Occurrence.OccurrenceStart = psuedo.Showtime;
psuedo.Occurrence.OccurrenceEnd = psuedo.Showtime;

View File

@ -23,7 +23,7 @@ namespace ShowHandlers
public override void Handle(iCalHoopJumping.CalendarOccurrence evt)
{
Console.WriteLine($"begin youtube handler. current time {DateTime.Now.ToLongTimeString()}");
Console.WriteLine(JsonConvert.SerializeObject(evt));
//Console.WriteLine(JsonConvert.SerializeObject(evt));
Task.Run(() => PreShow(evt));
Console.WriteLine("kicked off the pre-show");
if (evt.OccurrenceStart > DateTime.Now)
@ -52,7 +52,7 @@ namespace ShowHandlers
agentsPresent.Clear();
Telefranz.Instance.addHandler<silver_messages.global.report>(agentReports);
// Telefranz.Instance.ProduceMessage(new silver_messages.global.sound_off());
Telefranz.Instance.ProduceMessage(new silver_messages.global.sound_off());
while (AgentsNeeded.Where(ap => !agentsPresent.Contains(ap))?.Count() > 0)
{
checkSignal.WaitOne(TimeSpan.FromSeconds(15));
@ -78,7 +78,7 @@ namespace ShowHandlers
issueChecks();
while (metadataUnset(metadataSoFar))
{
//checkSignal.WaitOne(TimeSpan.FromHours(6));
//checkSignal.WaitOne(TimeSpan.FromHours(6)); //so bother me every 6 hours before yt release time if metadata isn't ready
checkSignal.WaitOne(TimeSpan.FromSeconds(15));
if (DateTime.Now > evt.OccurrenceStart - leadNeeded)
{