Add separate plural method Album.add_associated_directories.
This commit is contained in:
		
							parent
							
								
									892390c77a
								
							
						
					
					
						commit
						519bcf32e6
					
				
					 1 changed files with 17 additions and 8 deletions
				
			
		|  | @ -285,14 +285,7 @@ class Album(ObjectBase, GroupableMixin): | ||||||
|     def add_children(self, *args, **kwargs): |     def add_children(self, *args, **kwargs): | ||||||
|         return super().add_children(*args, **kwargs) |         return super().add_children(*args, **kwargs) | ||||||
| 
 | 
 | ||||||
|     @decorators.required_feature('album.edit') |     def _add_associated_directory(self, path): | ||||||
|     @decorators.transaction |  | ||||||
|     def add_associated_directory(self, path): |  | ||||||
|         ''' |  | ||||||
|         Add a directory from which this album will pull files during rescans. |  | ||||||
|         These relationships are not unique and multiple albums |  | ||||||
|         can associate with the same directory if desired. |  | ||||||
|         ''' |  | ||||||
|         path = pathclass.Path(path) |         path = pathclass.Path(path) | ||||||
| 
 | 
 | ||||||
|         if not path.is_dir: |         if not path.is_dir: | ||||||
|  | @ -305,6 +298,22 @@ class Album(ObjectBase, GroupableMixin): | ||||||
|         data = {'albumid': self.id, 'directory': path.absolute_path} |         data = {'albumid': self.id, 'directory': path.absolute_path} | ||||||
|         self.photodb.sql_insert(table='album_associated_directories', data=data) |         self.photodb.sql_insert(table='album_associated_directories', data=data) | ||||||
| 
 | 
 | ||||||
|  |     @decorators.required_feature('album.edit') | ||||||
|  |     @decorators.transaction | ||||||
|  |     def add_associated_directory(self, path): | ||||||
|  |         ''' | ||||||
|  |         Add a directory from which this album will pull files during rescans. | ||||||
|  |         These relationships are not unique and multiple albums can associate | ||||||
|  |         with the same directory if desired. | ||||||
|  |         ''' | ||||||
|  |         self._add_associated_directory(path) | ||||||
|  | 
 | ||||||
|  |     @decorators.required_feature('album.edit') | ||||||
|  |     @decorators.transaction | ||||||
|  |     def add_associated_directories(self, paths): | ||||||
|  |         for path in paths: | ||||||
|  |             self._add_associated_directory(path) | ||||||
|  | 
 | ||||||
|     def _add_photo(self, photo): |     def _add_photo(self, photo): | ||||||
|         self.photodb.log.debug('Adding photo %s to %s', photo, self) |         self.photodb.log.debug('Adding photo %s to %s', photo, self) | ||||||
|         data = {'albumid': self.id, 'photoid': photo.id} |         data = {'albumid': self.id, 'photoid': photo.id} | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue