Merge remote-tracking branch 'upstream/cuttingedge' into cuttingedge
This commit is contained in:
commit
482704af2c
@ -164,7 +164,7 @@ public class JobBoss : GlobalBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
HashSet<string> coverFileNames = cachedPublications.Select(manga => manga.coverFileNameInCache!).ToHashSet();
|
HashSet<string> coverFileNames = cachedPublications.Select(manga => manga.coverFileNameInCache!).ToHashSet();
|
||||||
foreach (string fileName in Directory.GetFiles(settings.coverImageCache))
|
foreach (string fileName in Directory.GetFiles(settings.coverImageCache)) //Cleanup Unused Covers
|
||||||
{
|
{
|
||||||
if(!coverFileNames.Any(existingManga => fileName.Contains(existingManga)))
|
if(!coverFileNames.Any(existingManga => fileName.Contains(existingManga)))
|
||||||
File.Delete(fileName);
|
File.Delete(fileName);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using HtmlAgilityPack;
|
using HtmlAgilityPack;
|
||||||
using PuppeteerSharp;
|
using PuppeteerSharp;
|
||||||
|
using PuppeteerSharp.Input;
|
||||||
|
|
||||||
namespace Tranga.MangaConnectors;
|
namespace Tranga.MangaConnectors;
|
||||||
|
|
||||||
@ -81,7 +82,7 @@ internal class ChromiumDownloadClient : DownloadClient
|
|||||||
{
|
{
|
||||||
if (content.Contains("text/html"))
|
if (content.Contains("text/html"))
|
||||||
{
|
{
|
||||||
if(clickButton is not null)
|
if (clickButton is not null && page.QuerySelectorAsync(clickButton).Result is not null)
|
||||||
page.ClickAsync(clickButton).Wait();
|
page.ClickAsync(clickButton).Wait();
|
||||||
string htmlString = page.GetContentAsync().Result;
|
string htmlString = page.GetContentAsync().Result;
|
||||||
stream = new MemoryStream(Encoding.Default.GetBytes(htmlString));
|
stream = new MemoryStream(Encoding.Default.GetBytes(htmlString));
|
||||||
|
@ -237,7 +237,7 @@ public abstract class MangaConnector : GlobalBase
|
|||||||
return HttpStatusCode.Created;
|
return HttpStatusCode.Created;
|
||||||
|
|
||||||
//Create a temporary folder to store images
|
//Create a temporary folder to store images
|
||||||
string tempFolder = Directory.CreateTempSubdirectory().FullName;
|
string tempFolder = Directory.CreateTempSubdirectory("trangatemp").FullName;
|
||||||
|
|
||||||
int chapter = 0;
|
int chapter = 0;
|
||||||
//Download all Images to temporary Folder
|
//Download all Images to temporary Folder
|
||||||
@ -269,8 +269,10 @@ public abstract class MangaConnector : GlobalBase
|
|||||||
progressToken?.Increment();
|
progressToken?.Increment();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(comicInfoPath is not null)
|
if(comicInfoPath is not null){
|
||||||
File.Copy(comicInfoPath, Path.Join(tempFolder, "ComicInfo.xml"));
|
File.Copy(comicInfoPath, Path.Join(tempFolder, "ComicInfo.xml"));
|
||||||
|
File.Delete(comicInfoPath); //Delete tmp-file
|
||||||
|
}
|
||||||
|
|
||||||
Log($"Creating archive {saveArchiveFilePath}");
|
Log($"Creating archive {saveArchiveFilePath}");
|
||||||
//ZIP-it and ship-it
|
//ZIP-it and ship-it
|
||||||
|
@ -216,6 +216,7 @@ public class MangaDex : MangaConnector
|
|||||||
{
|
{
|
||||||
JsonObject chapter = (JsonObject)jsonNode!;
|
JsonObject chapter = (JsonObject)jsonNode!;
|
||||||
JsonObject attributes = chapter["attributes"]!.AsObject();
|
JsonObject attributes = chapter["attributes"]!.AsObject();
|
||||||
|
|
||||||
string chapterId = chapter["id"]!.GetValue<string>();
|
string chapterId = chapter["id"]!.GetValue<string>();
|
||||||
|
|
||||||
string? title = attributes.ContainsKey("title") && attributes["title"] is not null
|
string? title = attributes.ContainsKey("title") && attributes["title"] is not null
|
||||||
@ -230,6 +231,14 @@ public class MangaDex : MangaConnector
|
|||||||
? attributes["chapter"]!.GetValue<string>()
|
? attributes["chapter"]!.GetValue<string>()
|
||||||
: "null";
|
: "null";
|
||||||
|
|
||||||
|
|
||||||
|
if (attributes.ContainsKey("pages") && attributes["pages"] is not null &&
|
||||||
|
attributes["pages"]!.GetValue<int>() < 1)
|
||||||
|
{
|
||||||
|
Log($"Skipping {chapterId} Vol.{volume} Ch.{chapterNum} {title} because it has no pages or is externally linked.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if(chapterNum is not "null")
|
if(chapterNum is not "null")
|
||||||
chapters.Add(new Chapter(manga, title, volume, chapterNum, chapterId));
|
chapters.Add(new Chapter(manga, title, volume, chapterNum, chapterId));
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,8 @@ public partial class Tranga : GlobalBase
|
|||||||
new Bato(this),
|
new Bato(this),
|
||||||
new MangaLife(this)
|
new MangaLife(this)
|
||||||
};
|
};
|
||||||
|
foreach(DirectoryInfo dir in new DirectoryInfo(Path.GetTempPath()).GetDirectories("trangatemp"))//Cleanup old temp folders
|
||||||
|
dir.Delete();
|
||||||
jobBoss = new(this, this._connectors);
|
jobBoss = new(this, this._connectors);
|
||||||
StartJobBoss();
|
StartJobBoss();
|
||||||
this._server = new Server(this);
|
this._server = new Server(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user