Compare commits
5 Commits
181942153b
...
61024bcee9
Author | SHA1 | Date | |
---|---|---|---|
61024bcee9 | |||
ea1b8749a6 | |||
2fcab1f1b1 | |||
bbd716383a | |||
6e1a0ab06c |
@ -2,7 +2,9 @@
|
|||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=altnames/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=altnames/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=authorsartists/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=authorsartists/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Gotify/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Gotify/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=jjob/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Komga/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Komga/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=lunasea/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=mangakatana/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=mangakatana/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Manganato/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Manganato/@EntryIndexedValue">True</s:Boolean>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Mangasee/@EntryIndexedValue">True</s:Boolean>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=Mangasee/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
@ -36,6 +36,10 @@ public readonly struct Chapter
|
|||||||
this.fileName = $"{volStr}{chNumberStr}{chNameStr}";
|
this.fileName = $"{volStr}{chNumberStr}{chNameStr}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"Chapter {parentPublication.sortName} {parentPublication.internalId} {chapterNumber} {name}";
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if a chapter-archive is already present
|
/// Checks if a chapter-archive is already present
|
||||||
|
@ -49,6 +49,7 @@ public abstract class GlobalBase
|
|||||||
|
|
||||||
protected void AddNotificationConnector(NotificationConnector notificationConnector)
|
protected void AddNotificationConnector(NotificationConnector notificationConnector)
|
||||||
{
|
{
|
||||||
|
Log($"Adding {notificationConnector}");
|
||||||
notificationConnectors.RemoveWhere(nc => nc.GetType() == notificationConnector.GetType());
|
notificationConnectors.RemoveWhere(nc => nc.GetType() == notificationConnector.GetType());
|
||||||
notificationConnectors.Add(notificationConnector);
|
notificationConnectors.Add(notificationConnector);
|
||||||
|
|
||||||
@ -59,6 +60,7 @@ public abstract class GlobalBase
|
|||||||
|
|
||||||
protected void DeleteNotificationConnector(NotificationConnector.NotificationManagerType notificationManagerType)
|
protected void DeleteNotificationConnector(NotificationConnector.NotificationManagerType notificationManagerType)
|
||||||
{
|
{
|
||||||
|
Log($"Removing {notificationManagerType}");
|
||||||
notificationConnectors.RemoveWhere(nc => nc.notificationManagerType == notificationManagerType);
|
notificationConnectors.RemoveWhere(nc => nc.notificationManagerType == notificationManagerType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,6 +72,7 @@ public abstract class GlobalBase
|
|||||||
|
|
||||||
protected void AddLibraryConnector(LibraryConnector libraryConnector)
|
protected void AddLibraryConnector(LibraryConnector libraryConnector)
|
||||||
{
|
{
|
||||||
|
Log($"Adding {libraryConnector}");
|
||||||
libraryConnectors.RemoveWhere(lc => lc.GetType() == libraryConnector.GetType());
|
libraryConnectors.RemoveWhere(lc => lc.GetType() == libraryConnector.GetType());
|
||||||
libraryConnectors.Add(libraryConnector);
|
libraryConnectors.Add(libraryConnector);
|
||||||
|
|
||||||
@ -80,6 +83,7 @@ public abstract class GlobalBase
|
|||||||
|
|
||||||
protected void DeleteLibraryConnector(LibraryConnector.LibraryType libraryType)
|
protected void DeleteLibraryConnector(LibraryConnector.LibraryType libraryType)
|
||||||
{
|
{
|
||||||
|
Log($"Removing {libraryType}");
|
||||||
libraryConnectors.RemoveWhere(lc => lc.libraryType == libraryType);
|
libraryConnectors.RemoveWhere(lc => lc.libraryType == libraryType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,11 @@ public class DownloadChapter : Job
|
|||||||
return Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Concat(this.GetType().ToString(), chapter.parentPublication.internalId, chapter.chapterNumber)));
|
return Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Concat(this.GetType().ToString(), chapter.parentPublication.internalId, chapter.chapterNumber)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"DownloadChapter {id} {chapter}";
|
||||||
|
}
|
||||||
|
|
||||||
protected override IEnumerable<Job> ExecuteReturnSubTasksInternal()
|
protected override IEnumerable<Job> ExecuteReturnSubTasksInternal()
|
||||||
{
|
{
|
||||||
Task downloadTask = new(delegate
|
Task downloadTask = new(delegate
|
||||||
|
@ -17,6 +17,11 @@ public class DownloadNewChapters : Job
|
|||||||
return Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Concat(this.GetType().ToString(), publication.internalId)));
|
return Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Concat(this.GetType().ToString(), publication.internalId)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"DownloadChapter {id} {publication}";
|
||||||
|
}
|
||||||
|
|
||||||
protected override IEnumerable<Job> ExecuteReturnSubTasksInternal()
|
protected override IEnumerable<Job> ExecuteReturnSubTasksInternal()
|
||||||
{
|
{
|
||||||
Chapter[] chapters = mangaConnector.GetNewChapters(publication);
|
Chapter[] chapters = mangaConnector.GetNewChapters(publication);
|
||||||
|
@ -15,22 +15,22 @@ public class JobBoss : GlobalBase
|
|||||||
|
|
||||||
public void AddJob(Job job)
|
public void AddJob(Job job)
|
||||||
{
|
{
|
||||||
|
Log($"Added {job}");
|
||||||
this.jobs.Add(job);
|
this.jobs.Add(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveJob(Job job)
|
public void RemoveJob(Job job)
|
||||||
{
|
{
|
||||||
|
Log($"Removing {job}");
|
||||||
job.Cancel();
|
job.Cancel();
|
||||||
this.jobs.Remove(job);
|
this.jobs.Remove(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveJobs(IEnumerable<Job> jobs)
|
public void RemoveJobs(IEnumerable<Job> jobsToRemove)
|
||||||
{
|
{
|
||||||
foreach (Job job in jobs)
|
Log($"Removing {jobsToRemove.Count()} jobs.");
|
||||||
{
|
foreach (Job job in jobsToRemove)
|
||||||
job.Cancel();
|
RemoveJob(job);
|
||||||
this.jobs.Remove(job);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Job> GetJobsLike(string? connectorName = null, string? internalId = null, string? chapterNumber = null)
|
public IEnumerable<Job> GetJobsLike(string? connectorName = null, string? internalId = null, string? chapterNumber = null)
|
||||||
|
@ -17,6 +17,11 @@ public class Kavita : LibraryConnector
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"Kavita {baseUrl}";
|
||||||
|
}
|
||||||
|
|
||||||
private static string GetToken(string baseUrl, string username, string password)
|
private static string GetToken(string baseUrl, string username, string password)
|
||||||
{
|
{
|
||||||
HttpClient client = new()
|
HttpClient client = new()
|
||||||
@ -37,7 +42,7 @@ public class Kavita : LibraryConnector
|
|||||||
JsonObject? result = JsonSerializer.Deserialize<JsonObject>(response.Content.ReadAsStream());
|
JsonObject? result = JsonSerializer.Deserialize<JsonObject>(response.Content.ReadAsStream());
|
||||||
if (result is not null)
|
if (result is not null)
|
||||||
return result["token"]!.GetValue<string>();
|
return result["token"]!.GetValue<string>();
|
||||||
else return "";
|
else throw new Exception("Did not receive token.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void UpdateLibrary()
|
public override void UpdateLibrary()
|
||||||
|
@ -20,6 +20,11 @@ public class Komga : LibraryConnector
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"Komga {baseUrl}";
|
||||||
|
}
|
||||||
|
|
||||||
public override void UpdateLibrary()
|
public override void UpdateLibrary()
|
||||||
{
|
{
|
||||||
Log("Updating libraries.");
|
Log("Updating libraries.");
|
||||||
|
@ -20,7 +20,7 @@ internal class DownloadClient : GlobalBase
|
|||||||
private readonly Dictionary<byte, DateTime> _lastExecutedRateLimit;
|
private readonly Dictionary<byte, DateTime> _lastExecutedRateLimit;
|
||||||
private readonly Dictionary<byte, TimeSpan> _rateLimit;
|
private readonly Dictionary<byte, TimeSpan> _rateLimit;
|
||||||
|
|
||||||
public DownloadClient(Dictionary<byte, int> rateLimitRequestsPerMinute, GlobalBase clone) : base(clone)
|
public DownloadClient(GlobalBase clone, Dictionary<byte, int> rateLimitRequestsPerMinute) : base(clone)
|
||||||
{
|
{
|
||||||
_lastExecutedRateLimit = new();
|
_lastExecutedRateLimit = new();
|
||||||
_rateLimit = new();
|
_rateLimit = new();
|
||||||
@ -60,6 +60,7 @@ internal class DownloadClient : GlobalBase
|
|||||||
if(referrer is not null)
|
if(referrer is not null)
|
||||||
requestMessage.Headers.Referrer = new Uri(referrer);
|
requestMessage.Headers.Referrer = new Uri(referrer);
|
||||||
_lastExecutedRateLimit[requestType] = DateTime.Now;
|
_lastExecutedRateLimit[requestType] = DateTime.Now;
|
||||||
|
Log($"Requesting {requestType} {url}");
|
||||||
response = Client.Send(requestMessage);
|
response = Client.Send(requestMessage);
|
||||||
}
|
}
|
||||||
catch (HttpRequestException e)
|
catch (HttpRequestException e)
|
||||||
|
@ -18,7 +18,6 @@ public abstract class MangaConnector : GlobalBase
|
|||||||
|
|
||||||
protected MangaConnector(GlobalBase clone) : base(clone)
|
protected MangaConnector(GlobalBase clone) : base(clone)
|
||||||
{
|
{
|
||||||
if (!Directory.Exists(settings.coverImageCache))
|
|
||||||
Directory.CreateDirectory(settings.coverImageCache);
|
Directory.CreateDirectory(settings.coverImageCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,14 +21,14 @@ public class MangaDex : MangaConnector
|
|||||||
public MangaDex(GlobalBase clone) : base(clone)
|
public MangaDex(GlobalBase clone) : base(clone)
|
||||||
{
|
{
|
||||||
name = "MangaDex";
|
name = "MangaDex";
|
||||||
this.downloadClient = new DownloadClient(new Dictionary<byte, int>()
|
this.downloadClient = new DownloadClient(clone, new Dictionary<byte, int>()
|
||||||
{
|
{
|
||||||
{(byte)RequestType.Manga, 250},
|
{(byte)RequestType.Manga, 250},
|
||||||
{(byte)RequestType.Feed, 250},
|
{(byte)RequestType.Feed, 250},
|
||||||
{(byte)RequestType.AtHomeServer, 40},
|
{(byte)RequestType.AtHomeServer, 40},
|
||||||
{(byte)RequestType.CoverUrl, 250},
|
{(byte)RequestType.CoverUrl, 250},
|
||||||
{(byte)RequestType.Author, 250}
|
{(byte)RequestType.Author, 250}
|
||||||
}, clone);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Publication[] GetPublications(string publicationTitle = "")
|
public override Publication[] GetPublications(string publicationTitle = "")
|
||||||
|
@ -13,10 +13,10 @@ public class MangaKatana : MangaConnector
|
|||||||
public MangaKatana(GlobalBase clone) : base(clone)
|
public MangaKatana(GlobalBase clone) : base(clone)
|
||||||
{
|
{
|
||||||
this.name = "MangaKatana";
|
this.name = "MangaKatana";
|
||||||
this.downloadClient = new DownloadClient(new Dictionary<byte, int>()
|
this.downloadClient = new DownloadClient(clone, new Dictionary<byte, int>()
|
||||||
{
|
{
|
||||||
{1, 60}
|
{1, 60}
|
||||||
}, clone);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Publication[] GetPublications(string publicationTitle = "")
|
public override Publication[] GetPublications(string publicationTitle = "")
|
||||||
|
@ -13,10 +13,10 @@ public class Manganato : MangaConnector
|
|||||||
public Manganato(GlobalBase clone) : base(clone)
|
public Manganato(GlobalBase clone) : base(clone)
|
||||||
{
|
{
|
||||||
this.name = "Manganato";
|
this.name = "Manganato";
|
||||||
this.downloadClient = new DownloadClient(new Dictionary<byte, int>()
|
this.downloadClient = new DownloadClient(clone, new Dictionary<byte, int>()
|
||||||
{
|
{
|
||||||
{1, 60}
|
{1, 60}
|
||||||
}, clone);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Publication[] GetPublications(string publicationTitle = "")
|
public override Publication[] GetPublications(string publicationTitle = "")
|
||||||
|
@ -18,10 +18,10 @@ public class Mangasee : MangaConnector
|
|||||||
public Mangasee(GlobalBase clone) : base(clone)
|
public Mangasee(GlobalBase clone) : base(clone)
|
||||||
{
|
{
|
||||||
this.name = "Mangasee";
|
this.name = "Mangasee";
|
||||||
this.downloadClient = new DownloadClient(new Dictionary<byte, int>()
|
this.downloadClient = new DownloadClient(clone, new Dictionary<byte, int>()
|
||||||
{
|
{
|
||||||
{ 1, 60 }
|
{ 1, 60 }
|
||||||
}, clone);
|
});
|
||||||
|
|
||||||
Task d = new Task(DownloadBrowser);
|
Task d = new Task(DownloadBrowser);
|
||||||
d.Start();
|
d.Start();
|
||||||
|
@ -17,6 +17,11 @@ public class Gotify : NotificationConnector
|
|||||||
this.appToken = appToken;
|
this.appToken = appToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"Gotify {endpoint}";
|
||||||
|
}
|
||||||
|
|
||||||
public override void SendNotification(string title, string notificationText)
|
public override void SendNotification(string title, string notificationText)
|
||||||
{
|
{
|
||||||
Log($"Sending notification: {title} - {notificationText}");
|
Log($"Sending notification: {title} - {notificationText}");
|
||||||
@ -28,7 +33,7 @@ public class Gotify : NotificationConnector
|
|||||||
if (!response.IsSuccessStatusCode)
|
if (!response.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
StreamReader sr = new (response.Content.ReadAsStream());
|
StreamReader sr = new (response.Content.ReadAsStream());
|
||||||
logger?.WriteLine(this.GetType().ToString(), $"{response.StatusCode}: {sr.ReadToEnd()}");
|
Log($"{response.StatusCode}: {sr.ReadToEnd()}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,11 @@ public class LunaSea : NotificationConnector
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"LunaSea {id}";
|
||||||
|
}
|
||||||
|
|
||||||
public override void SendNotification(string title, string notificationText)
|
public override void SendNotification(string title, string notificationText)
|
||||||
{
|
{
|
||||||
Log($"Sending notification: {title} - {notificationText}");
|
Log($"Sending notification: {title} - {notificationText}");
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
public abstract class NotificationConnector : GlobalBase
|
public abstract class NotificationConnector : GlobalBase
|
||||||
{
|
{
|
||||||
public NotificationManagerType notificationManagerType;
|
public readonly NotificationManagerType notificationManagerType;
|
||||||
|
|
||||||
protected NotificationConnector(GlobalBase clone, NotificationManagerType notificationManagerType) : base(clone)
|
protected NotificationConnector(GlobalBase clone, NotificationManagerType notificationManagerType) : base(clone)
|
||||||
{
|
{
|
||||||
|
@ -58,6 +58,11 @@ public struct Publication
|
|||||||
this.ignoreChaptersBelow = ignoreChaptersBelow ?? 0f;
|
this.ignoreChaptersBelow = ignoreChaptersBelow ?? 0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"Publication {sortName} {internalId}";
|
||||||
|
}
|
||||||
|
|
||||||
public string CreatePublicationFolder(string downloadDirectory)
|
public string CreatePublicationFolder(string downloadDirectory)
|
||||||
{
|
{
|
||||||
string publicationFolder = Path.Join(downloadDirectory, this.folderName);
|
string publicationFolder = Path.Join(downloadDirectory, this.folderName);
|
||||||
|
@ -397,9 +397,9 @@ public class Server : GlobalBase
|
|||||||
: Array.Empty<byte>());
|
: Array.Empty<byte>());
|
||||||
response.OutputStream.Close();
|
response.OutputStream.Close();
|
||||||
}
|
}
|
||||||
catch (HttpListenerException)
|
catch (HttpListenerException e)
|
||||||
{
|
{
|
||||||
|
Log(e.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user