From 54d2afac8d80710dc05461a9eca3a95a8c1c2bbb Mon Sep 17 00:00:00 2001 From: Adam R Grey Date: Sun, 12 Nov 2023 16:23:38 -0500 Subject: [PATCH] attempt to clean up working directories --- Program.cs | 19 +++++++++++++++++++ tasks/ChatMessage.cs | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Program.cs b/Program.cs index 8bdd2c7..12f30ff 100644 --- a/Program.cs +++ b/Program.cs @@ -179,6 +179,25 @@ namespace ttrss_co_client await ttrssClient.Logout(); Console.WriteLine($"logged out of ttrss."); + #region cleanup + Console.WriteLine("===== phase 3 ====="); + //loop through working directory looking for other work orders to add + var subdirs = Directory.GetDirectories(conf.WorkingDirectory); + foreach(var subdir in subdirs) + { + if(Directory.GetFiles(subdir)?.Length == 0) + { + Console.WriteLine($"{subdir} is empty"); + Directory.Delete(subdir); + } + else + { + Console.WriteLine($"{subdir} is not empty: {string.Join(", ", Directory.GetFiles(subdir))}"); + } + } + + #endregion + Console.WriteLine($"done for real"); } static Configuration Configure(string configurationPath = "appsettings.json") diff --git a/tasks/ChatMessage.cs b/tasks/ChatMessage.cs index 364b341..42e4585 100644 --- a/tasks/ChatMessage.cs +++ b/tasks/ChatMessage.cs @@ -17,7 +17,7 @@ public class ChatMessage : Phase2Task await Process.Start(ChatScript, workOrder.data["chatmessage"] + (await TtrssClient.GetArticles(workOrder.articleId)).First().feed_title + - "; " + + ": " + (await TtrssClient.GetArticles(workOrder.articleId)).First().title ).WaitForExitAsync(); return new Tuple(TaskStatus.Done, workOrder);