Compare commits
3 commits
b36bc9b0b2
...
cfaec3a4fd
Author | SHA1 | Date | |
---|---|---|---|
cfaec3a4fd | |||
8c97c93b34 | |||
fb157d6b77 |
1 changed files with 18 additions and 5 deletions
23
main.go
23
main.go
|
@ -369,6 +369,12 @@ 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)
|
||||
|
@ -421,7 +427,7 @@ func DownloadAndProcessEpub(jnovel jnc.Api, serie jnc.SerieAugmented, volume jnc
|
|||
}
|
||||
}
|
||||
|
||||
comicInfo, err := GenerateChapterMetadata(volume, serie, len(chap.pages), language)
|
||||
comicInfo, err := GenerateChapterMetadata(volume, serie, len(chap.pages), language, chap.chDisplay)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
@ -434,8 +440,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":
|
||||
{
|
||||
|
@ -536,7 +542,7 @@ func DownloadAndProcessEpub(jnovel jnc.Api, serie jnc.SerieAugmented, volume jnc
|
|||
}
|
||||
}
|
||||
|
||||
func GenerateChapterMetadata(volume jnc.VolumeAugmented, serie jnc.SerieAugmented, pageCount int, language string) ([]byte, error) {
|
||||
func GenerateChapterMetadata(volume jnc.VolumeAugmented, serie jnc.SerieAugmented, pageCount int, language string, chapterNumber string) ([]byte, error) {
|
||||
comicInfo := ComicInfo{
|
||||
XMLName: "ComicInfo",
|
||||
XMLNS: "http://www.w3.org/2001/XMLSchema-instance",
|
||||
|
@ -547,7 +553,9 @@ func GenerateChapterMetadata(volume jnc.VolumeAugmented, serie jnc.SerieAugmente
|
|||
sInfo := serie.Info
|
||||
|
||||
comicInfo.Series = sInfo.Title
|
||||
comicInfo.Number = vInfo.Number
|
||||
comicInfo.Title = vInfo.Title
|
||||
comicInfo.Number = chapterNumber
|
||||
comicInfo.Volume = vInfo.Number
|
||||
|
||||
comicInfo.Count = -1 // TODO somehow fetch actual completion status
|
||||
|
||||
|
@ -595,7 +603,9 @@ type ComicInfo struct {
|
|||
XMLNS string `xml:"xmlns,attr"`
|
||||
XSI string `xml:"xsi,attr"`
|
||||
Series string `xml:"Series"`
|
||||
Number int `xml:"Number"`
|
||||
Title string `xml:"Title"`
|
||||
Volume int `xml:"Volume"`
|
||||
Number string `xml:"Number"`
|
||||
Count int `xml:"Count"`
|
||||
Summary string `xml:"Summary"`
|
||||
Year int `xml:"Year"`
|
||||
|
@ -818,6 +828,9 @@ 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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue