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