mirror of
https://github.com/gordielachance/plugin.audio.subsonic
synced 2025-02-16 19:50:56 +01:00
WIP : list_indexes function (not working yet)
This commit is contained in:
parent
d9210dcaef
commit
7d26333ce0
@ -296,12 +296,12 @@ class SubsonicClient(libsonic.Connection):
|
|||||||
else:
|
else:
|
||||||
return super(SubsonicClient, self)._doBinReq(*args, **kwargs)
|
return super(SubsonicClient, self)._doBinReq(*args, **kwargs)
|
||||||
|
|
||||||
def walk_index(self):
|
def walk_index(self, folder_id=None):
|
||||||
"""
|
"""
|
||||||
Request Subsonic's index and iterate each item.
|
Request Subsonic's index and iterate each item.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
response = self.getIndexes()
|
response = self.getIndexes(folder_id)
|
||||||
|
|
||||||
for index in response["indexes"]["index"]:
|
for index in response["indexes"]["index"]:
|
||||||
for index in index["artist"]:
|
for index in index["artist"]:
|
||||||
@ -334,6 +334,12 @@ class SubsonicClient(libsonic.Connection):
|
|||||||
|
|
||||||
for child in response["playlist"]["entry"]:
|
for child in response["playlist"]["entry"]:
|
||||||
yield child
|
yield child
|
||||||
|
|
||||||
|
def walk_folders(self):
|
||||||
|
response = self.getMusicFolders()
|
||||||
|
|
||||||
|
for child in response["musicFolders"]["musicFolder"]:
|
||||||
|
yield child
|
||||||
|
|
||||||
def walk_directory(self, directory_id):
|
def walk_directory(self, directory_id):
|
||||||
"""
|
"""
|
||||||
|
31
main.py
31
main.py
@ -805,6 +805,37 @@ def list_playlists(params):
|
|||||||
#content = None #string - current plugin content, e.g. ‘movies’ or ‘episodes’.
|
#content = None #string - current plugin content, e.g. ‘movies’ or ‘episodes’.
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@plugin.action()
|
||||||
|
def list_indexes(params):
|
||||||
|
# get connection
|
||||||
|
connection = get_connection()
|
||||||
|
|
||||||
|
if connection is False:
|
||||||
|
return
|
||||||
|
|
||||||
|
listing = []
|
||||||
|
|
||||||
|
# Get items
|
||||||
|
folder_id = params.get('folder_id')
|
||||||
|
items = connection.walk_index(folder_id)
|
||||||
|
|
||||||
|
plugin.log('list_indexes:')
|
||||||
|
# Iterate through items
|
||||||
|
for item in items:
|
||||||
|
entry = {
|
||||||
|
'label': item.get('name'),
|
||||||
|
'url': plugin.get_url(
|
||||||
|
action= 'list_albums',
|
||||||
|
artist_id= item.get('id'),
|
||||||
|
menu_id= params.get('menu_id')
|
||||||
|
)
|
||||||
|
}
|
||||||
|
listing.append(entry)
|
||||||
|
|
||||||
|
return plugin.create_listing(
|
||||||
|
listing
|
||||||
|
)
|
||||||
|
|
||||||
@plugin.action()
|
@plugin.action()
|
||||||
def list_folders(params):
|
def list_folders(params):
|
||||||
# get connection
|
# get connection
|
||||||
|
Loading…
x
Reference in New Issue
Block a user