cachedPublications
This commit is contained in:
parent
a89a526fda
commit
0cf3a95f58
@ -9,8 +9,9 @@ public abstract class GlobalBase
|
||||
{
|
||||
protected Logger? logger { get; init; }
|
||||
protected TrangaSettings settings { get; init; }
|
||||
private HashSet<NotificationConnector> notificationConnectors { get; init; }
|
||||
private HashSet<LibraryConnector> libraryConnectors { get; init; }
|
||||
protected HashSet<NotificationConnector> notificationConnectors { get; init; }
|
||||
protected HashSet<LibraryConnector> libraryConnectors { get; init; }
|
||||
protected List<Publication> cachedPublications { get; init; }
|
||||
|
||||
protected GlobalBase(GlobalBase clone)
|
||||
{
|
||||
@ -18,6 +19,7 @@ public abstract class GlobalBase
|
||||
this.settings = clone.settings;
|
||||
this.notificationConnectors = clone.notificationConnectors;
|
||||
this.libraryConnectors = clone.libraryConnectors;
|
||||
this.cachedPublications = clone.cachedPublications;
|
||||
}
|
||||
|
||||
protected GlobalBase(Logger? logger, TrangaSettings settings)
|
||||
@ -26,6 +28,7 @@ public abstract class GlobalBase
|
||||
this.settings = settings;
|
||||
this.notificationConnectors = settings.LoadNotificationConnectors();
|
||||
this.libraryConnectors = settings.LoadLibraryConnectors();
|
||||
this.cachedPublications = new();
|
||||
}
|
||||
|
||||
protected void Log(string message)
|
||||
|
@ -146,7 +146,8 @@ public class MangaDex : MangaConnector
|
||||
}
|
||||
}
|
||||
|
||||
Log($"Retrieved {publications.Count} publications.");
|
||||
cachedPublications.AddRange(publications);
|
||||
Log($"Retrieved {publications.Count} publications. Term=\"{publicationTitle}\"");
|
||||
return publications.ToArray();
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,8 @@ public class MangaKatana : MangaConnector
|
||||
}
|
||||
|
||||
Publication[] publications = ParsePublicationsFromHtml(requestResult.result);
|
||||
Log($"Retrieved {publications.Length} publications.");
|
||||
cachedPublications.AddRange(publications);
|
||||
Log($"Retrieved {publications.Length} publications. Term=\"{publicationTitle}\"");
|
||||
return publications;
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,8 @@ public class Manganato : MangaConnector
|
||||
return Array.Empty<Publication>();
|
||||
|
||||
Publication[] publications = ParsePublicationsFromHtml(requestResult.result);
|
||||
Log($"Retrieved {publications.Length} publications.");
|
||||
cachedPublications.AddRange(publications);
|
||||
Log($"Retrieved {publications.Length} publications. Term=\"{publicationTitle}\"");
|
||||
return publications;
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,10 @@ public class Mangasee : MangaConnector
|
||||
if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300)
|
||||
return Array.Empty<Publication>();
|
||||
|
||||
return ParsePublicationsFromHtml(requestResult.result, publicationTitle);
|
||||
Publication[] publications = ParsePublicationsFromHtml(requestResult.result, publicationTitle);
|
||||
cachedPublications.AddRange(publications);
|
||||
Log($"Retrieved {publications.Length} publications. Term=\"{publicationTitle}\"");
|
||||
return publications;
|
||||
}
|
||||
|
||||
private Publication[] ParsePublicationsFromHtml(Stream html, string publicationTitle)
|
||||
|
Loading…
Reference in New Issue
Block a user