Skip to content

Commit 50c6784

Browse files
committed
updates metadata store for already downloaded files not in the store.
Handling the edge case where you have downloaded files without the metadata store enabled, and then turn it on afterwards.
1 parent 44d7eac commit 50c6784

1 file changed

Lines changed: 14 additions & 15 deletions

File tree

flickr_download/flick_download.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -267,23 +267,22 @@ def do_download_photo(
267267
# TODO: Ideally we should check for file size / md5 here
268268
# to handle failed downloads.
269269
logging.info("Skipping %s, as it exists already", fname)
270-
return
271-
272-
logging.info("Saving: %s (%s)", fname, get_photo_page(photo))
273-
if skip_download:
274-
return
270+
else:
271+
logging.info("Saving: %s (%s)", fname, get_photo_page(photo))
272+
if skip_download:
273+
return
275274

276-
try:
277-
photo.save(fname, size_label)
278-
except IOError as ex:
279-
logging.error("IO error saving photo: %s", ex)
280-
return
281-
except FlickrError as ex:
282-
logging.error("Flickr error saving photo: %s", ex)
283-
return
275+
try:
276+
photo.save(fname, size_label)
277+
except IOError as ex:
278+
logging.error("IO error saving photo: %s", ex)
279+
return
280+
except FlickrError as ex:
281+
logging.error("Flickr error saving photo: %s", ex)
282+
return
284283

285-
# Set file times to when the photo was taken
286-
set_file_time(fname, photo["taken"])
284+
# Set file times to when the photo was taken
285+
set_file_time(fname, photo["taken"])
287286

288287
if metadata_db:
289288
metadata_db.execute(

0 commit comments

Comments
 (0)