Update download.go

This commit is contained in:
BitHeaven 2022-11-10 20:16:55 +05:00 committed by GitHub
parent 0707246c77
commit 4088e2baf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 15 deletions

View File

@ -121,9 +121,10 @@ func getSavePath(post *e621.Post, directory *string) string {
func downloadPost(post *e621.Post, directory string) error { func downloadPost(post *e621.Post, directory string) error {
savePath := getSavePath(post, &directory) savePath := getSavePath(post, &directory)
fmt.Print(post.File.URL) if _, err := os.Stat(savePath); err == nil {
fmt.Print(savePath) fmt.Print("File exists, skip...\n")
}
else {
resp, err := e621.HTTPGet(post.File.URL) resp, err := e621.HTTPGet(post.File.URL)
if err != nil { if err != nil {
return err return err
@ -140,6 +141,8 @@ func downloadPost(post *e621.Post, directory string) error {
if err != nil { if err != nil {
return err return err
} }
}
return nil return nil
} }