From a75549c6990776b632852438bfae4fa79b6f1434 Mon Sep 17 00:00:00 2001 From: Glax Date: Sat, 2 Nov 2024 16:24:09 +0100 Subject: [PATCH 1/2] Only try loading .json files on startup (exclude .failed for example) --- Tranga/Jobs/JobBoss.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Tranga/Jobs/JobBoss.cs b/Tranga/Jobs/JobBoss.cs index fd48ef6..42f5f50 100644 --- a/Tranga/Jobs/JobBoss.cs +++ b/Tranga/Jobs/JobBoss.cs @@ -150,10 +150,9 @@ public class JobBoss : GlobalBase File.SetUnixFileMode(TrangaSettings.jobsFolderPath, UserRead | UserWrite | UserExecute | GroupRead | OtherRead); if (!Directory.Exists(TrangaSettings.jobsFolderPath)) //No jobs to load return; - Regex idRex = new (@"(.*)\.json"); //Load json-job-files - foreach (FileInfo file in new DirectoryInfo(TrangaSettings.jobsFolderPath).EnumerateFiles().Where(fileInfo => idRex.IsMatch(fileInfo.Name))) + foreach (FileInfo file in Directory.GetFiles(TrangaSettings.jobsFolderPath, "*.json").Select(f => new FileInfo(f))) { Log($"Adding {file.Name}"); Job? job = JsonConvert.DeserializeObject(File.ReadAllText(file.FullName), From 5b0624654bac734fe3665fe2515fd5ad3b936967 Mon Sep 17 00:00:00 2001 From: Glax Date: Sat, 2 Nov 2024 16:24:44 +0100 Subject: [PATCH 2/2] rename duplicates to append ".duplicate" --- Tranga/Jobs/JobBoss.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tranga/Jobs/JobBoss.cs b/Tranga/Jobs/JobBoss.cs index 42f5f50..9a7e7c8 100644 --- a/Tranga/Jobs/JobBoss.cs +++ b/Tranga/Jobs/JobBoss.cs @@ -168,7 +168,7 @@ public class JobBoss : GlobalBase Log($"Adding Job {job}"); if (!AddJob(job, file.FullName)) //If we detect a duplicate, delete the file. { - string path = string.Concat(file.FullName, ".failed"); + string path = string.Concat(file.FullName, ".duplicate"); file.MoveTo(path); Log($"Duplicate detected or otherwise not able to add job to list.\nMoved job {job} to {path}"); }