removed download limit added simple mode for logfile
All checks were successful
Build this app / Builder (push) Successful in 40s
All checks were successful
Build this app / Builder (push) Successful in 40s
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
name: Build this app
|
||||
run-name: ${{ gitea.actor }} is building GOMAD 🚀
|
||||
on: [push]
|
||||
on:
|
||||
push:
|
||||
tags: ['v*']
|
||||
|
||||
|
||||
|
||||
jobs:
|
||||
Builder:
|
||||
|
||||
16
main.go
16
main.go
@@ -16,6 +16,8 @@ import (
|
||||
"github.com/schollz/progressbar/v3"
|
||||
)
|
||||
|
||||
var simplePtr *bool
|
||||
|
||||
type pageInfo struct {
|
||||
StatusCode int
|
||||
Links map[string]int
|
||||
@@ -135,6 +137,7 @@ func downloadChapter(chapterPath string, url string) {
|
||||
c.OnHTML("section", func(h *colly.HTMLElement) {
|
||||
images := h.DOM.Find("img")
|
||||
imagesLength := images.Length()
|
||||
|
||||
bar := progressbar.NewOptions(imagesLength,
|
||||
progressbar.OptionEnableColorCodes(true),
|
||||
progressbar.OptionFullWidth(),
|
||||
@@ -149,7 +152,9 @@ func downloadChapter(chapterPath string, url string) {
|
||||
}))
|
||||
images.Each(func(i int, s *goquery.Selection) {
|
||||
imgSrc, _ := s.Attr("src")
|
||||
if !*simplePtr {
|
||||
bar.Add(1)
|
||||
}
|
||||
wg.Add(1)
|
||||
count++
|
||||
go downloadImage(imgSrc, chapterPath+"/")
|
||||
@@ -196,7 +201,9 @@ func compressToCbz(chapterPath string) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if !*simplePtr {
|
||||
bar.Add(1)
|
||||
}
|
||||
defer f1.Close()
|
||||
|
||||
w1, err := zipWriter.Create(e.Name())
|
||||
@@ -230,7 +237,7 @@ func downloadSeries(url string, downloadPath string, single float64) {
|
||||
|
||||
log.Println("Starting to download", seriesName)
|
||||
downloadCount := 0
|
||||
for i, c := range s.Chapters {
|
||||
for _, c := range s.Chapters {
|
||||
chapterPath := fmt.Sprintf("%s/%s", seriesPath, c.Name)
|
||||
if _, err := os.Stat(seriesPath + "/" + c.Name + ".cbz"); os.IsNotExist(err) {
|
||||
log.Println("Downloading ", c.Name)
|
||||
@@ -242,9 +249,9 @@ func downloadSeries(url string, downloadPath string, single float64) {
|
||||
}
|
||||
|
||||
// if after 5 five files no download has happened just move on to the next
|
||||
if i == 5 && downloadCount < 6 {
|
||||
break
|
||||
}
|
||||
//if i == 5 && downloadCount < 6 {
|
||||
// break
|
||||
//}
|
||||
}
|
||||
|
||||
if downloadCount == 0 {
|
||||
@@ -257,6 +264,7 @@ func main() {
|
||||
dlPathPtr := flag.String("path", "", "Download Path")
|
||||
filePtr := flag.String("file", "", "Path to file for multi download")
|
||||
chapterPtr := flag.Float64("c", 9999, "Specific chapter")
|
||||
simplePtr = flag.Bool("s", false, "Simple output for readable logs")
|
||||
|
||||
flag.Parse()
|
||||
if *urlPtr == "" && *filePtr == "" {
|
||||
|
||||
Reference in New Issue
Block a user