mirror of
https://github.com/C9Glax/tranga.git
synced 2025-06-14 15:27:53 +02:00
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
c685bd622f | |||
dc83cc2194 | |||
7784f2024e | |||
4895079887 | |||
ab1ddc6dc8 | |||
87eade10cf | |||
1f3ac41b30 | |||
6a304bb330 | |||
b0642d1251 | |||
63b5139e93 | |||
e938784388 | |||
c436389426 | |||
5099e25f3f |
@ -6,9 +6,9 @@ COPY . /src/
|
|||||||
RUN dotnet restore Tranga-API/Tranga-API.csproj
|
RUN dotnet restore Tranga-API/Tranga-API.csproj
|
||||||
RUN dotnet publish -c Release -o /publish
|
RUN dotnet publish -c Release -o /publish
|
||||||
|
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:7.0 as runtime
|
#FROM mcr.microsoft.com/dotnet/aspnet:7.0 as runtime
|
||||||
|
FROM glax/tranga-base:latest as runtime
|
||||||
WORKDIR /publish
|
WORKDIR /publish
|
||||||
COPY --from=build-env /publish .
|
COPY --from=build-env /publish .
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
RUN apt-get update && apt-get install -y libx11-6 libx11-xcb1 libatk1.0-0 libgtk-3-0 libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxrandr2 libgbm1 libpango-1.0-0 libcairo2 libasound2 libxshmfence1 libnss3
|
|
||||||
ENTRYPOINT ["dotnet", "/publish/Tranga-API.dll"]
|
ENTRYPOINT ["dotnet", "/publish/Tranga-API.dll"]
|
||||||
|
4
Dockerfile-base
Normal file
4
Dockerfile-base
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
|
FROM mcr.microsoft.com/dotnet/aspnet:7.0 as runtime
|
||||||
|
WORKDIR /publish
|
||||||
|
RUN apt-get update && apt-get install -y libx11-6 libx11-xcb1 libatk1.0-0 libgtk-3-0 libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxrandr2 libgbm1 libpango-1.0-0 libcairo2 libasound2 libxshmfence1 libnss3
|
@ -1,6 +1,7 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using Logging;
|
using Logging;
|
||||||
using Tranga;
|
using Tranga;
|
||||||
|
using Tranga.TrangaTasks;
|
||||||
|
|
||||||
string applicationFolderPath = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Tranga-API");
|
string applicationFolderPath = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Tranga-API");
|
||||||
string downloadFolderPath = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? "/Manga" : Path.Join(applicationFolderPath, "Manga");
|
string downloadFolderPath = RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? "/Manga" : Path.Join(applicationFolderPath, "Manga");
|
||||||
@ -54,11 +55,17 @@ app.UseSwaggerUI();
|
|||||||
|
|
||||||
app.UseCors(corsHeader);
|
app.UseCors(corsHeader);
|
||||||
|
|
||||||
app.MapGet("/Tranga/GetAvailableControllers", () => taskManager.GetAvailableConnectors().Keys.ToArray());
|
app.MapGet("/Controllers/Get", () => taskManager.GetAvailableConnectors().Keys.ToArray());
|
||||||
|
|
||||||
app.MapGet("/Tranga/GetKnownPublications", () => taskManager.GetAllPublications());
|
app.MapGet("/Publications/GetKnown", (string? internalId) =>
|
||||||
|
{
|
||||||
|
if(internalId is null)
|
||||||
|
return taskManager.GetAllPublications();
|
||||||
|
|
||||||
|
return new [] { taskManager.GetAllPublications().FirstOrDefault(pub => pub.internalId == internalId) };
|
||||||
|
});
|
||||||
|
|
||||||
app.MapGet("/Tranga/GetPublicationsFromConnector", (string connectorName, string title) =>
|
app.MapGet("/Publications/GetFromConnector", (string connectorName, string title) =>
|
||||||
{
|
{
|
||||||
Connector? connector = taskManager.GetAvailableConnectors().FirstOrDefault(con => con.Key == connectorName).Value;
|
Connector? connector = taskManager.GetAvailableConnectors().FirstOrDefault(con => con.Key == connectorName).Value;
|
||||||
if (connector is null)
|
if (connector is null)
|
||||||
@ -68,13 +75,65 @@ app.MapGet("/Tranga/GetPublicationsFromConnector", (string connectorName, string
|
|||||||
return taskManager.GetPublicationsFromConnector(connector, title);
|
return taskManager.GetPublicationsFromConnector(connector, title);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.MapGet("/Tasks/GetTaskTypes", () => Enum.GetNames(typeof(TrangaTask.Task)));
|
app.MapGet("/Publications/GetChapters", (string connectorName, string internalId, string? language) =>
|
||||||
|
|
||||||
|
|
||||||
app.MapPost("/Tasks/Create", (string taskType, string? connectorName, string? publicationId, string reoccurrenceTime, string? language) =>
|
|
||||||
{
|
{
|
||||||
TrangaTask.Task task = Enum.Parse<TrangaTask.Task>(taskType);
|
Connector? connector = taskManager.GetAvailableConnectors().FirstOrDefault(con => con.Key == connectorName).Value;
|
||||||
taskManager.AddTask(task, connectorName, publicationId, TimeSpan.Parse(reoccurrenceTime), language??"");
|
if (connector is null)
|
||||||
|
return Array.Empty<Chapter>();
|
||||||
|
Publication? publication = taskManager.GetAllPublications().FirstOrDefault(pub => pub.internalId == internalId);
|
||||||
|
if (publication is null)
|
||||||
|
return Array.Empty<Chapter>();
|
||||||
|
return connector.GetChapters((Publication)publication, language??"en");
|
||||||
|
});
|
||||||
|
|
||||||
|
app.MapGet("/Tasks/GetTypes", () => Enum.GetNames(typeof(TrangaTask.Task)));
|
||||||
|
|
||||||
|
|
||||||
|
app.MapPost("/Tasks/CreateMonitorTask",
|
||||||
|
(string connectorName, string internalId, string reoccurrenceTime, string? language) =>
|
||||||
|
{
|
||||||
|
Connector? connector =
|
||||||
|
taskManager.GetAvailableConnectors().FirstOrDefault(con => con.Key == connectorName).Value;
|
||||||
|
if (connector is null)
|
||||||
|
return;
|
||||||
|
Publication? publication = taskManager.GetAllPublications().FirstOrDefault(pub => pub.internalId == internalId);
|
||||||
|
if (publication is null)
|
||||||
|
return;
|
||||||
|
taskManager.AddTask(new DownloadNewChaptersTask(TrangaTask.Task.DownloadNewChapters, connectorName,
|
||||||
|
(Publication)publication,
|
||||||
|
TimeSpan.Parse(reoccurrenceTime), language ?? "en"));
|
||||||
|
});
|
||||||
|
|
||||||
|
app.MapPost("/Tasks/CreateUpdateLibraryTask", (string reoccurrenceTime) =>
|
||||||
|
{
|
||||||
|
taskManager.AddTask(new UpdateLibrariesTask(TrangaTask.Task.UpdateLibraries, TimeSpan.Parse(reoccurrenceTime)));
|
||||||
|
});
|
||||||
|
|
||||||
|
app.MapPost("/Tasks/CreateDownloadChaptersTask", (string connectorName, string internalId, string chapters, string? language) => {
|
||||||
|
|
||||||
|
Connector? connector =
|
||||||
|
taskManager.GetAvailableConnectors().FirstOrDefault(con => con.Key == connectorName).Value;
|
||||||
|
if (connector is null)
|
||||||
|
return;
|
||||||
|
Publication? publication = taskManager.GetAllPublications().FirstOrDefault(pub => pub.internalId == internalId);
|
||||||
|
if (publication is null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Chapter[] availableChapters = connector.GetChapters((Publication)publication, language??"en");;
|
||||||
|
|
||||||
|
if (chapters.Contains('-'))
|
||||||
|
{
|
||||||
|
int start = Convert.ToInt32(chapters.Split('-')[0]);
|
||||||
|
int end = Convert.ToInt32(chapters.Split('-')[1]) + 1;
|
||||||
|
foreach (Chapter chapter in availableChapters[start..end])
|
||||||
|
{
|
||||||
|
taskManager.AddTask(new DownloadChapterTask(TrangaTask.Task.DownloadChapter, connectorName,
|
||||||
|
(Publication)publication, chapter, "en"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
taskManager.AddTask(new DownloadChapterTask(TrangaTask.Task.DownloadChapter, connectorName,
|
||||||
|
(Publication)publication, availableChapters[Convert.ToInt32(chapters)], "en"));
|
||||||
});
|
});
|
||||||
|
|
||||||
app.MapDelete("/Tasks/Delete", (string taskType, string? connectorName, string? publicationId) =>
|
app.MapDelete("/Tasks/Delete", (string taskType, string? connectorName, string? publicationId) =>
|
||||||
@ -96,7 +155,7 @@ app.MapGet("/Tasks/Get", (string taskType, string? connectorName, string? search
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.MapGet("/Tasks/GetTaskProgress", (string taskType, string? connectorName, string? publicationId) =>
|
app.MapGet("/Tasks/GetProgress", (string taskType, string? connectorName, string? publicationId) =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -510,7 +510,7 @@ public static class Tranga_Cli
|
|||||||
if (selectedChapters.Contains('-'))
|
if (selectedChapters.Contains('-'))
|
||||||
{
|
{
|
||||||
int start = Convert.ToInt32(selectedChapters.Split('-')[0]);
|
int start = Convert.ToInt32(selectedChapters.Split('-')[0]);
|
||||||
int end = Convert.ToInt32(selectedChapters.Split('-')[1]);
|
int end = Convert.ToInt32(selectedChapters.Split('-')[1]) + 1;
|
||||||
return availableChapters[start..end];
|
return availableChapters[start..end];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -49,9 +49,8 @@ public abstract class LibraryManager
|
|||||||
Method = HttpMethod.Get,
|
Method = HttpMethod.Get,
|
||||||
RequestUri = new Uri(url)
|
RequestUri = new Uri(url)
|
||||||
};
|
};
|
||||||
logger?.WriteLine("LibraryManager", $"GET {url}");
|
|
||||||
HttpResponseMessage response = client.Send(requestMessage);
|
HttpResponseMessage response = client.Send(requestMessage);
|
||||||
logger?.WriteLine("LibraryManager", $"{(int)response.StatusCode} {response.StatusCode}: {response.ReasonPhrase}");
|
logger?.WriteLine("LibraryManager", $"GET {url} -> {(int)response.StatusCode}: {response.ReasonPhrase}");
|
||||||
|
|
||||||
if(response.StatusCode is HttpStatusCode.Unauthorized && response.RequestMessage!.RequestUri!.AbsoluteUri != url)
|
if(response.StatusCode is HttpStatusCode.Unauthorized && response.RequestMessage!.RequestUri!.AbsoluteUri != url)
|
||||||
return MakeRequest(response.RequestMessage!.RequestUri!.AbsoluteUri, authScheme, auth, logger);
|
return MakeRequest(response.RequestMessage!.RequestUri!.AbsoluteUri, authScheme, auth, logger);
|
||||||
@ -76,9 +75,8 @@ public abstract class LibraryManager
|
|||||||
Method = HttpMethod.Post,
|
Method = HttpMethod.Post,
|
||||||
RequestUri = new Uri(url)
|
RequestUri = new Uri(url)
|
||||||
};
|
};
|
||||||
logger?.WriteLine("LibraryManager", $"POST {url}");
|
|
||||||
HttpResponseMessage response = client.Send(requestMessage);
|
HttpResponseMessage response = client.Send(requestMessage);
|
||||||
logger?.WriteLine("LibraryManager", $"{(int)response.StatusCode} {response.StatusCode}: {response.ReasonPhrase}");
|
logger?.WriteLine("LibraryManager", $"POST {url} -> {(int)response.StatusCode}: {response.ReasonPhrase}");
|
||||||
|
|
||||||
if(response.StatusCode is HttpStatusCode.Unauthorized && response.RequestMessage!.RequestUri!.AbsoluteUri != url)
|
if(response.StatusCode is HttpStatusCode.Unauthorized && response.RequestMessage!.RequestUri!.AbsoluteUri != url)
|
||||||
return MakePost(response.RequestMessage!.RequestUri!.AbsoluteUri, authScheme, auth, logger);
|
return MakePost(response.RequestMessage!.RequestUri!.AbsoluteUri, authScheme, auth, logger);
|
||||||
|
@ -13,12 +13,14 @@ namespace Tranga;
|
|||||||
public class TaskManager
|
public class TaskManager
|
||||||
{
|
{
|
||||||
public Dictionary<Publication, List<Chapter>> chapterCollection = new();
|
public Dictionary<Publication, List<Chapter>> chapterCollection = new();
|
||||||
private HashSet<TrangaTask> _allTasks = new HashSet<TrangaTask>();
|
private HashSet<TrangaTask> _allTasks = new();
|
||||||
private bool _continueRunning = true;
|
private bool _continueRunning = true;
|
||||||
private readonly Connector[] _connectors;
|
private readonly Connector[] _connectors;
|
||||||
public TrangaSettings settings { get; }
|
public TrangaSettings settings { get; }
|
||||||
private Logger? logger { get; }
|
private Logger? logger { get; }
|
||||||
|
|
||||||
|
private readonly Dictionary<DownloadChapterTask, Task> _runningDownloadChapterTasks = new();
|
||||||
|
|
||||||
/// <param name="downloadFolderPath">Local path to save data (Manga) to</param>
|
/// <param name="downloadFolderPath">Local path to save data (Manga) to</param>
|
||||||
/// <param name="workingDirectory">Path to the working directory</param>
|
/// <param name="workingDirectory">Path to the working directory</param>
|
||||||
/// <param name="imageCachePath">Path to the cover-image cache</param>
|
/// <param name="imageCachePath">Path to the cover-image cache</param>
|
||||||
@ -117,6 +119,26 @@ public class TaskManager
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HashSet<DownloadChapterTask> toRemove = new();
|
||||||
|
foreach (KeyValuePair<DownloadChapterTask,Task> removeTask in _runningDownloadChapterTasks)
|
||||||
|
{
|
||||||
|
if (removeTask.Key.GetType() == typeof(DownloadChapterTask) &&
|
||||||
|
DateTime.Now.Subtract(removeTask.Key.lastChange) > TimeSpan.FromMinutes(3))//3 Minutes since last update to task -> remove
|
||||||
|
{
|
||||||
|
logger?.WriteLine(this.GetType().ToString(), $"Disposing failed task {removeTask.Key}.");
|
||||||
|
removeTask.Value.Dispose();;
|
||||||
|
toRemove.Add(removeTask.Key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (DownloadChapterTask taskToRemove in toRemove)
|
||||||
|
{
|
||||||
|
DeleteTask(taskToRemove);
|
||||||
|
AddTask(new DownloadChapterTask(taskToRemove.task, taskToRemove.connectorName,
|
||||||
|
taskToRemove.publication, taskToRemove.chapter, taskToRemove.language,
|
||||||
|
taskToRemove.parentTask));
|
||||||
|
}
|
||||||
|
|
||||||
if(allTasksWaitingLength != _allTasks.Count(task => task.state is TrangaTask.ExecutionState.Waiting))
|
if(allTasksWaitingLength != _allTasks.Count(task => task.state is TrangaTask.ExecutionState.Waiting))
|
||||||
ExportDataAndSettings();
|
ExportDataAndSettings();
|
||||||
allTasksWaitingLength = _allTasks.Count(task => task.state is TrangaTask.ExecutionState.Waiting);
|
allTasksWaitingLength = _allTasks.Count(task => task.state is TrangaTask.ExecutionState.Waiting);
|
||||||
@ -135,6 +157,8 @@ public class TaskManager
|
|||||||
{
|
{
|
||||||
task.Execute(this, this.logger);
|
task.Execute(this, this.logger);
|
||||||
});
|
});
|
||||||
|
if(task.GetType() == typeof(DownloadChapterTask))
|
||||||
|
_runningDownloadChapterTasks.Add((DownloadChapterTask)task, t);
|
||||||
t.Start();
|
t.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,9 +176,9 @@ public class TaskManager
|
|||||||
case TrangaTask.Task.DownloadNewChapters:
|
case TrangaTask.Task.DownloadNewChapters:
|
||||||
IEnumerable<TrangaTask> matchingdnc =
|
IEnumerable<TrangaTask> matchingdnc =
|
||||||
_allTasks.Where(mTask => mTask.GetType() == typeof(DownloadNewChaptersTask));
|
_allTasks.Where(mTask => mTask.GetType() == typeof(DownloadNewChaptersTask));
|
||||||
if (matchingdnc.All(mTask =>
|
if (!matchingdnc.Any(mTask =>
|
||||||
((DownloadNewChaptersTask)mTask).publication.internalId != ((DownloadNewChaptersTask)newTask).publication.publicationId &&
|
((DownloadNewChaptersTask)mTask).publication.internalId == ((DownloadNewChaptersTask)newTask).publication.internalId &&
|
||||||
((DownloadNewChaptersTask)mTask).connectorName != ((DownloadNewChaptersTask)newTask).connectorName))
|
((DownloadNewChaptersTask)mTask).connectorName == ((DownloadNewChaptersTask)newTask).connectorName))
|
||||||
_allTasks.Add(newTask);
|
_allTasks.Add(newTask);
|
||||||
else
|
else
|
||||||
logger?.WriteLine(this.GetType().ToString(), $"Task already exists {newTask}");
|
logger?.WriteLine(this.GetType().ToString(), $"Task already exists {newTask}");
|
||||||
@ -178,9 +202,11 @@ public class TaskManager
|
|||||||
{
|
{
|
||||||
logger?.WriteLine(this.GetType().ToString(), $"Removing Task {removeTask}");
|
logger?.WriteLine(this.GetType().ToString(), $"Removing Task {removeTask}");
|
||||||
_allTasks.Remove(removeTask);
|
_allTasks.Remove(removeTask);
|
||||||
|
if (removeTask.GetType() == typeof(DownloadChapterTask))
|
||||||
|
_runningDownloadChapterTasks.Remove((DownloadChapterTask)removeTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TrangaTask? AddTask(TrangaTask.Task taskType, string? connectorName, string? publicationId,
|
public TrangaTask? AddTask(TrangaTask.Task taskType, string? connectorName, string? internalId,
|
||||||
TimeSpan reoccurrenceTime, string? language = "en")
|
TimeSpan reoccurrenceTime, string? language = "en")
|
||||||
{
|
{
|
||||||
TrangaTask? newTask = null;
|
TrangaTask? newTask = null;
|
||||||
@ -190,10 +216,16 @@ public class TaskManager
|
|||||||
newTask = new UpdateLibrariesTask(taskType, reoccurrenceTime);
|
newTask = new UpdateLibrariesTask(taskType, reoccurrenceTime);
|
||||||
break;
|
break;
|
||||||
case TrangaTask.Task.DownloadNewChapters:
|
case TrangaTask.Task.DownloadNewChapters:
|
||||||
if(connectorName is null || publicationId is null || language is null)
|
if (connectorName is null)
|
||||||
logger?.WriteLine(this.GetType().ToString(), $"Values connectorName, publicationName and language can not be null.");
|
logger?.WriteLine(this.GetType().ToString(), $"Value connectorName can not be null.");
|
||||||
|
if(internalId is null)
|
||||||
|
logger?.WriteLine(this.GetType().ToString(), $"Value internalId can not be null.");
|
||||||
|
if(language is null)
|
||||||
|
logger?.WriteLine(this.GetType().ToString(), $"Value language can not be null.");
|
||||||
|
if (connectorName is null || internalId is null || language is null)
|
||||||
|
return null;
|
||||||
GetConnector(connectorName); //Check if connectorName is valid
|
GetConnector(connectorName); //Check if connectorName is valid
|
||||||
Publication publication = GetAllPublications().First(pub => pub.internalId == publicationId);
|
Publication publication = GetAllPublications().First(pub => pub.internalId == internalId);
|
||||||
newTask = new DownloadNewChaptersTask(taskType, connectorName!, publication, reoccurrenceTime, language!);
|
newTask = new DownloadNewChaptersTask(taskType, connectorName!, publication, reoccurrenceTime, language!);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ public abstract class TrangaTask
|
|||||||
[Newtonsoft.Json.JsonIgnore]public ExecutionState state { get; set; }
|
[Newtonsoft.Json.JsonIgnore]public ExecutionState state { get; set; }
|
||||||
[Newtonsoft.Json.JsonIgnore]public float progress { get; protected set; }
|
[Newtonsoft.Json.JsonIgnore]public float progress { get; protected set; }
|
||||||
[Newtonsoft.Json.JsonIgnore]public DateTime nextExecution => lastExecuted.Add(reoccurrence);
|
[Newtonsoft.Json.JsonIgnore]public DateTime nextExecution => lastExecuted.Add(reoccurrence);
|
||||||
[Newtonsoft.Json.JsonIgnore]public DateTime executionStarted { get; protected set; }
|
[Newtonsoft.Json.JsonIgnore]public DateTime executionStarted { get; private set; }
|
||||||
|
|
||||||
[Newtonsoft.Json.JsonIgnore]
|
[Newtonsoft.Json.JsonIgnore]
|
||||||
public DateTime executionApproximatelyFinished => this.progress != 0
|
public DateTime executionApproximatelyFinished => this.progress != 0
|
||||||
@ -32,6 +32,8 @@ public abstract class TrangaTask
|
|||||||
|
|
||||||
[Newtonsoft.Json.JsonIgnore]
|
[Newtonsoft.Json.JsonIgnore]
|
||||||
public TimeSpan executionApproximatelyRemaining => this.executionApproximatelyFinished.Subtract(DateTime.Now);
|
public TimeSpan executionApproximatelyRemaining => this.executionApproximatelyFinished.Subtract(DateTime.Now);
|
||||||
|
|
||||||
|
[Newtonsoft.Json.JsonIgnore]public DateTime lastChange { get; protected set; }
|
||||||
|
|
||||||
public enum ExecutionState
|
public enum ExecutionState
|
||||||
{
|
{
|
||||||
@ -47,11 +49,13 @@ public abstract class TrangaTask
|
|||||||
this.task = task;
|
this.task = task;
|
||||||
this.progress = 0f;
|
this.progress = 0f;
|
||||||
this.executionStarted = DateTime.Now;
|
this.executionStarted = DateTime.Now;
|
||||||
|
this.lastChange = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float IncrementProgress(float amount)
|
public float IncrementProgress(float amount)
|
||||||
{
|
{
|
||||||
this.progress += amount;
|
this.progress += amount;
|
||||||
|
this.lastChange = DateTime.Now;
|
||||||
return this.progress;
|
return this.progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ public class DownloadChapterTask : TrangaTask
|
|||||||
public Publication publication { get; }
|
public Publication publication { get; }
|
||||||
public string language { get; }
|
public string language { get; }
|
||||||
public Chapter chapter { get; }
|
public Chapter chapter { get; }
|
||||||
[JsonIgnore]private DownloadNewChaptersTask? parentTask { get; init; }
|
[JsonIgnore]public DownloadNewChaptersTask? parentTask { get; init; }
|
||||||
|
|
||||||
public DownloadChapterTask(Task task, string connectorName, Publication publication, Chapter chapter, string language = "en", DownloadNewChaptersTask? parentTask = null) : base(task, TimeSpan.Zero)
|
public DownloadChapterTask(Task task, string connectorName, Publication publication, Chapter chapter, string language = "en", DownloadNewChaptersTask? parentTask = null) : base(task, TimeSpan.Zero)
|
||||||
{
|
{
|
||||||
@ -22,15 +22,15 @@ public class DownloadChapterTask : TrangaTask
|
|||||||
|
|
||||||
protected override void ExecuteTask(TaskManager taskManager, Logger? logger)
|
protected override void ExecuteTask(TaskManager taskManager, Logger? logger)
|
||||||
{
|
{
|
||||||
Publication pub = (Publication)this.publication!;
|
|
||||||
Connector connector = taskManager.GetConnector(this.connectorName);
|
Connector connector = taskManager.GetConnector(this.connectorName);
|
||||||
connector.DownloadChapter(pub, this.chapter, this);
|
connector.DownloadChapter(this.publication, this.chapter, this);
|
||||||
taskManager.DeleteTask(this);
|
taskManager.DeleteTask(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public new float IncrementProgress(float amount)
|
public new float IncrementProgress(float amount)
|
||||||
{
|
{
|
||||||
this.progress += amount;
|
this.progress += amount;
|
||||||
|
this.lastChange = DateTime.Now;
|
||||||
parentTask?.IncrementProgress(amount);
|
parentTask?.IncrementProgress(amount);
|
||||||
return this.progress;
|
return this.progress;
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ public class DownloadNewChaptersTask : TrangaTask
|
|||||||
public new float IncrementProgress(float amount)
|
public new float IncrementProgress(float amount)
|
||||||
{
|
{
|
||||||
this.progress += amount / this.childTaskAmount;
|
this.progress += amount / this.childTaskAmount;
|
||||||
|
this.lastChange = DateTime.Now;
|
||||||
return this.progress;
|
return this.progress;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,25 +43,37 @@ function DeleteData(uri){
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function GetAvailableControllers(){
|
async function GetAvailableControllers(){
|
||||||
var uri = apiUri + "/Tranga/GetAvailableControllers";
|
var uri = apiUri + "/Controllers/Get";
|
||||||
let json = await GetData(uri);
|
let json = await GetData(uri);
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function GetPublication(connectorName, title){
|
async function GetPublicationFromConnector(connectorName, title){
|
||||||
var uri = apiUri + `/Tranga/GetPublicationsFromConnector?connectorName=${connectorName}&title=${title}`;
|
var uri = apiUri + `/Publications/GetFromConnector?connectorName=${connectorName}&title=${title}`;
|
||||||
let json = await GetData(uri);
|
let json = await GetData(uri);
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function GetKnownPublications(){
|
async function GetKnownPublications(){
|
||||||
var uri = apiUri + "/Tranga/GetKnownPublications";
|
var uri = apiUri + "/Publications/GetKnown";
|
||||||
|
let json = await GetData(uri);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function GetPublication(internalId){
|
||||||
|
var uri = apiUri + `/Publications/GetKnown?internalId=${internalId}`;
|
||||||
|
let json = await GetData(uri);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function GetChapters(internalId, connectorName, language){
|
||||||
|
var uri = apiUri + `/Publications/GetChapters?internalId=${internalId}&connectorName=${connectorName}&language=${language}`;
|
||||||
let json = await GetData(uri);
|
let json = await GetData(uri);
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function GetTaskTypes(){
|
async function GetTaskTypes(){
|
||||||
var uri = apiUri + "/Tasks/GetTaskTypes";
|
var uri = apiUri + "/Tasks/GetTypes";
|
||||||
let json = await GetData(uri);
|
let json = await GetData(uri);
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
@ -89,8 +101,18 @@ async function GetKomgaTask(){
|
|||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
function CreateTask(taskType, reoccurrence, connectorName, publicationId, language){
|
function CreateMonitorTask(connectorName, internalId, reoccurrence, language){
|
||||||
var uri = apiUri + `/Tasks/Create?taskType=${taskType}&connectorName=${connectorName}&publicationId=${publicationId}&reoccurrenceTime=${reoccurrence}&language=${language}`;
|
var uri = apiUri + `/Tasks/CreateMonitorTask?connectorName=${connectorName}&internalId=${internalId}&reoccurrenceTime=${reoccurrence}&language=${language}`;
|
||||||
|
PostData(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
function CreateUpdateLibraryTask(reoccurrence){
|
||||||
|
var uri = apiUri + `/Tasks/CreateUpdateLibraryTask?reoccurrenceTime=${reoccurrence}`;
|
||||||
|
PostData(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
function CreateDownloadChaptersTask(connectorName, internalId, chapters, language){
|
||||||
|
var uri = apiUri + `/Tasks/CreateDownloadChaptersTask?connectorName=${connectorName}&internalId=${internalId}&chapters=${chapters}&language=${language}`;
|
||||||
PostData(uri);
|
PostData(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,36 +25,64 @@
|
|||||||
<p>+</p>
|
<p>+</p>
|
||||||
</div>
|
</div>
|
||||||
<publication>
|
<publication>
|
||||||
<img src="media/cover.jpg">
|
<img alt="cover" src="media/cover.jpg">
|
||||||
<publication-information>
|
<publication-information>
|
||||||
<connector-name class="pill">MangaDex</connector-name>
|
<connector-name class="pill">MangaDex</connector-name>
|
||||||
<publication-name>Tensei Pandemic</publication-name>
|
<publication-name>Tensei Pandemic</publication-name>
|
||||||
</publication-information>
|
</publication-information>
|
||||||
</publication>
|
</publication>
|
||||||
</content>
|
</content>
|
||||||
|
|
||||||
<popup id="addTaskPopup">
|
<popup id="selectPublicationPopup">
|
||||||
<blur-background id="blurBackgroundTaskPopup"></blur-background>
|
<blur-background id="blurBackgroundTaskPopup"></blur-background>
|
||||||
<addtask-window>
|
<popup-window>
|
||||||
<window-titlebar>
|
<popup-title>Select Publication</popup-title>
|
||||||
<p>Add Task</p>
|
<popup-content>
|
||||||
<img id="closePopupImg" src="media/close-x.svg" alt="Close">
|
<div>
|
||||||
</window-titlebar>
|
<label for="connectors">Connector</label>
|
||||||
<window-content>
|
<select id="connectors">
|
||||||
<addtask-settings>
|
<option value=""></option>
|
||||||
<addtask-setting><label for="selectReccurrence">Recurrence</label><input id="selectReccurrence" type="time" value="01:00:00" step="3600"></addtask-setting>
|
</select>
|
||||||
<addtask-setting><label for="connectors">Connector</label>
|
</div>
|
||||||
<select id="connectors">
|
<div>
|
||||||
<option value=""></option>
|
<label for="searchPublicationQuery">Search Title</label><input id="searchPublicationQuery" type="text"></addtask-setting>
|
||||||
</select>
|
</div>
|
||||||
</addtask-setting>
|
<input type="submit" value="Search" style="font-weight: bolder" onclick="NewSearch();">
|
||||||
<addtask-setting><label for="searchPublicationQuery">Search Title</label><input id="searchPublicationQuery" type="text"></addtask-setting>
|
</popup-content>
|
||||||
<input type="submit" value="Search" onclick="NewSearch();">
|
<div id="taskSelectOutput"></div>
|
||||||
</addtask-settings>
|
</popup-window>
|
||||||
<div id="taskSelectOutput"></div>
|
|
||||||
</window-content>
|
|
||||||
</addtask-window>
|
|
||||||
</popup>
|
</popup>
|
||||||
|
|
||||||
|
<popup id="createMonitorTaskPopup">
|
||||||
|
<blur-background id="blurBackgroundCreateMonitorTaskPopup"></blur-background>
|
||||||
|
<popup-window>
|
||||||
|
<popup-title>Create Task: Monitor Publication</popup-title>
|
||||||
|
<popup-content>
|
||||||
|
<div>
|
||||||
|
<p>Every</p>
|
||||||
|
<label for="hours">Hours: </label><input id="hours" type="number" value="3" min="0" max="23">
|
||||||
|
<label for="minutes">Minutes: </label><input id="minutes" type="number" value="0" min="0" max="59">
|
||||||
|
<input type="submit" value="Create" onclick="AddMonitorTask()">
|
||||||
|
</div>
|
||||||
|
</popup-content>
|
||||||
|
</popup-window>
|
||||||
|
</popup>
|
||||||
|
|
||||||
|
<popup id="createDownloadChaptersTask">
|
||||||
|
<blur-background id="blurBackgroundCreateDownloadChaptersTask"></blur-background>
|
||||||
|
<popup-window>
|
||||||
|
<popup-title>Create Task: Download Chapter(s)</popup-title>
|
||||||
|
<popup-content>
|
||||||
|
<div>
|
||||||
|
<label for="selectedChapters">Chapters:</label><input id="selectedChapters" placeholder="Select"><input type="submit" value="Select" onclick="DownloadChapterTaskClick()">
|
||||||
|
</div>
|
||||||
|
<div id="chapterOutput">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</popup-content>
|
||||||
|
</popup-window>
|
||||||
|
</popup>
|
||||||
|
|
||||||
<popup id="publicationViewerPopup">
|
<popup id="publicationViewerPopup">
|
||||||
<blur-background id="blurBackgroundPublicationPopup"></blur-background>
|
<blur-background id="blurBackgroundPublicationPopup"></blur-background>
|
||||||
<publication-viewer>
|
<publication-viewer>
|
||||||
@ -71,42 +99,46 @@
|
|||||||
<publication-interactions>
|
<publication-interactions>
|
||||||
<publication-starttask>Start Task ▶️</publication-starttask>
|
<publication-starttask>Start Task ▶️</publication-starttask>
|
||||||
<publication-delete>Delete Task ❌</publication-delete>
|
<publication-delete>Delete Task ❌</publication-delete>
|
||||||
<publication-add>Add Task ➕</publication-add>
|
<publication-add id="createMonitorTaskButton">Monitor ➕</publication-add>
|
||||||
|
<publication-add id="createDownloadChapterTaskButton">Download Chapter ➕</publication-add>
|
||||||
</publication-interactions>
|
</publication-interactions>
|
||||||
</publication-information>
|
</publication-information>
|
||||||
</publication-viewer>
|
</publication-viewer>
|
||||||
</popup>
|
</popup>
|
||||||
|
|
||||||
<popup id="settingsPopup">
|
<popup id="settingsPopup">
|
||||||
<blur-background id="blurBackgroundSettingsPopup"></blur-background>
|
<blur-background id="blurBackgroundSettingsPopup"></blur-background>
|
||||||
<settings>
|
<popup-window>
|
||||||
<span style="font-weight: bold; text-align: center; font-size: 16pt;">Settings</span>
|
<popup-title>Settings</popup-title>
|
||||||
<div>
|
<popup-content>
|
||||||
<p class="title">Download Location:</p>
|
<div>
|
||||||
<span id="downloadLocation"></span>
|
<p class="title">Download Location:</p>
|
||||||
</div>
|
<span id="downloadLocation"></span>
|
||||||
<div>
|
</div>
|
||||||
<p class="title">API-URI</p>
|
<div>
|
||||||
<label for="settingApiUri"></label><input placeholder="https://" type="text" id="settingApiUri">
|
<p class="title">API-URI</p>
|
||||||
</div>
|
<label for="settingApiUri"></label><input placeholder="https://" type="text" id="settingApiUri">
|
||||||
<komga-settings>
|
</div>
|
||||||
<span class="title">Komga</span>
|
<div>
|
||||||
<div>Configured: <span id="komgaConfigured">✅❌</span></div>
|
<span class="title">Komga</span>
|
||||||
<label for="komgaUrl"></label><input placeholder="URL" id="komgaUrl" type="text">
|
<div>Configured: <span id="komgaConfigured">✅❌</span></div>
|
||||||
<label for="komgaUsername"></label><input placeholder="Username" id="komgaUsername" type="text">
|
<label for="komgaUrl"></label><input placeholder="URL" id="komgaUrl" type="text">
|
||||||
<label for="komgaPassword"></label><input placeholder="Password" id="komgaPassword" type="password">
|
<label for="komgaUsername"></label><input placeholder="Username" id="komgaUsername" type="text">
|
||||||
</komga-settings>
|
<label for="komgaPassword"></label><input placeholder="Password" id="komgaPassword" type="password">
|
||||||
<kavita-settings>
|
</div>
|
||||||
<span class="title">Kavita</span>
|
<div>
|
||||||
<div>Configured: <span id="kavitaConfigured">✅❌</span></div>
|
<span class="title">Kavita</span>
|
||||||
<label for="kavitaUrl"></label><input placeholder="URL" id="kavitaUrl" type="text">
|
<div>Configured: <span id="kavitaConfigured">✅❌</span></div>
|
||||||
<label for="kavitaUsername"></label><input placeholder="Username" id="kavitaUsername" type="text">
|
<label for="kavitaUrl"></label><input placeholder="URL" id="kavitaUrl" type="text">
|
||||||
<label for="kavitaPassword"></label><input placeholder="Password" id="kavitaPassword" type="password">
|
<label for="kavitaUsername"></label><input placeholder="Username" id="kavitaUsername" type="text">
|
||||||
</kavita-settings>
|
<label for="kavitaPassword"></label><input placeholder="Password" id="kavitaPassword" type="password">
|
||||||
<div>
|
</div>
|
||||||
<label for="libraryUpdateTime" style="margin-right: 5px;">Update Time</label><input id="libraryUpdateTime" type="time" value="00:01:00" step="10">
|
<div>
|
||||||
<input type="submit" value="Update" onclick="UpdateLibrarySettings()">
|
<label for="libraryUpdateTime" style="margin-right: 5px;">Update Time</label><input id="libraryUpdateTime" type="time" value="00:01:00" step="10">
|
||||||
</div>
|
<input type="submit" value="Update" onclick="UpdateLibrarySettings()">
|
||||||
</settings>
|
</div>
|
||||||
|
</popup-content>
|
||||||
|
</popup-window>
|
||||||
</popup>
|
</popup>
|
||||||
</viewport>
|
</viewport>
|
||||||
<footer>
|
<footer>
|
||||||
|
@ -10,7 +10,13 @@ const settingsPopup = document.querySelector("#settingsPopup");
|
|||||||
const settingsCog = document.querySelector("#settingscog");
|
const settingsCog = document.querySelector("#settingscog");
|
||||||
const selectRecurrence = document.querySelector("#selectReccurrence");
|
const selectRecurrence = document.querySelector("#selectReccurrence");
|
||||||
const tasksContent = document.querySelector("content");
|
const tasksContent = document.querySelector("content");
|
||||||
const addTaskPopup = document.querySelector("#addTaskPopup");
|
const selectPublicationPopup = document.querySelector("#selectPublicationPopup");
|
||||||
|
const createMonitorTaskButton = document.querySelector("#createMonitorTaskButton");
|
||||||
|
const createDownloadChapterTaskButton = document.querySelector("#createDownloadChapterTaskButton");
|
||||||
|
const createMonitorTaskPopup = document.querySelector("#createMonitorTaskPopup");
|
||||||
|
const createDownloadChaptersTask = document.querySelector("#createDownloadChaptersTask");
|
||||||
|
const chapterOutput = document.querySelector("#chapterOutput");
|
||||||
|
const selectedChapters = document.querySelector("#selectedChapters");
|
||||||
const publicationViewerPopup = document.querySelector("#publicationViewerPopup");
|
const publicationViewerPopup = document.querySelector("#publicationViewerPopup");
|
||||||
const publicationViewerWindow = document.querySelector("publication-viewer");
|
const publicationViewerWindow = document.querySelector("publication-viewer");
|
||||||
const publicationViewerDescription = document.querySelector("#publicationViewerDescription");
|
const publicationViewerDescription = document.querySelector("#publicationViewerDescription");
|
||||||
@ -19,9 +25,7 @@ const publicationViewerTags = document.querySelector("#publicationViewerTags");
|
|||||||
const publicationViewerAuthor = document.querySelector("#publicationViewerAuthor");
|
const publicationViewerAuthor = document.querySelector("#publicationViewerAuthor");
|
||||||
const pubviewcover = document.querySelector("#pubviewcover");
|
const pubviewcover = document.querySelector("#pubviewcover");
|
||||||
const publicationDelete = document.querySelector("publication-delete");
|
const publicationDelete = document.querySelector("publication-delete");
|
||||||
const publicationAdd = document.querySelector("publication-add");
|
|
||||||
const publicationTaskStart = document.querySelector("publication-starttask");
|
const publicationTaskStart = document.querySelector("publication-starttask");
|
||||||
const closetaskpopup = document.querySelector("#closePopupImg");
|
|
||||||
const settingDownloadLocation = document.querySelector("#downloadLocation");
|
const settingDownloadLocation = document.querySelector("#downloadLocation");
|
||||||
const settingKomgaUrl = document.querySelector("#komgaUrl");
|
const settingKomgaUrl = document.querySelector("#komgaUrl");
|
||||||
const settingKomgaUser = document.querySelector("#komgaUsername");
|
const settingKomgaUser = document.querySelector("#komgaUsername");
|
||||||
@ -41,12 +45,25 @@ const tagTasksPopupContent = document.querySelector("footer-tag-content");
|
|||||||
|
|
||||||
searchbox.addEventListener("keyup", (event) => FilterResults());
|
searchbox.addEventListener("keyup", (event) => FilterResults());
|
||||||
settingsCog.addEventListener("click", () => OpenSettings());
|
settingsCog.addEventListener("click", () => OpenSettings());
|
||||||
document.querySelector("#blurBackgroundSettingsPopup").addEventListener("click", () => HideSettings());
|
document.querySelector("#blurBackgroundSettingsPopup").addEventListener("click", () => settingsPopup.style.display = "none");
|
||||||
closetaskpopup.addEventListener("click", () => HideAddTaskPopup());
|
document.querySelector("#blurBackgroundTaskPopup").addEventListener("click", () => selectPublicationPopup.style.display = "none");
|
||||||
document.querySelector("#blurBackgroundTaskPopup").addEventListener("click", () => HideAddTaskPopup());
|
|
||||||
document.querySelector("#blurBackgroundPublicationPopup").addEventListener("click", () => HidePublicationPopup());
|
document.querySelector("#blurBackgroundPublicationPopup").addEventListener("click", () => HidePublicationPopup());
|
||||||
|
document.querySelector("#blurBackgroundCreateMonitorTaskPopup").addEventListener("click", () => createMonitorTaskPopup.style.display = "none");
|
||||||
|
document.querySelector("#blurBackgroundCreateDownloadChaptersTask").addEventListener("click", () => createDownloadChaptersTask.style.display = "none");
|
||||||
|
selectedChapters.addEventListener("keypress", (event) => {
|
||||||
|
if(event.key === "Enter"){
|
||||||
|
DownloadChapterTaskClick();
|
||||||
|
}
|
||||||
|
})
|
||||||
publicationDelete.addEventListener("click", () => DeleteTaskClick());
|
publicationDelete.addEventListener("click", () => DeleteTaskClick());
|
||||||
publicationAdd.addEventListener("click", () => AddTaskClick());
|
createMonitorTaskButton.addEventListener("click", () => {
|
||||||
|
HidePublicationPopup();
|
||||||
|
createMonitorTaskPopup.style.display = "block";
|
||||||
|
});
|
||||||
|
createDownloadChapterTaskButton.addEventListener("click", () => {
|
||||||
|
HidePublicationPopup();
|
||||||
|
OpenDownloadChapterTaskPopup();
|
||||||
|
})
|
||||||
publicationTaskStart.addEventListener("click", () => StartTaskClick());
|
publicationTaskStart.addEventListener("click", () => StartTaskClick());
|
||||||
settingApiUri.addEventListener("keypress", (event) => {
|
settingApiUri.addEventListener("keypress", (event) => {
|
||||||
if(event.key === "Enter"){
|
if(event.key === "Enter"){
|
||||||
@ -82,18 +99,14 @@ GetAvailableControllers()
|
|||||||
|
|
||||||
function NewSearch(){
|
function NewSearch(){
|
||||||
//Disable inputs
|
//Disable inputs
|
||||||
selectRecurrence.disabled = true;
|
|
||||||
connectorSelect.disabled = true;
|
connectorSelect.disabled = true;
|
||||||
searchPublicationQuery.disabled = true;
|
searchPublicationQuery.disabled = true;
|
||||||
//Waitcursor
|
//Waitcursor
|
||||||
document.body.style.cursor = "wait";
|
document.body.style.cursor = "wait";
|
||||||
selectRecurrence.style.cursor = "wait";
|
|
||||||
connectorSelect.style.cursor = "wait";
|
|
||||||
searchPublicationQuery.style.cursor = "wait";
|
|
||||||
|
|
||||||
//Empty previous results
|
//Empty previous results
|
||||||
selectPublication.replaceChildren();
|
selectPublication.replaceChildren();
|
||||||
GetPublication(connectorSelect.value, searchPublicationQuery.value)
|
GetPublicationFromConnector(connectorSelect.value, searchPublicationQuery.value)
|
||||||
.then(json =>
|
.then(json =>
|
||||||
json.forEach(publication => {
|
json.forEach(publication => {
|
||||||
var option = CreatePublication(publication, connectorSelect.value);
|
var option = CreatePublication(publication, connectorSelect.value);
|
||||||
@ -105,14 +118,10 @@ function NewSearch(){
|
|||||||
))
|
))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
//Re-enable inputs
|
//Re-enable inputs
|
||||||
selectRecurrence.disabled = false;
|
|
||||||
connectorSelect.disabled = false;
|
connectorSelect.disabled = false;
|
||||||
searchPublicationQuery.disabled = false;
|
searchPublicationQuery.disabled = false;
|
||||||
//Cursor
|
//Cursor
|
||||||
document.body.style.cursor = "initial";
|
document.body.style.cursor = "initial";
|
||||||
selectRecurrence.style.cursor = "initial";
|
|
||||||
connectorSelect.style.cursor = "initial";
|
|
||||||
searchPublicationQuery.style.cursor = "initial";
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,18 +146,57 @@ function CreatePublication(publication, connector){
|
|||||||
return publicationElement;
|
return publicationElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function AddMonitorTask(){
|
||||||
|
var hours = document.querySelector("#hours").value;
|
||||||
|
var minutes = document.querySelector("#minutes").value;
|
||||||
|
CreateMonitorTask(connectorSelect.value, toEditId, `${hours}:${minutes}:00`, "en");
|
||||||
|
HidePublicationPopup();
|
||||||
|
createMonitorTaskPopup.style.display = "none";
|
||||||
|
selectPublicationPopup.style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
function OpenDownloadChapterTaskPopup(){
|
||||||
|
createDownloadChaptersTask.style.display = "block";
|
||||||
|
GetChapters(toEditId, connectorSelect.value, "en").then((json) => {
|
||||||
|
var i = 0;
|
||||||
|
json.forEach(chapter => {
|
||||||
|
var chapterDom = document.createElement("div");
|
||||||
|
var indexDom = document.createElement("span");
|
||||||
|
indexDom.className = "index";
|
||||||
|
indexDom.innerText = i++;
|
||||||
|
chapterDom.appendChild(indexDom);
|
||||||
|
|
||||||
|
var volDom = document.createElement("span");
|
||||||
|
volDom.className = "vol";
|
||||||
|
volDom.innerText = chapter.volumeNumber;
|
||||||
|
chapterDom.appendChild(volDom);
|
||||||
|
|
||||||
|
var chDom = document.createElement("span");
|
||||||
|
chDom.className = "ch";
|
||||||
|
chDom.innerText = chapter.chapterNumber;
|
||||||
|
chapterDom.appendChild(chDom);
|
||||||
|
|
||||||
|
var titleDom = document.createElement("span");
|
||||||
|
titleDom.innerText = chapter.name;
|
||||||
|
chapterDom.appendChild(titleDom);
|
||||||
|
chapterOutput.appendChild(chapterDom);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function DownloadChapterTaskClick(){
|
||||||
|
CreateDownloadChaptersTask(connectorSelect.value, toEditId, selectedChapters.value, "en");
|
||||||
|
HidePublicationPopup();
|
||||||
|
createDownloadChaptersTask.style.display = "none";
|
||||||
|
selectPublicationPopup.style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
function DeleteTaskClick(){
|
function DeleteTaskClick(){
|
||||||
taskToDelete = tasks.filter(tTask => tTask.publication.internalId === toEditId)[0];
|
taskToDelete = tasks.filter(tTask => tTask.publication.internalId === toEditId)[0];
|
||||||
DeleteTask("DownloadNewChapters", taskToDelete.connectorName, toEditId);
|
DeleteTask("DownloadNewChapters", taskToDelete.connectorName, toEditId);
|
||||||
HidePublicationPopup();
|
HidePublicationPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
function AddTaskClick(){
|
|
||||||
CreateTask("DownloadNewChapters", selectRecurrence.value, connectorSelect.value, toEditId, "en")
|
|
||||||
HideAddTaskPopup();
|
|
||||||
HidePublicationPopup();
|
|
||||||
}
|
|
||||||
|
|
||||||
function StartTaskClick(){
|
function StartTaskClick(){
|
||||||
var toEditTask = tasks.filter(task => task.publication.internalId == toEditId)[0];
|
var toEditTask = tasks.filter(task => task.publication.internalId == toEditId)[0];
|
||||||
StartTask("DownloadNewChapters", toEditTask.connectorName, toEditId);
|
StartTask("DownloadNewChapters", toEditTask.connectorName, toEditId);
|
||||||
@ -194,12 +242,14 @@ function ShowPublicationViewerWindow(publicationId, event, add){
|
|||||||
|
|
||||||
//Check what action should be listed
|
//Check what action should be listed
|
||||||
if(add){
|
if(add){
|
||||||
publicationAdd.style.display = "initial";
|
createMonitorTaskButton.style.display = "initial";
|
||||||
|
createDownloadChapterTaskButton.style.display = "initial";
|
||||||
publicationDelete.style.display = "none";
|
publicationDelete.style.display = "none";
|
||||||
publicationTaskStart.style.display = "none";
|
publicationTaskStart.style.display = "none";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
publicationAdd.style.display = "none";
|
createMonitorTaskButton.style.display = "none";
|
||||||
|
createDownloadChapterTaskButton.style.display = "none";
|
||||||
publicationDelete.style.display = "initial";
|
publicationDelete.style.display = "initial";
|
||||||
publicationTaskStart.style.display = "initial";
|
publicationTaskStart.style.display = "initial";
|
||||||
}
|
}
|
||||||
@ -211,10 +261,7 @@ function HidePublicationPopup(){
|
|||||||
|
|
||||||
function ShowNewTaskWindow(){
|
function ShowNewTaskWindow(){
|
||||||
selectPublication.replaceChildren();
|
selectPublication.replaceChildren();
|
||||||
addTaskPopup.style.display = "block";
|
selectPublicationPopup.style.display = "flex";
|
||||||
}
|
|
||||||
function HideAddTaskPopup(){
|
|
||||||
addTaskPopup.style.display = "none";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -234,9 +281,6 @@ function OpenSettings(){
|
|||||||
settingsPopup.style.display = "flex";
|
settingsPopup.style.display = "flex";
|
||||||
}
|
}
|
||||||
|
|
||||||
function HideSettings(){
|
|
||||||
settingsPopup.style.display = "none";
|
|
||||||
}
|
|
||||||
|
|
||||||
function GetSettingsClick(){
|
function GetSettingsClick(){
|
||||||
settingApiUri.value = "";
|
settingApiUri.value = "";
|
||||||
@ -288,7 +332,7 @@ function UpdateLibrarySettings(){
|
|||||||
if(settingKavitaUrl.value != "" && settingKavitaUser.value != "" && settingKavitaPass.value != ""){
|
if(settingKavitaUrl.value != "" && settingKavitaUser.value != "" && settingKavitaPass.value != ""){
|
||||||
UpdateSettings("", "", "", settingKavitaUrl.value, settingKavitaUser.value, settingKavitaPass.value);
|
UpdateSettings("", "", "", settingKavitaUrl.value, settingKavitaUser.value, settingKavitaPass.value);
|
||||||
}
|
}
|
||||||
CreateTask("UpdateLibraries", libraryUpdateTime.value, "","","");
|
CreateUpdateLibraryTask(libraryUpdateTime.value);
|
||||||
setTimeout(() => GetSettingsClick(), 200);
|
setTimeout(() => GetSettingsClick(), 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,46 +147,22 @@ content {
|
|||||||
align-content: start;
|
align-content: start;
|
||||||
}
|
}
|
||||||
|
|
||||||
settings {
|
|
||||||
width: 50%;
|
|
||||||
background-color: var(--accent-color);
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
z-index: 10;
|
|
||||||
position: absolute;
|
|
||||||
left: 25%;
|
|
||||||
top: 100px;
|
|
||||||
border-radius: 5px;
|
|
||||||
padding: 10px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#settingsPopup{
|
#settingsPopup{
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
settings > * {
|
#settingsPopup popup-content{
|
||||||
margin: 0 20%;
|
|
||||||
}
|
|
||||||
|
|
||||||
settings input {
|
|
||||||
margin: 3px 0;
|
|
||||||
padding: 3px;
|
|
||||||
border-radius: 3px;
|
|
||||||
border: 1px solid rgba(0,0,0,0.2);
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
settings .title {
|
|
||||||
font-weight: bolder;
|
|
||||||
font-size: 14pt;
|
|
||||||
margin: 15px 0 2px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
komga-settings {
|
|
||||||
margin-top: 20px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
flex-wrap: nowrap;
|
align-items: start;
|
||||||
|
margin: 15px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#settingsPopup popup-content > * {
|
||||||
|
margin: 5px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#settingsPopup popup-content .title {
|
||||||
|
font-weight: bolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
#addPublication {
|
#addPublication {
|
||||||
@ -281,6 +257,112 @@ popup{
|
|||||||
left: 0;
|
left: 0;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
popup popup-window {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 3;
|
||||||
|
left: 25%;
|
||||||
|
top: 100px;
|
||||||
|
width: 50%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background-color: var(--second-background-color);
|
||||||
|
border-radius: 3px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
popup popup-window popup-title {
|
||||||
|
height: 30px;
|
||||||
|
font-size: 14pt;
|
||||||
|
font-weight: bolder;
|
||||||
|
padding: 5px 10px;
|
||||||
|
margin: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
background-color: var(--primary-color);
|
||||||
|
color: var(--accent-color)
|
||||||
|
}
|
||||||
|
|
||||||
|
popup popup-window popup-content{
|
||||||
|
margin: 15px 10px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-evenly;
|
||||||
|
}
|
||||||
|
|
||||||
|
popup popup-window popup-content div > * {
|
||||||
|
margin: 2px 3px 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
popup popup-window popup-content input, select {
|
||||||
|
padding: 3px 4px;
|
||||||
|
width: 130px;
|
||||||
|
border: 1px solid lightgrey;
|
||||||
|
background-color: var(--accent-color);
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#selectPublicationPopup publication {
|
||||||
|
width: 150px;
|
||||||
|
height: 250px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#createTaskPopup {
|
||||||
|
z-index: 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
#createTaskPopup input {
|
||||||
|
height: 30px;
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#createMonitorTaskPopup, #createDownloadChaptersTask {
|
||||||
|
z-index: 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
#createDownloadChaptersTask popup-content {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: start;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#createDownloadChaptersTask popup-content > * {
|
||||||
|
margin: 3px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#createDownloadChaptersTask #chapterOutput {
|
||||||
|
max-height: 50vh;
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
#createDownloadChaptersTask #chapterOutput .index{
|
||||||
|
display: inline-block;
|
||||||
|
width: 25px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#createDownloadChaptersTask #chapterOutput .index::after{
|
||||||
|
content: ':';
|
||||||
|
}
|
||||||
|
|
||||||
|
#createDownloadChaptersTask #chapterOutput .vol::before{
|
||||||
|
content: 'Vol.';
|
||||||
|
}
|
||||||
|
|
||||||
|
#createDownloadChaptersTask #chapterOutput .vol{
|
||||||
|
display: inline-block;
|
||||||
|
width: 45px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#createDownloadChaptersTask #chapterOutput .ch::before{
|
||||||
|
content: 'Ch.';
|
||||||
|
}
|
||||||
|
|
||||||
|
#createDownloadChaptersTask #chapterOutput .ch {
|
||||||
|
display: inline-block;
|
||||||
|
width: 60px;
|
||||||
}
|
}
|
||||||
|
|
||||||
blur-background {
|
blur-background {
|
||||||
@ -292,79 +374,6 @@ blur-background {
|
|||||||
opacity: 0.5;
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
addtask-window {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
flex-wrap: nowrap;
|
|
||||||
position: absolute;
|
|
||||||
left: 12.5%;
|
|
||||||
top: 15%;
|
|
||||||
width: 75%;
|
|
||||||
min-height: 70%;
|
|
||||||
max-height: 80%;
|
|
||||||
padding: 0;
|
|
||||||
background-color: var(--accent-color);
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
window-titlebar {
|
|
||||||
width: 100%;
|
|
||||||
height: 60px;
|
|
||||||
background-color: var(--primary-color);
|
|
||||||
border-radius: 5px 5px 0 0;
|
|
||||||
color: var(--accent-color);
|
|
||||||
display: flex block;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
window-titlebar p {
|
|
||||||
margin: 0 30px;
|
|
||||||
font-size: 14pt;
|
|
||||||
font-weight: bolder;
|
|
||||||
letter-spacing: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
window-titlebar #closePopupImg {
|
|
||||||
height: 70%;
|
|
||||||
cursor: pointer;
|
|
||||||
margin-right: 20px;
|
|
||||||
filter: invert(100%) sepia(0%) saturate(100%) hue-rotate(115deg) brightness(116%) contrast(101%);
|
|
||||||
}
|
|
||||||
|
|
||||||
window-content {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
padding: 20px 5%;
|
|
||||||
overflow-x: scroll;
|
|
||||||
}
|
|
||||||
|
|
||||||
addtask-settings{
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
addtask-settings select, addtask-settings input{
|
|
||||||
padding: 5px;
|
|
||||||
font-size: 10pt;
|
|
||||||
border: 1px solid rgba(0,0,0,0.2);
|
|
||||||
border-radius: 3px;
|
|
||||||
background-color: transparent;
|
|
||||||
margin: 10px 0;
|
|
||||||
width: 150px;
|
|
||||||
}
|
|
||||||
|
|
||||||
addtask-settings label {
|
|
||||||
font-weight: bolder;
|
|
||||||
margin: 0 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
addtask-settings addtask-setting{
|
|
||||||
margin: 0 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#taskSelectOutput{
|
#taskSelectOutput{
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
@ -512,7 +521,7 @@ footer-tag-popup::before{
|
|||||||
border-left: 10px solid transparent;
|
border-left: 10px solid transparent;
|
||||||
border-top: 10px solid var(--second-background-color);
|
border-top: 10px solid var(--second-background-color);
|
||||||
border-bottom: 10px solid transparent;
|
border-bottom: 10px solid transparent;
|
||||||
left: 0px;
|
left: 0;
|
||||||
bottom: -17px;
|
bottom: -17px;
|
||||||
border-radius: 0 0 0 5px;
|
border-radius: 0 0 0 5px;
|
||||||
}
|
}
|
Reference in New Issue
Block a user