Add RefreshLibrariesWorker.cs

This commit is contained in:
2025-09-21 16:27:43 +02:00
parent b22f6ac9d6
commit 4e3968f4b1
5 changed files with 72 additions and 10 deletions

View File

@@ -1,5 +1,6 @@
using System.Runtime.InteropServices;
using API.MangaDownloadClients;
using API.Workers;
using Newtonsoft.Json;
namespace API;
@@ -54,6 +55,10 @@ public struct TrangaSettings()
public int MaxConcurrentWorkers { get; set; } = Math.Max(Environment.ProcessorCount, 4); // Minimum of 4 Tasks, maximum of 1 per Core
public LibraryRefreshSetting LibraryRefreshSetting { get; set; } = LibraryRefreshSetting.AfterMangaFinished;
public int RefreshLibraryWhileDownloadingEveryMinutes { get; set; } = 10;
public static TrangaSettings Load()
{
if (!File.Exists(SettingsFilePath))
@@ -125,4 +130,16 @@ public struct TrangaSettings()
this.MaxConcurrentWorkers = value;
Save();
}
public void SetLibraryRefreshSetting(LibraryRefreshSetting setting)
{
this.LibraryRefreshSetting = setting;
Save();
}
public void SetRefreshLibraryWhileDownloadingEveryMinutes(int value)
{
this.RefreshLibraryWhileDownloadingEveryMinutes = value;
Save();
}
}