From d211dd2d01d085d513e25a01cd09408c67079ceb Mon Sep 17 00:00:00 2001 From: db-2001 Date: Mon, 18 Mar 2024 22:32:26 -0400 Subject: [PATCH 1/3] Added check to prevent creation of empty chapter files --- Tranga/MangaConnectors/MangaConnector.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Tranga/MangaConnectors/MangaConnector.cs b/Tranga/MangaConnectors/MangaConnector.cs index bd80aed..8dad271 100644 --- a/Tranga/MangaConnectors/MangaConnector.cs +++ b/Tranga/MangaConnectors/MangaConnector.cs @@ -241,6 +241,15 @@ public abstract class MangaConnector : GlobalBase int chapter = 0; //Download all Images to temporary Folder + if (imageUrls.Length == 0) + { + Log("No images found"); + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + File.SetUnixFileMode(saveArchiveFilePath, UserRead | UserWrite | UserExecute | GroupRead | GroupWrite | GroupExecute); + Directory.Delete(tempFolder, true); + progressToken?.Complete(); + return HttpStatusCode.NoContent; + } foreach (string imageUrl in imageUrls) { string extension = imageUrl.Split('.')[^1].Split('?')[0]; From 05190bc9e265f8464f3e2e6950bc65bfd59f0e66 Mon Sep 17 00:00:00 2001 From: db-2001 Date: Tue, 26 Mar 2024 18:16:41 -0400 Subject: [PATCH 2/3] Holy moly a fix for Mangasee --- Tranga/MangaConnectors/Mangasee.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tranga/MangaConnectors/Mangasee.cs b/Tranga/MangaConnectors/Mangasee.cs index 3a0efde..c354d1c 100644 --- a/Tranga/MangaConnectors/Mangasee.cs +++ b/Tranga/MangaConnectors/Mangasee.cs @@ -199,8 +199,8 @@ public class Mangasee : MangaConnector string? volumeNumber = m.Groups[2].Success ? m.Groups[2].Value : "1"; string chapterNumber = m.Groups[1].Value; - url = string.Concat(Regex.Match(url, @"(.*)-page-[0-9]+(\.html)").Groups.Values.Select(v => v.Value)); - chapters.Add(new Chapter(manga, "", volumeNumber, chapterNumber, url)); + string chapterUrl = Regex.Replace(url, @"-page-[0-9]+(\.html)", ".html"); + chapters.Add(new Chapter(manga, "", volumeNumber, chapterNumber, chapterUrl)); } //Return Chapters ordered by Chapter-Number From d5b6d4e8ee46cd2e6988fe6368b8219585452449 Mon Sep 17 00:00:00 2001 From: db-2001 Date: Fri, 29 Mar 2024 23:59:16 -0400 Subject: [PATCH 3/3] Fixes for https://github.com/C9Glax/tranga/issues/138 and bug fix for MDex --- Tranga/Chapter.cs | 2 +- Tranga/MangaConnectors/MangaDex.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tranga/Chapter.cs b/Tranga/Chapter.cs index 3178458..a699cb5 100644 --- a/Tranga/Chapter.cs +++ b/Tranga/Chapter.cs @@ -19,7 +19,7 @@ public readonly struct Chapter : IComparable public string fileName { get; } private static readonly Regex LegalCharacters = new (@"([A-z]*[0-9]* *\.*-*,*\]*\[*'*\'*\)*\(*~*!*)*"); - private static readonly Regex IllegalStrings = new(@"Vol(ume)?.?", RegexOptions.IgnoreCase); + private static readonly Regex IllegalStrings = new(@"(Vol(ume)?|Ch(apter)?)\.?", RegexOptions.IgnoreCase); private static readonly Regex Digits = new(@"[0-9\.]*"); public Chapter(Manga parentManga, string? name, string? volumeNumber, string chapterNumber, string url) { diff --git a/Tranga/MangaConnectors/MangaDex.cs b/Tranga/MangaConnectors/MangaDex.cs index 08c4bac..aef00df 100644 --- a/Tranga/MangaConnectors/MangaDex.cs +++ b/Tranga/MangaConnectors/MangaDex.cs @@ -252,7 +252,7 @@ public class MangaDex : MangaConnector Log($"Retrieving chapter-info {chapter} {chapterParentManga}"); //Request URLs for Chapter-Images RequestResult requestResult = - downloadClient.MakeRequest($"https://api.mangadex.org/at-home/server/{chapter.url}?forcePort443=false'", RequestType.MangaDexImage); + downloadClient.MakeRequest($"https://api.mangadex.org/at-home/server/{chapter.url}?forcePort443=false", RequestType.MangaDexImage); if ((int)requestResult.statusCode < 200 || (int)requestResult.statusCode >= 300) { progressToken?.Cancel();