From fd6ce2a51e29831fae46f4529c41c6a3ce14c714 Mon Sep 17 00:00:00 2001 From: Neshura <neshura@neshweb.net> Date: Tue, 18 Feb 2025 22:59:16 +0100 Subject: [PATCH 1/2] Broaden matching to include roman numerals --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index bfd67c1..19a1f41 100644 --- a/main.go +++ b/main.go @@ -822,7 +822,7 @@ func GenerateMangaChapterList(navigation FileWrapper) *list.List { label := navChapter.FindElement("./navLabel/text").Text() page := navChapter.FindElement("./content") - regex := "(?:Chapter|Episode) ([0-9]*)" + regex := "(?:Chapter|Episode) ([0-9IVXLCDM]*)" match, _ := regexp.MatchString(regex, label) if match { From c263fd9ccdbed6023759ce63e4c1994fc6796bd2 Mon Sep 17 00:00:00 2001 From: Neshura <neshura@neshweb.net> Date: Tue, 18 Feb 2025 23:04:33 +0100 Subject: [PATCH 2/2] Fixed Formatting and .cbz creation --- jnc/jnc.go | 2 +- main.go | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/jnc/jnc.go b/jnc/jnc.go index 38a121f..ce04c77 100644 --- a/jnc/jnc.go +++ b/jnc/jnc.go @@ -429,7 +429,7 @@ func (jncApi *Api) GetLibrarySeries() (seriesList []SerieAugmented, err error) { } func (jncApi *Api) Download(link string, targetDir string) (name string, err error) { - fmt.Printf("Downloading %s...", link) + fmt.Printf("Downloading %s...\n", link) res, err := http.Get(link) if err != nil { return "", err diff --git a/main.go b/main.go index 19a1f41..775ba62 100644 --- a/main.go +++ b/main.go @@ -369,7 +369,7 @@ func DownloadAndProcessEpub(jnovel jnc.Api, serie jnc.SerieAugmented, volume jnc zipPath := basePath + volume.Info.Title + " Chapter " + chap.chDisplay + ".cbz" - if _, err = os.Stat(zipPath); err != nil { + if _, err = os.Stat(zipPath); err == nil { err := os.Remove(zipPath) if err != nil { return @@ -830,14 +830,13 @@ func GenerateMangaChapterList(navigation FileWrapper) *list.List { num := r.FindStringSubmatch(label)[1] parse, _ := strconv.ParseInt(num, 10, 8) if int8(parse) == 0 { - fmt.Printf("Unlikely Chapter Number Detected (0): %s/n", num) + fmt.Printf("Unlikely Chapter Number Detected (0): '%s'\n", num) fmt.Println("Attempting Roman Numerals") lastMainChapter = int8(romanToInt(num)) } else { lastMainChapter = int8(parse) } subChapter = int8(0) - } else { if lastMainChapter == -1 { subChapter -= 1