mirror of
https://codeberg.org/scip/kleingebaeck.git
synced 2025-12-16 12:01:00 +01:00
added -f to override d-hash, better debug and error handling
This commit is contained in:
11
scrape.go
11
scrape.go
@@ -136,11 +136,10 @@ func ScrapeAd(fetch *Fetcher, uri string) error {
|
||||
func ScrapeImages(fetch *Fetcher, ad *Ad, addir string) error {
|
||||
// fetch images
|
||||
img := 1
|
||||
|
||||
adpath := filepath.Join(fetch.Config.Outdir, addir)
|
||||
|
||||
// scan existing images, if any
|
||||
images, err := ReadImages(adpath)
|
||||
cache, err := ReadImages(adpath, fetch.Config.ForceDownload)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -167,9 +166,11 @@ func ScrapeImages(fetch *Fetcher, ad *Ad, addir string) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if image.SimilarExists(images) {
|
||||
slog.Debug("similar image exists, not written", "image", image)
|
||||
return nil
|
||||
if !fetch.Config.ForceDownload {
|
||||
if image.SimilarExists(cache) {
|
||||
slog.Debug("similar image exists, not written", "uri", image.Uri)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
err = WriteImage(file, buf2)
|
||||
|
||||
Reference in New Issue
Block a user