Skip to content

Instantly share code, notes, and snippets.

@campaul
Created January 10, 2015 05:08
Show Gist options
  • Save campaul/983ce9daee4b6fb1057a to your computer and use it in GitHub Desktop.
Save campaul/983ce9daee4b6fb1057a to your computer and use it in GitHub Desktop.
What the import function looks like now
def import_photos(self, path, notify=None, imported=None,
copy_photos=True, delete_originals=False):
photo_list = self.discover(path)
progress = Progress(len(photo_list))
for photo in photo_list:
if notify:
notify(os.path.basename(photo.raw_path))
self.add(
import_photo(photo, copy_photos, delete_originals,
self.import_path, self.cache_path)
)
if imported:
imported(photo.file_hash, progress.advance())
def discover(self, path):
photo_list = []
for photo_path in raw.discover(path):
photo = Photo.load(photo_path, hash_file(photo_path))
if not self.exists(photo):
photo_list.append(photo)
return photo_list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment