diff --git a/main.go b/main.go index ebd3549..1e3e21a 100644 --- a/main.go +++ b/main.go @@ -369,12 +369,6 @@ func DownloadAndProcessEpub(jnovel jnc.Api, serie jnc.SerieAugmented, volume jnc zipPath := basePath + "Chapter " + chap.chDisplay + ".cbz" - if _, err = os.Stat(zipPath); err != nil { - err := os.Remove(zipPath) - if err != nil { - return - } - } newZipFile, err := os.Create(zipPath) if err != nil { panic(err) @@ -427,7 +421,7 @@ func DownloadAndProcessEpub(jnovel jnc.Api, serie jnc.SerieAugmented, volume jnc } } - comicInfo, err := GenerateChapterMetadata(volume, serie, len(chap.pages), language, chap.chDisplay) + comicInfo, err := GenerateChapterMetadata(volume, serie, len(chap.pages), language) if err != nil { fmt.Println(err) } @@ -440,8 +434,8 @@ func DownloadAndProcessEpub(jnovel jnc.Api, serie jnc.SerieAugmented, volume jnc epub.Close() newZip.Close() newZipFile.Close() + os.Remove(file) } - os.Remove(file) } case "novel": { @@ -542,7 +536,7 @@ func DownloadAndProcessEpub(jnovel jnc.Api, serie jnc.SerieAugmented, volume jnc } } -func GenerateChapterMetadata(volume jnc.VolumeAugmented, serie jnc.SerieAugmented, pageCount int, language string, chapterNumber string) ([]byte, error) { +func GenerateChapterMetadata(volume jnc.VolumeAugmented, serie jnc.SerieAugmented, pageCount int, language string) ([]byte, error) { comicInfo := ComicInfo{ XMLName: "ComicInfo", XMLNS: "http://www.w3.org/2001/XMLSchema-instance", @@ -553,9 +547,7 @@ func GenerateChapterMetadata(volume jnc.VolumeAugmented, serie jnc.SerieAugmente sInfo := serie.Info comicInfo.Series = sInfo.Title - comicInfo.Title = vInfo.Title - comicInfo.Number = chapterNumber - comicInfo.Volume = vInfo.Number + comicInfo.Number = vInfo.Number comicInfo.Count = -1 // TODO somehow fetch actual completion status @@ -603,9 +595,7 @@ type ComicInfo struct { XMLNS string `xml:"xmlns,attr"` XSI string `xml:"xsi,attr"` Series string `xml:"Series"` - Title string `xml:"Title"` - Volume int `xml:"Volume"` - Number string `xml:"Number"` + Number int `xml:"Number"` Count int `xml:"Count"` Summary string `xml:"Summary"` Year int `xml:"Year"` @@ -828,9 +818,6 @@ func GenerateMangaChapterList(navigation FileWrapper) *list.List { r, _ := regexp.Compile(regex) num := r.FindStringSubmatch(label)[1] parse, _ := strconv.ParseInt(num, 10, 8) - if parse == 0 { - fmt.Printf("Unlikely Chapter Number Detected (0): %s/n", label) - } lastMainChapter = int8(parse) subChapter = int8(0) } else {