2023-05-31 21:15:32 +02:00
|
|
|
|
namespace Tranga.TrangaTasks;
|
|
|
|
|
|
|
|
|
|
public class UpdateKomgaLibraryTask : TrangaTask
|
|
|
|
|
{
|
|
|
|
|
public UpdateKomgaLibraryTask(Task task, TimeSpan reoccurrence) : base(task, null, null, reoccurrence)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Execute(TaskManager taskManager)
|
|
|
|
|
{
|
2023-05-31 21:40:00 +02:00
|
|
|
|
this.state = ExecutionState.Running;
|
2023-05-31 21:15:32 +02:00
|
|
|
|
if (taskManager.komga is null)
|
|
|
|
|
return;
|
|
|
|
|
Komga komga = taskManager.komga;
|
|
|
|
|
|
|
|
|
|
Komga.KomgaLibrary[] allLibraries = komga.GetLibraries();
|
|
|
|
|
foreach (Komga.KomgaLibrary lib in allLibraries)
|
|
|
|
|
komga.UpdateLibrary(lib.id);
|
2023-05-31 21:52:50 +02:00
|
|
|
|
this.state = ExecutionState.Waiting;
|
2023-05-31 21:15:32 +02:00
|
|
|
|
}
|
|
|
|
|
}
|