youtube run tested, currently gets enqueued twice
This commit is contained in:
parent
8614b42e47
commit
d2f384f4d7
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace Director
|
namespace Director
|
||||||
{
|
{
|
||||||
@ -41,19 +42,22 @@ namespace Director
|
|||||||
{
|
{
|
||||||
Console.WriteLine($"[{DateTime.Now.ToLongTimeString()}] [{logLevel.ToString()}] {message}");
|
Console.WriteLine($"[{DateTime.Now.ToLongTimeString()}] [{logLevel.ToString()}] {message}");
|
||||||
|
|
||||||
//if(logLevel >= LogLevel.Warning && false)
|
if(logLevel >= LogLevel.Warning)
|
||||||
if (false) //TODO: re-enable
|
|
||||||
{
|
{
|
||||||
var httpWebRequest = (HttpWebRequest)WebRequest.Create(call_for_humans_discord_webhook);
|
//Task.Run(() => forwardToDiscord(message, logLevel));
|
||||||
httpWebRequest.ContentType = "application/json";
|
|
||||||
httpWebRequest.Method = "POST";
|
|
||||||
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
|
|
||||||
{
|
|
||||||
streamWriter.Write($"{{\"content\":\"[{DateTime.Now.ToLongTimeString()}] [{logLevel.ToString()}] {message}\"}}");
|
|
||||||
}
|
|
||||||
httpWebRequest.GetResponse();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public async void forwardToDiscord(string message, LogLevel logLevel)
|
||||||
|
{
|
||||||
|
var httpWebRequest = (HttpWebRequest)WebRequest.Create(call_for_humans_discord_webhook);
|
||||||
|
httpWebRequest.ContentType = "application/json";
|
||||||
|
httpWebRequest.Method = "POST";
|
||||||
|
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
|
||||||
|
{
|
||||||
|
streamWriter.Write($"{{\"content\":\"[{DateTime.Now.ToLongTimeString()}] [{logLevel.ToString()}] {message}\"}}");
|
||||||
|
}
|
||||||
|
httpWebRequest.GetResponseAsync();
|
||||||
|
}
|
||||||
public enum LogLevel
|
public enum LogLevel
|
||||||
{
|
{
|
||||||
Trace, //development
|
Trace, //development
|
||||||
|
@ -40,7 +40,8 @@ namespace director
|
|||||||
httpClient = new HttpClient();
|
httpClient = new HttpClient();
|
||||||
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(
|
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(
|
||||||
System.Text.Encoding.ASCII.GetBytes($"{conf.webdav_username}:{conf.webdav_password}")));
|
System.Text.Encoding.ASCII.GetBytes($"{conf.webdav_username}:{conf.webdav_password}")));
|
||||||
//tf = new Telefranz("scheduler", conf.kafka_bootstrap);
|
|
||||||
|
Telefranz.Configure("scheduler", conf.kafka_bootstrap);
|
||||||
|
|
||||||
scratch = Scratch.LoadScratch();
|
scratch = Scratch.LoadScratch();
|
||||||
|
|
||||||
@ -96,7 +97,7 @@ namespace director
|
|||||||
}
|
}
|
||||||
Console.WriteLine("calendars checked");
|
Console.WriteLine("calendars checked");
|
||||||
#if (DEBUG)
|
#if (DEBUG)
|
||||||
for (int i = 0; i < 1; i++)
|
for (int i = 0; i < 0; i++)
|
||||||
{
|
{
|
||||||
var psuedo = new Schedulable.Schedulable();
|
var psuedo = new Schedulable.Schedulable();
|
||||||
psuedo.Showtime = DateTime.Now + TimeSpan.FromSeconds(30);
|
psuedo.Showtime = DateTime.Now + TimeSpan.FromSeconds(30);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="silvermeddlists.franz" Version="0.0.4" />
|
<PackageReference Include="silvermeddlists.franz" Version="0.0.5" />
|
||||||
<PackageReference Include="WebDav.Client" Version="2.7.0" />
|
<PackageReference Include="WebDav.Client" Version="2.7.0" />
|
||||||
<PackageReference Include="Ical.Net" Version="4.2.0" />
|
<PackageReference Include="Ical.Net" Version="4.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -51,12 +51,12 @@ namespace ShowHandlers
|
|||||||
Console.WriteLine($"preshow agents needed: {string.Join(", ", AgentsNeeded)}");
|
Console.WriteLine($"preshow agents needed: {string.Join(", ", AgentsNeeded)}");
|
||||||
agentsPresent.Clear();
|
agentsPresent.Clear();
|
||||||
|
|
||||||
//TODO: actual telefranz
|
Telefranz.Instance.addHandler<silver_messages.global.report>(agentReports);
|
||||||
//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)
|
while (AgentsNeeded.Where(ap => !agentsPresent.Contains(ap))?.Count() > 0)
|
||||||
{
|
{
|
||||||
checkSignal.WaitOne(TimeSpan.FromSeconds(15));
|
checkSignal.WaitOne(TimeSpan.FromSeconds(15));
|
||||||
|
//Telefranz.Instance.ProduceMessage(new silver_messages.global.sound_off());
|
||||||
if (DateTime.Now > evt.OccurrenceStart - leadNeeded)
|
if (DateTime.Now > evt.OccurrenceStart - leadNeeded)
|
||||||
{
|
{
|
||||||
var miaAgents = string.Join(", ", AgentsNeeded.Where(ap => !agentsPresent.Contains(ap)));
|
var miaAgents = string.Join(", ", AgentsNeeded.Where(ap => !agentsPresent.Contains(ap)));
|
||||||
@ -69,7 +69,7 @@ namespace ShowHandlers
|
|||||||
protected void preShow_RunChecks(iCalHoopJumping.CalendarOccurrence evt, TimeSpan leadNeeded)
|
protected void preShow_RunChecks(iCalHoopJumping.CalendarOccurrence evt, TimeSpan leadNeeded)
|
||||||
{
|
{
|
||||||
var argsList = new List<string>() { JsonConvert.SerializeObject(evt) };
|
var argsList = new List<string>() { JsonConvert.SerializeObject(evt) };
|
||||||
//Telefranz.Instance.addHandler<silver_messages.youtube.metadata_needed>(youtubeAgentReports);
|
Telefranz.Instance.addHandler<silver_messages.youtube.metadata_needed>(youtubeAgentReports);
|
||||||
Console.WriteLine($"pre show: run check. It's just going to be \"is the metadata set\".");
|
Console.WriteLine($"pre show: run check. It's just going to be \"is the metadata set\".");
|
||||||
Action issueChecks = () =>
|
Action issueChecks = () =>
|
||||||
{
|
{
|
||||||
@ -91,6 +91,7 @@ namespace ShowHandlers
|
|||||||
}
|
}
|
||||||
protected void agentReports(silver_messages.global.report r)
|
protected void agentReports(silver_messages.global.report r)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine($"agent responding to sound off: {r.name}");
|
||||||
if (AgentsNeeded?.FirstOrDefault(an => an.ToLower() == r.name.ToLower()) != null)
|
if (AgentsNeeded?.FirstOrDefault(an => an.ToLower() == r.name.ToLower()) != null)
|
||||||
{
|
{
|
||||||
lock (agentsPresent)
|
lock (agentsPresent)
|
||||||
|
Loading…
Reference in New Issue
Block a user