From 6ea3e67d8687f0cc236147914be4d79f5167ac98 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 22 Apr 2017 21:39:07 -0700 Subject: [PATCH] Add method associated_directories. --- etiquette/objects.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/etiquette/objects.py b/etiquette/objects.py index b8ea05c..cb43cbb 100644 --- a/etiquette/objects.py +++ b/etiquette/objects.py @@ -262,6 +262,16 @@ class Album(ObjectBase, GroupableMixin): self.photodb.log.debug('Committing - add tag to all') 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): self.photodb.log.debug('Deleting album {album:r}'.format(album=self)) GroupableMixin.delete(self, delete_children=delete_children, commit=False)