Add explicit method get_album_by_id.

This commit is contained in:
voussoir 2018-04-15 02:10:42 -07:00
parent 0094e7c006
commit 68d6e4faf4

View file

@ -37,7 +37,16 @@ class PDBAlbumMixin:
super().__init__() super().__init__()
self._album_cache = cacheclass.Cache() 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) return self.get_thing_by_id('album', id)
def get_album_by_path(self, filepath): def get_album_by_path(self, filepath):