works
and can even run in another directory! now I need to really really nail down a format.
This commit is contained in:
parent
f3a134ad92
commit
70e17dffad
55
Program.cs
55
Program.cs
@ -41,19 +41,14 @@ namespace placeholdervo
|
|||||||
{
|
{
|
||||||
foreach(var srcKey in filePickups.Keys)
|
foreach(var srcKey in filePickups.Keys)
|
||||||
{
|
{
|
||||||
// var files = Directory.GetFiles(conf.sync_dropoff);
|
//Console.WriteLine($"hoping for {srcKey} (would move it to {filePickups[srcKey]})");
|
||||||
// Console.WriteLine($"files listed: {string.Join(", ", files)}");
|
|
||||||
// Console.WriteLine($"hoping for: {string.Join(", ", filePickups.Keys)}");
|
|
||||||
// Console.WriteLine($"sanity check: first listed file: {Path.GetFileName(files.FirstOrDefault())}");
|
|
||||||
// Console.WriteLine($"sanity check: first key: {scriptFragmentVoiceFiles.Keys.FirstOrDefault()}");
|
|
||||||
// Console.WriteLine($"sanity check: first value: {scriptFragmentVoiceFiles[scriptFragmentVoiceFiles.Keys.FirstOrDefault()]}");
|
|
||||||
if(File.Exists(srcKey))
|
if(File.Exists(srcKey))
|
||||||
{
|
{
|
||||||
Console.WriteLine($"found {srcKey}");
|
Console.WriteLine($"found {srcKey}");
|
||||||
string dest;
|
string dest;
|
||||||
if (filePickups.TryRemove(srcKey, out dest))
|
if (filePickups.TryRemove(srcKey, out dest))
|
||||||
{
|
{
|
||||||
File.Move(srcKey, dest);
|
File.Move(srcKey, dest, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -64,7 +59,12 @@ namespace placeholdervo
|
|||||||
}
|
}
|
||||||
if(scriptFileCancellationToken.IsCancellationRequested)
|
if(scriptFileCancellationToken.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
return;
|
//Console.WriteLine($"Cancellation requested. but I'm using it in more of a \"there won't be more work, but finish what you're doing\" kind of way.");
|
||||||
|
if(filePickups.IsEmpty)
|
||||||
|
{
|
||||||
|
Console.WriteLine("and we got nothing left, so we quit.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.Threading.Thread.Sleep(TimeSpan.FromSeconds(5));
|
System.Threading.Thread.Sleep(TimeSpan.FromSeconds(5));
|
||||||
@ -74,17 +74,32 @@ namespace placeholdervo
|
|||||||
private static async void FFStuff()
|
private static async void FFStuff()
|
||||||
{
|
{
|
||||||
var cardCount = 0;
|
var cardCount = 0;
|
||||||
|
var magnitude = 1;
|
||||||
|
Console.WriteLine($"{titleCardLines.Count} title card lines");
|
||||||
|
magnitude = (int)Math.Log10(titleCardLines.Count);
|
||||||
|
Directory.CreateDirectory(conf.titlecards_dest);
|
||||||
foreach(var tcL in titleCardLines)
|
foreach(var tcL in titleCardLines)
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("titlecard commanding");
|
||||||
await Process.Start(conf.titlecard_command, tcL).WaitForExitAsync();
|
await Process.Start(conf.titlecard_command, tcL).WaitForExitAsync();
|
||||||
File.Move("tc.png", Path.Combine(conf.titlecards_dest, $"tc{cardCount++}.png"));
|
cardCount++;
|
||||||
|
File.Move("tc.png", Path.Combine(conf.titlecards_dest, $"tc{cardCount.ToString($"D{magnitude}")}.png"), true);
|
||||||
}
|
}
|
||||||
|
Console.WriteLine("titlecards done");
|
||||||
|
|
||||||
cardCount = 0;
|
if(noteLines != null)
|
||||||
foreach(var nL in noteLines)
|
|
||||||
{
|
{
|
||||||
await Process.Start(conf.titlecard_command, nL).WaitForExitAsync();
|
cardCount = 0;
|
||||||
File.Move("n0.png", Path.Combine(conf.notes_dest, $"note{cardCount++}.png"));
|
Console.WriteLine($"{noteLines?.Count} note lines");
|
||||||
|
magnitude = (int)Math.Log10(noteLines?.Count ?? 1);
|
||||||
|
Directory.CreateDirectory(conf.notes_dest);
|
||||||
|
foreach(var nL in noteLines)
|
||||||
|
{
|
||||||
|
Console.WriteLine("note commanding");
|
||||||
|
await Process.Start(conf.note_command, nL).WaitForExitAsync();
|
||||||
|
cardCount++;
|
||||||
|
File.Move("note.png", Path.Combine(conf.notes_dest, $"note{cardCount.ToString($"D{magnitude}")}.png"), true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static async Task Main(string[] args)
|
public static async Task Main(string[] args)
|
||||||
@ -121,10 +136,10 @@ namespace placeholdervo
|
|||||||
.Append("\n").Append("\n");
|
.Append("\n").Append("\n");
|
||||||
var primaryVOLines = new List<string>();
|
var primaryVOLines = new List<string>();
|
||||||
var titlecardUnprocessed = new List<string>();
|
var titlecardUnprocessed = new List<string>();
|
||||||
var titlecardLines = new List<string>();
|
|
||||||
var directiveLines = new List<string>();
|
var directiveLines = new List<string>();
|
||||||
var altVOLines = new List<string>();
|
var altVOLines = new List<string>();
|
||||||
var noteLines = new List<string>();
|
|
||||||
foreach(var l in lines)
|
foreach(var l in lines)
|
||||||
{
|
{
|
||||||
if(l.StartsWith('#'))
|
if(l.StartsWith('#'))
|
||||||
@ -173,7 +188,7 @@ namespace placeholdervo
|
|||||||
TitleCardText = string.Join('.', titleLevels[1..]) + ": " + TitleCardText;
|
TitleCardText = string.Join('.', titleLevels[1..]) + ": " + TitleCardText;
|
||||||
}
|
}
|
||||||
Console.WriteLine($"title card: {TitleCardText}");
|
Console.WriteLine($"title card: {TitleCardText}");
|
||||||
titlecardLines.Add(TitleCardText);
|
titleCardLines.Enqueue(TitleCardText);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -213,7 +228,7 @@ namespace placeholdervo
|
|||||||
var parameterText = thisLine[(thisLine.IndexOf(']') + 1) ..].Trim();
|
var parameterText = thisLine[(thisLine.IndexOf(']') + 1) ..].Trim();
|
||||||
if(directiveName == "note")
|
if(directiveName == "note")
|
||||||
{
|
{
|
||||||
noteLines.Add(parameterText);
|
noteLines.Enqueue(parameterText);
|
||||||
Console.WriteLine($"on screen note: {parameterText}");
|
Console.WriteLine($"on screen note: {parameterText}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -233,6 +248,8 @@ namespace placeholdervo
|
|||||||
// execute them all
|
// execute them all
|
||||||
taskHeap.Add(Task.Run(FFStuff));
|
taskHeap.Add(Task.Run(FFStuff));
|
||||||
taskHeap.Add(Task.Run(filePickup));
|
taskHeap.Add(Task.Run(filePickup));
|
||||||
|
Console.WriteLine("sleeping for 1 sec before requesting cancellation");
|
||||||
|
System.Threading.Thread.Sleep(TimeSpan.FromSeconds(1));
|
||||||
cancelSource.Cancel();
|
cancelSource.Cancel();
|
||||||
Task.WaitAll([.. taskHeap]);
|
Task.WaitAll([.. taskHeap]);
|
||||||
Console.WriteLine("kbai");
|
Console.WriteLine("kbai");
|
||||||
@ -252,11 +269,11 @@ namespace placeholdervo
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var fname = await response.Content.ReadAsStringAsync();
|
var fname = (await response.Content.ReadAsStringAsync()).Trim('[').Trim(']').Trim('"');
|
||||||
Console.WriteLine($"success; {fname}."); //"success" might be a strong word; it's successfully submitted. Its decided what filename it will, eventually, give it.
|
Console.WriteLine($"success; {fname}."); //"success" might be a strong word; it's successfully submitted. Its decided what filename it will, eventually, give it.
|
||||||
var ext = Path.GetExtension(fname);
|
var ext = Path.GetExtension(fname);
|
||||||
Directory.CreateDirectory(conf.VODropoff);
|
Directory.CreateDirectory(conf.VODropoff);
|
||||||
awaitFile(Path.Combine(conf.sync_dropoff, fname), destPath + $".{ext}");
|
awaitFile(Path.Combine(conf.sync_dropoff, fname), destPath + $"{ext}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user