Move thumbnail work to normalize_thumbnail.

This commit is contained in:
voussoir 2021-01-19 10:35:09 -08:00
parent be7f5ebb01
commit a6f9d1859e
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -767,10 +767,7 @@ class Photo(ObjectBase):
self.height = db_row['height'] self.height = db_row['height']
self.ratio = db_row['ratio'] self.ratio = db_row['ratio']
if db_row['thumbnail'] is not None: self.thumbnail = self.normalize_thumbnail(db_row['thumbnail'])
self.thumbnail = self.photodb.thumbnail_directory.join(db_row['thumbnail'])
else:
self.thumbnail = None
self.searchhidden = db_row['searchhidden'] self.searchhidden = db_row['searchhidden']
@ -786,6 +783,16 @@ class Photo(ObjectBase):
def __str__(self): def __str__(self):
return f'Photo:{self.id}:{self.basename}' 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 @staticmethod
def normalize_override_filename(override_filename): def normalize_override_filename(override_filename):
if override_filename is None: if override_filename is None: