From 8c74e42a74e52921bb487359e933fb862bccbb6c Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Fri, 26 Apr 2019 18:55:03 -0700 Subject: [PATCH] Add Album.has_any_associated_directory. --- etiquette/objects.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/etiquette/objects.py b/etiquette/objects.py index f1a30c4..e12f4e6 100644 --- a/etiquette/objects.py +++ b/etiquette/objects.py @@ -435,6 +435,16 @@ class Album(ObjectBase, GroupableMixin): photos = sorted(photos, key=lambda x: x.basename.lower()) return photos + def has_any_associated_directory(self): + ''' + Return True if this album has at least 1 associated directory. + ''' + row = self.photodb.sql_select_one( + 'SELECT 1 FROM album_associated_directories WHERE albumid == ?', + [self.id] + ) + return row is not None + def has_any_photo(self, recurse=False): ''' Return True if this album contains at least 1 photo.