Skip to content

Commit

Permalink
bookwalker: Fixed file naming not taking subpages into account.
Browse files Browse the repository at this point in the history
  • Loading branch information
MinoMino committed Dec 14, 2016
1 parent 192bc81 commit e0a4345
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion plugins/bookwalker/bookwalker.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,12 @@ func (bw *BookWalker) DownloadGenerator(url string) (dlgen func() plugins.Downlo

filePath := bw.content[n].FilePath + "/" + strconv.Itoa(p.Page.No)
img, err := ds.Descramble(filePath, buf, p.Page.DummyWidth, p.Page.DummyHeight)
path := filepath.Join(dir, fmt.Sprintf("%04d.%s", n+1, ext))
var path string
if p.Page.No > 0 {
path = filepath.Join(dir, fmt.Sprintf("%04d-%d.%s", n+1, p.Page.No, ext))
} else {
path = filepath.Join(dir, fmt.Sprintf("%04d.%s", n+1, ext))
}
if opts["Lossless"].(bool) {
// Save as PNG.
w, err := rep.FileWriter(path, false)
Expand Down

0 comments on commit e0a4345

Please sign in to comment.