Move thumbnail work to normalize_thumbnail.
This commit is contained in:
		
							parent
							
								
									be7f5ebb01
								
							
						
					
					
						commit
						a6f9d1859e
					
				
					 1 changed files with 11 additions and 4 deletions
				
			
		|  | @ -767,10 +767,7 @@ class Photo(ObjectBase): | |||
|         self.height = db_row['height'] | ||||
|         self.ratio = db_row['ratio'] | ||||
| 
 | ||||
|         if db_row['thumbnail'] is not None: | ||||
|             self.thumbnail = self.photodb.thumbnail_directory.join(db_row['thumbnail']) | ||||
|         else: | ||||
|             self.thumbnail = None | ||||
|         self.thumbnail = self.normalize_thumbnail(db_row['thumbnail']) | ||||
| 
 | ||||
|         self.searchhidden = db_row['searchhidden'] | ||||
| 
 | ||||
|  | @ -786,6 +783,16 @@ class Photo(ObjectBase): | |||
|     def __str__(self): | ||||
|         return f'Photo:{self.id}:{self.basename}' | ||||
| 
 | ||||
|     def normalize_thumbnail(self, thumbnail): | ||||
|         if thumbnail is None: | ||||
|             return None | ||||
| 
 | ||||
|         thumbnail = self.photodb.thumbnail_directory.join(thumbnail) | ||||
|         if not thumbnail.is_file: | ||||
|             return None | ||||
| 
 | ||||
|         return thumbnail | ||||
| 
 | ||||
|     @staticmethod | ||||
|     def normalize_override_filename(override_filename): | ||||
|         if override_filename is None: | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue