diff --git a/Tranga-API/Program.cs b/Tranga-API/Program.cs index f2ed2b9..0e8160e 100644 --- a/Tranga-API/Program.cs +++ b/Tranga-API/Program.cs @@ -103,7 +103,7 @@ app.MapGet("/Tasks/GetTaskProgress", (string taskType, string? connectorName, st { TrangaTask.Task pTask = Enum.Parse(taskType); TrangaTask? task = taskManager - .GetTasksMatching(pTask, connectorName: connectorName, publicationId: publicationId)?.First(); + .GetTasksMatching(pTask, connectorName: connectorName, internalId: publicationId)?.First(); if (task is null) return -1f; @@ -116,13 +116,13 @@ app.MapGet("/Tasks/GetTaskProgress", (string taskType, string? connectorName, st } }); -app.MapPost("/Tasks/Start", (string taskType, string? connectorName, string? publicationId) => +app.MapPost("/Tasks/Start", (string taskType, string? connectorName, string? internalId) => { try { TrangaTask.Task pTask = Enum.Parse(taskType); TrangaTask? task = taskManager - .GetTasksMatching(pTask, connectorName: connectorName, publicationId: publicationId)?.First(); + .GetTasksMatching(pTask, connectorName: connectorName, internalId: internalId)?.FirstOrDefault(); if (task is null) return; @@ -147,7 +147,7 @@ app.MapPost("/Queue/Enqueue", (string taskType, string? connectorName, string? p { TrangaTask.Task pTask = Enum.Parse(taskType); TrangaTask? task = taskManager - .GetTasksMatching(pTask, connectorName: connectorName, publicationId: publicationId)?.First(); + .GetTasksMatching(pTask, connectorName: connectorName, internalId: publicationId)?.First(); if (task is null) return; @@ -165,7 +165,7 @@ app.MapDelete("/Queue/Dequeue", (string taskType, string? connectorName, string? { TrangaTask.Task pTask = Enum.Parse(taskType); TrangaTask? task = taskManager - .GetTasksMatching(pTask, connectorName: connectorName, publicationId: publicationId)?.First(); + .GetTasksMatching(pTask, connectorName: connectorName, internalId: publicationId)?.First(); if (task is null) return; diff --git a/Tranga/TaskManager.cs b/Tranga/TaskManager.cs index b168a54..d890bad 100644 --- a/Tranga/TaskManager.cs +++ b/Tranga/TaskManager.cs @@ -229,7 +229,7 @@ public class TaskManager ExportDataAndSettings(); } - public IEnumerable GetTasksMatching(TrangaTask.Task taskType, string? connectorName = null, string? searchString = null, string? publicationId = null) + public IEnumerable GetTasksMatching(TrangaTask.Task taskType, string? connectorName = null, string? searchString = null, string? internalId = null) { switch (taskType) { @@ -246,11 +246,11 @@ public class TaskManager ((DownloadNewChaptersTask)mTask).connectorName == connectorName && ((DownloadNewChaptersTask)mTask).ToString().Contains(searchString, StringComparison.InvariantCultureIgnoreCase)); } - else if (publicationId is not null) + else if (internalId is not null) { return matchingdnc.Where(mTask => ((DownloadNewChaptersTask)mTask).connectorName == connectorName && - ((DownloadNewChaptersTask)mTask).publication.publicationId == publicationId); + ((DownloadNewChaptersTask)mTask).publication.internalId == internalId); } else return _allTasks.Where(tTask => @@ -268,11 +268,11 @@ public class TaskManager ((DownloadChapterTask)mTask).connectorName == connectorName && ((DownloadChapterTask)mTask).ToString().Contains(searchString, StringComparison.InvariantCultureIgnoreCase)); } - else if (publicationId is not null) + else if (internalId is not null) { return matchingdc.Where(mTask => ((DownloadChapterTask)mTask).connectorName == connectorName && - ((DownloadChapterTask)mTask).publication.publicationId == publicationId); + ((DownloadChapterTask)mTask).publication.publicationId == internalId); } else return _allTasks.Where(tTask =>