youtube run tested, currently gets enqueued twice
This commit is contained in:
parent
8614b42e47
commit
d2f384f4d7
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Director
|
||||
{
|
||||
@ -41,19 +42,22 @@ namespace Director
|
||||
{
|
||||
Console.WriteLine($"[{DateTime.Now.ToLongTimeString()}] [{logLevel.ToString()}] {message}");
|
||||
|
||||
//if(logLevel >= LogLevel.Warning && false)
|
||||
if (false) //TODO: re-enable
|
||||
if(logLevel >= LogLevel.Warning)
|
||||
{
|
||||
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.GetResponse();
|
||||
//Task.Run(() => forwardToDiscord(message, logLevel));
|
||||
}
|
||||
}
|
||||
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
|
||||
{
|
||||
Trace, //development
|
||||
|
@ -40,7 +40,8 @@ namespace director
|
||||
httpClient = new HttpClient();
|
||||
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(
|
||||
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();
|
||||
|
||||
@ -96,7 +97,7 @@ namespace director
|
||||
}
|
||||
Console.WriteLine("calendars checked");
|
||||
#if (DEBUG)
|
||||
for (int i = 0; i < 1; i++)
|
||||
for (int i = 0; i < 0; i++)
|
||||
{
|
||||
var psuedo = new Schedulable.Schedulable();
|
||||
psuedo.Showtime = DateTime.Now + TimeSpan.FromSeconds(30);
|
||||
|
@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<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="Ical.Net" Version="4.2.0" />
|
||||
</ItemGroup>
|
||||
|
@ -51,12 +51,12 @@ namespace ShowHandlers
|
||||
Console.WriteLine($"preshow agents needed: {string.Join(", ", AgentsNeeded)}");
|
||||
agentsPresent.Clear();
|
||||
|
||||
//TODO: actual telefranz
|
||||
//Telefranz.Instance.addHandler<silver_messages.global.report>(agentReports);
|
||||
//Telefranz.Instance.ProduceMessage(new silver_messages.global.sound_off());
|
||||
Telefranz.Instance.addHandler<silver_messages.global.report>(agentReports);
|
||||
// Telefranz.Instance.ProduceMessage(new silver_messages.global.sound_off());
|
||||
while (AgentsNeeded.Where(ap => !agentsPresent.Contains(ap))?.Count() > 0)
|
||||
{
|
||||
checkSignal.WaitOne(TimeSpan.FromSeconds(15));
|
||||
//Telefranz.Instance.ProduceMessage(new silver_messages.global.sound_off());
|
||||
if (DateTime.Now > evt.OccurrenceStart - leadNeeded)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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\".");
|
||||
Action issueChecks = () =>
|
||||
{
|
||||
@ -91,6 +91,7 @@ namespace ShowHandlers
|
||||
}
|
||||
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)
|
||||
{
|
||||
lock (agentsPresent)
|
||||
|
Loading…
Reference in New Issue
Block a user