Let the purge methods yield their deleted items.

This commit is contained in:
voussoir 2020-09-30 13:41:42 -07:00
parent 0ec072c797
commit 735fbf9abd

View file

@ -121,6 +121,7 @@ class PDBAlbumMixin:
album_ids = sqlhelpers.listify(a.id for a in albums) album_ids = sqlhelpers.listify(a.id for a in albums)
query += f' AND albumid IN {album_ids}' query += f' AND albumid IN {album_ids}'
self.sql_execute(query) self.sql_execute(query)
yield from directories
@decorators.transaction @decorators.transaction
def purge_empty_albums(self, albums=None): def purge_empty_albums(self, albums=None):
@ -138,6 +139,7 @@ class PDBAlbumMixin:
# This may have been the last child of an otherwise empty parent. # This may have been the last child of an otherwise empty parent.
to_check.update(album.get_parents()) to_check.update(album.get_parents())
album.delete() album.delete()
yield album
#################################################################################################### ####################################################################################################
@ -535,6 +537,7 @@ class PDBPhotoMixin:
if photo.real_path.exists: if photo.real_path.exists:
continue continue
photo.delete() photo.delete()
yield photo
def search( def search(
self, self,