add random albums vdir (#1)
Co-authored-by: Andrew Winkelman <atwinkelman@alaska.edu>
This commit is contained in:
parent
4bc641e95a
commit
e9fff5d8d5
2 changed files with 43 additions and 1 deletions
|
@ -15,6 +15,7 @@ class SubidyLibraryProvider(backend.LibraryProvider):
|
|||
dict(id="albums", name="Albums"),
|
||||
dict(id="rootdirs", name="Directories"),
|
||||
dict(id="random", name="Random"),
|
||||
dict(id="randomalbum", name="Random Albums"),
|
||||
]
|
||||
# Create a dict with the keys being the `id`s in `vdir_templates`
|
||||
# and the values being objects containing the vdir `id`,
|
||||
|
@ -56,6 +57,9 @@ class SubidyLibraryProvider(backend.LibraryProvider):
|
|||
def browse_random_songs(self):
|
||||
return self.subsonic_api.get_random_songs_as_refs()
|
||||
|
||||
def browse_random_albums(self):
|
||||
return self.subsonic_api.get_random_albums_as_refs()
|
||||
|
||||
def browse_diritems(self, directory_id):
|
||||
return self.subsonic_api.get_diritems_as_refs(directory_id)
|
||||
|
||||
|
@ -86,7 +90,7 @@ class SubidyLibraryProvider(backend.LibraryProvider):
|
|||
|
||||
def browse(self, browse_uri):
|
||||
if browse_uri == uri.get_vdir_uri("root"):
|
||||
root_vdir_names = ["rootdirs", "artists", "albums", "random"]
|
||||
root_vdir_names = ["rootdirs", "artists", "albums", "random", "randomalbum"]
|
||||
root_vdirs = [
|
||||
self._vdirs[vdir_name] for vdir_name in root_vdir_names
|
||||
]
|
||||
|
@ -102,6 +106,8 @@ class SubidyLibraryProvider(backend.LibraryProvider):
|
|||
return self.browse_albums()
|
||||
elif browse_uri == uri.get_vdir_uri("random"):
|
||||
return self.browse_random_songs()
|
||||
elif browse_uri == uri.get_vdir_uri("randomalbum"):
|
||||
return self.browse_random_albums()
|
||||
|
||||
else:
|
||||
uri_type = uri.get_type(browse_uri)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue