Use GetConnector Method.
This commit is contained in:
parent
fa44de0c8d
commit
58de0115d6
@ -10,9 +10,7 @@ app.MapGet("/GetConnectors", () => JsonSerializer.Serialize(taskManager.GetAvail
|
||||
|
||||
app.MapGet("/GetPublications", (string connectorName, string? title) =>
|
||||
{
|
||||
Connector? connector = taskManager.GetAvailableConnectors().FirstOrDefault(c => c.Key == connectorName).Value;
|
||||
if (connector is null)
|
||||
return JsonSerializer.Serialize($"Connector {connectorName} is not a known connector.");
|
||||
Connector connector = taskManager.GetConnector(connectorName);
|
||||
|
||||
Publication[] publications;
|
||||
if (title is not null)
|
||||
|
@ -279,7 +279,7 @@ public static class Tranga_Cli
|
||||
|
||||
private static void DownloadNow(TaskManager.SettingsData settings)
|
||||
{
|
||||
Connector connector = SelectConnector(settings.downloadLocation);
|
||||
Connector connector = SelectConnector(settings.downloadLocation, new Connector[]{new MangaDex(settings.downloadLocation)});
|
||||
|
||||
Publication publication = SelectPublication(connector);
|
||||
|
||||
@ -298,10 +298,9 @@ public static class Tranga_Cli
|
||||
}
|
||||
}
|
||||
|
||||
private static Connector SelectConnector(string folderPath, Connector[]? availableConnectors = null)
|
||||
private static Connector SelectConnector(string folderPath, Connector[] connectors)
|
||||
{
|
||||
Console.Clear();
|
||||
Connector[] connectors = availableConnectors ?? new Connector[] { new MangaDex(folderPath) };
|
||||
|
||||
int cIndex = 0;
|
||||
Console.WriteLine("Connectors:");
|
||||
|
@ -18,11 +18,7 @@ public static class TaskExecutor
|
||||
{
|
||||
Connector? connector = null;
|
||||
if (trangaTask.task != TrangaTask.Task.UpdateKomgaLibrary)
|
||||
{
|
||||
//Get Connector from list of available Connectors and the required Connector of the TrangaTask
|
||||
if (!taskManager.GetAvailableConnectors().TryGetValue(trangaTask.connectorName, out connector))
|
||||
throw new ArgumentException($"Connector {trangaTask.connectorName} is not a known connector.");
|
||||
}
|
||||
connector = taskManager.GetConnector(trangaTask.connectorName!);
|
||||
|
||||
if (trangaTask.isBeingExecuted)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user