Browse Source

Fixed a bug with downloading

master
dtluna 1 year ago
parent
commit
2042052b3d
2 changed files with 10 additions and 8 deletions
  1. 9
    7
      download/main.go
  2. 1
    1
      main.go

+ 9
- 7
download/main.go View File

@@ -53,16 +53,18 @@ func getNumOfPages(res result) int {
return 1
}

func getCommand(url string, cnt bool) *exec.Cmd {
if cnt {
return exec.Command("wget", "-c", url)
} else {
return exec.Command("wget", "-c", url)
}
}

func downloadPosts(posts []post, cnt bool, bar *progressbar.ProgressBar) {
for i := 0; i < len(posts); i++ {
url := "https:" + posts[i].FileURL
cmd := new(exec.Cmd)
cmd.Path = "wget"
if cnt {
cmd.Args = []string{"-c", url}
} else {
cmd.Args = []string{url}
}
cmd := getCommand(url, cnt)
crash(cmd.Run())
crash(bar.Add(1))
}

+ 1
- 1
main.go View File

@@ -15,7 +15,7 @@ func (args) Description() string {
}

func (args) Version() string {
return "safegrabber 1.0.0"
return "safegrabber 1.0.1"
}

func main() {

Loading…
Cancel
Save