From fcd507e3374287e56d75cc1b7f76ca3ef547d7ee Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Fri, 16 Jun 2017 02:23:48 -0700 Subject: [PATCH] Add new_photo_kwargs param to digest_directory. --- etiquette/photodb.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/etiquette/photodb.py b/etiquette/photodb.py index fef0831..2c91df9 100644 --- a/etiquette/photodb.py +++ b/etiquette/photodb.py @@ -1174,6 +1174,7 @@ class PhotoDB(PDBAlbumMixin, PDBBookmarkMixin, PDBPhotoMixin, PDBTagMixin, PDBUs exclude_directories=None, exclude_filenames=None, make_albums=True, + new_photo_kwargs={}, recurse=True, commit=True, ): @@ -1192,6 +1193,11 @@ class PhotoDB(PDBAlbumMixin, PDBBookmarkMixin, PDBPhotoMixin, PDBTagMixin, PDBUs if exclude_filenames is None: exclude_filenames = self.config['digest_exclude_files'] + if 'commit' in new_photo_kwargs: + new_photo_kwargs.pop('commit') + if 'filepath' in new_photo_kwargs: + new_photo_kwargs.pop('filepath') + directory.correct_case() generator = spinal.walk_generator( directory, @@ -1219,7 +1225,7 @@ class PhotoDB(PDBAlbumMixin, PDBBookmarkMixin, PDBPhotoMixin, PDBTagMixin, PDBUs try: photo = self.get_photo_by_path(filepath) except exceptions.NoSuchPhoto: - photo = self.new_photo(filepath.absolute_path, commit=False) + photo = self.new_photo(filepath.absolute_path, commit=False, **new_photo_kwargs) new_photos.append(photo) if not make_albums: