From 68d6e4faf46314c0f94a3fd99e4a562ebec59b03 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sun, 15 Apr 2018 02:10:42 -0700 Subject: [PATCH] Add explicit method get_album_by_id. --- etiquette/photodb.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/etiquette/photodb.py b/etiquette/photodb.py index e1aab98..c459f8b 100644 --- a/etiquette/photodb.py +++ b/etiquette/photodb.py @@ -37,7 +37,16 @@ class PDBAlbumMixin: super().__init__() self._album_cache = cacheclass.Cache() - def get_album(self, id): + def get_album(self, id=None, path=None): + if not helpers.is_xor(id, path): + raise exceptions.NotExclusive(['id', 'path']) + + if id is not None: + return self.get_album_by_id(id) + else: + return self.get_album_by_path(path) + + def get_album_by_id(self, id): return self.get_thing_by_id('album', id) def get_album_by_path(self, filepath):