Add PDBAlbumMixin.get_root_albums to simplify elsewhere
This commit is contained in:
parent
97400a448b
commit
fd1673328f
2 changed files with 6 additions and 2 deletions
|
@ -272,6 +272,11 @@ class PDBAlbumMixin:
|
||||||
def get_albums(self):
|
def get_albums(self):
|
||||||
yield from self.get_things(thing_type='album')
|
yield from self.get_things(thing_type='album')
|
||||||
|
|
||||||
|
def get_root_albums(self):
|
||||||
|
for album in self.get_albums():
|
||||||
|
if album.parent() is None:
|
||||||
|
yield album
|
||||||
|
|
||||||
def new_album(
|
def new_album(
|
||||||
self,
|
self,
|
||||||
title=None,
|
title=None,
|
||||||
|
|
|
@ -351,8 +351,7 @@ def get_album_zip(albumid):
|
||||||
|
|
||||||
|
|
||||||
def get_albums_core():
|
def get_albums_core():
|
||||||
albums = P.get_albums()
|
albums = list(P.get_root_albums())
|
||||||
albums = [a for a in albums if a.parent() is None]
|
|
||||||
albums.sort(key=lambda x: x.display_name.lower())
|
albums.sort(key=lambda x: x.display_name.lower())
|
||||||
return albums
|
return albums
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue