diff --git a/addon.py b/addon.py
index db43588..e338b3f 100644
--- a/addon.py
+++ b/addon.py
@@ -31,8 +31,9 @@ class Plugin(object):
self.username = addon.getSetting("username")
self.password = addon.getSetting("password")
- self.random_count = addon.getSetting("random_count")
- self.bitrate = addon.getSetting("bitrate")
+ self.random_count = int(addon.getSetting("random_count"))
+ self.album_list_size = int(addon.getSetting("album_list_size"))
+ self.bitrate = int(addon.getSetting("bitrate"))
self.transcode_format = addon.getSetting("transcode_format")
# Create connection
@@ -229,11 +230,12 @@ class Plugin(object):
Display album list by genre menu.
"""
+ size = self.album_list_size
genre = self.addon_args["foldername"][0].decode("utf-8")
xbmcplugin.setContent(self.addon_handle, "albums")
- for album in self.connection.walk_album_list_genre(genre):
+ for album in self.connection.walk_album_list('byGenre',size,None,None,genre):
self.add_album(album, show_artist=True)
xbmcplugin.endOfDirectory(self.addon_handle)
diff --git a/lib/libsonic_extra/__init__.py b/lib/libsonic_extra/__init__.py
index f46f0f6..cf29f09 100644
--- a/lib/libsonic_extra/__init__.py
+++ b/lib/libsonic_extra/__init__.py
@@ -391,16 +391,22 @@ class SubsonicClient(libsonic.Connection):
for genre in response["genres"]["genre"]:
yield genre
- def walk_album_list_genre(self, genre):
+ def walk_album_list(self, ltype, size=10, fromYear=None,toYear=None, genre=None):
"""
Request all albums for a given genre and iterate over each album.
"""
-
+
+ if ltype == 'byGenre' and genre is None:
+ return
+
+ if ltype == 'byYear' and (fromYear is None or toYear is None):
+ return
+
offset = 0
while True:
response = self.getAlbumList2(
- ltype="byGenre", genre=genre, size=500, offset=offset)
+ ltype=ltype, size=size, offset=offset, fromYear=fromYear, toYear=toYear, genre=genre)
if not response["albumList2"]["album"]:
break
@@ -408,7 +414,7 @@ class SubsonicClient(libsonic.Connection):
for album in response["albumList2"]["album"]:
yield album
- offset += 500
+ offset += size
def walk_album(self, album_id):
"""
diff --git a/resources/settings.xml b/resources/settings.xml
index 7263133..6f4f0fd 100644
--- a/resources/settings.xml
+++ b/resources/settings.xml
@@ -4,6 +4,7 @@
+