Add method associated_directories.

This commit is contained in:
voussoir 2017-04-22 21:39:07 -07:00
parent ad9407ea82
commit 6ea3e67d86

View file

@ -262,6 +262,16 @@ class Album(ObjectBase, GroupableMixin):
self.photodb.log.debug('Committing - add tag to all') self.photodb.log.debug('Committing - add tag to all')
self.photodb.commit() self.photodb.commit()
def associated_directories(self):
cur = self.photodb.sql.cursor()
cur.execute(
'SELECT directory FROM album_associated_directories WHERE albumid == ?',
[self.id]
)
directories = [x[0] for x in cur.fetchall()]
directories = [pathclass.Path(x) for x in directories]
return directories
def delete(self, *, delete_children=False, commit=True): def delete(self, *, delete_children=False, commit=True):
self.photodb.log.debug('Deleting album {album:r}'.format(album=self)) self.photodb.log.debug('Deleting album {album:r}'.format(album=self))
GroupableMixin.delete(self, delete_children=delete_children, commit=False) GroupableMixin.delete(self, delete_children=delete_children, commit=False)