Compare commits
3 Commits
4bae223d95
...
7f88e57e47
Author | SHA1 | Date | |
---|---|---|---|
7f88e57e47 | |||
8865bf284f | |||
5fc2de5fcb |
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
using Logging;
|
using Logging;
|
||||||
using Tranga;
|
using Tranga;
|
||||||
|
|
||||||
string applicationFolderPath = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Tranga-API");
|
string applicationFolderPath =
|
||||||
|
Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Tranga-API");
|
||||||
string logsFolderPath = Path.Join(applicationFolderPath, "logs");
|
string logsFolderPath = Path.Join(applicationFolderPath, "logs");
|
||||||
string logFilePath = Path.Join(logsFolderPath, $"log-{DateTime.Now:dd-M-yyyy-HH-mm-ss}.txt");
|
string logFilePath = Path.Join(logsFolderPath, $"log-{DateTime.Now:dd-M-yyyy-HH-mm-ss}.txt");
|
||||||
string settingsFilePath = Path.Join(applicationFolderPath, "settings.json");
|
string settingsFilePath = Path.Join(applicationFolderPath, "settings.json");
|
||||||
@ -20,7 +20,7 @@ TrangaSettings settings;
|
|||||||
if (File.Exists(settingsFilePath))
|
if (File.Exists(settingsFilePath))
|
||||||
settings = TrangaSettings.LoadSettings(settingsFilePath);
|
settings = TrangaSettings.LoadSettings(settingsFilePath);
|
||||||
else
|
else
|
||||||
settings = new TrangaSettings(Directory.GetCurrentDirectory(), settingsFilePath, null);
|
settings = new TrangaSettings(Directory.GetCurrentDirectory(), applicationFolderPath, null);
|
||||||
|
|
||||||
TaskManager taskManager = new (settings, logger);
|
TaskManager taskManager = new (settings, logger);
|
||||||
|
|
||||||
@ -103,20 +103,8 @@ app.MapDelete("/Queue/Dequeue", (string taskType, string? connectorName, string?
|
|||||||
taskManager.RemoveTaskFromQueue(task);
|
taskManager.RemoveTaskFromQueue(task);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.MapGet("/Settings/Get", () => new Settings(taskManager.settings));
|
app.MapGet("/Settings/Get", () => taskManager.settings);
|
||||||
|
|
||||||
app.MapPost("/Settings/Update", (string? downloadLocation, string? komgaUrl, string? komgaAuth) => taskManager.UpdateSettings(downloadLocation, komgaUrl, komgaAuth) );
|
app.MapPost("/Settings/Update", (string? downloadLocation, string? komgaUrl, string? komgaAuth) => taskManager.UpdateSettings(downloadLocation, komgaUrl, komgaAuth) );
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|
||||||
class Settings
|
|
||||||
{
|
|
||||||
public string downloadLocation { get; }
|
|
||||||
public Komga? komga { get; }
|
|
||||||
|
|
||||||
public Settings(TrangaSettings settings)
|
|
||||||
{
|
|
||||||
this.downloadLocation = settings.downloadLocation;
|
|
||||||
this.komga = settings.komga;
|
|
||||||
}
|
|
||||||
}
|
|
@ -14,7 +14,7 @@ public static class Tranga_Cli
|
|||||||
{
|
{
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
string applicationFolderPath = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Tranga");
|
string applicationFolderPath = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Tranga");
|
||||||
string logsFolderPath = Path.Join(applicationFolderPath, "logs");
|
string logsFolderPath = Path.Join(applicationFolderPath, "logs");
|
||||||
string logFilePath = Path.Join(logsFolderPath, $"log-{DateTime.Now:dd-M-yyyy-HH-mm-ss}.txt");
|
string logFilePath = Path.Join(logsFolderPath, $"log-{DateTime.Now:dd-M-yyyy-HH-mm-ss}.txt");
|
||||||
string settingsFilePath = Path.Join(applicationFolderPath, "settings.json");
|
string settingsFilePath = Path.Join(applicationFolderPath, "settings.json");
|
||||||
|
@ -213,7 +213,10 @@ public class MangaDex : Connector
|
|||||||
DirectoryInfo dirInfo = new (publicationFolder);
|
DirectoryInfo dirInfo = new (publicationFolder);
|
||||||
foreach(FileInfo fileInfo in dirInfo.EnumerateFiles())
|
foreach(FileInfo fileInfo in dirInfo.EnumerateFiles())
|
||||||
if (fileInfo.Name.Contains("cover."))
|
if (fileInfo.Name.Contains("cover."))
|
||||||
|
{
|
||||||
|
logger?.WriteLine(this.GetType().ToString(), $"Cover exists {publication.sortName}");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//Request information where to download Cover
|
//Request information where to download Cover
|
||||||
DownloadClient.RequestResult requestResult =
|
DownloadClient.RequestResult requestResult =
|
||||||
|
Loading…
Reference in New Issue
Block a user