Let Photo.basename be a @property.
This commit is contained in:
parent
3b72b07262
commit
98f706f486
1 changed files with 6 additions and 2 deletions
|
@ -682,7 +682,7 @@ class Photo(ObjectBase):
|
|||
self.id = db_row['id']
|
||||
self.created = db_row['created']
|
||||
self.author_id = self.normalize_author_id(db_row['author_id'])
|
||||
self.basename = db_row['override_filename'] or self.real_path.basename
|
||||
self.override_filename = db_row['override_filename']
|
||||
self.extension = db_row['extension']
|
||||
self.tagged_at = db_row['tagged_at']
|
||||
|
||||
|
@ -776,6 +776,10 @@ class Photo(ObjectBase):
|
|||
|
||||
return tag
|
||||
|
||||
@property
|
||||
def basename(self):
|
||||
return self.override_filename or self.real_path.basename
|
||||
|
||||
@property
|
||||
def bitrate(self):
|
||||
if self.duration and self.bytes is not None:
|
||||
|
@ -1196,7 +1200,7 @@ class Photo(ObjectBase):
|
|||
'override_filename': new_filename,
|
||||
}
|
||||
self.photodb.sql_update(table='photos', pairs=data, where_key='id')
|
||||
self.basename = new_filename
|
||||
self.override_filename = new_filename
|
||||
|
||||
self.__reinit__()
|
||||
|
||||
|
|
Loading…
Reference in a new issue