Created
January 10, 2015 05:08
-
-
Save campaul/983ce9daee4b6fb1057a to your computer and use it in GitHub Desktop.
What the import function looks like now
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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