Add Favorite Albums to Albums menu
This commit is contained in:
parent
4fffcd143e
commit
9e7f18d9f5
25
main.py
25
main.py
|
@ -168,6 +168,11 @@ def menu_albums(params):
|
||||||
'name': Addon().get_localized_string(30026),
|
'name': Addon().get_localized_string(30026),
|
||||||
'thumb': None,
|
'thumb': None,
|
||||||
'args': {"ltype": "random"}
|
'args': {"ltype": "random"}
|
||||||
|
},
|
||||||
|
'albums_favorites': {
|
||||||
|
'name': Addon().get_localized_string(30027),
|
||||||
|
'thumb': None,
|
||||||
|
'args': {"starred": True}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,7 +448,11 @@ def list_albums(params):
|
||||||
link_root = navigate_root()
|
link_root = navigate_root()
|
||||||
listing.append(link_root)
|
listing.append(link_root)
|
||||||
|
|
||||||
|
if 'starred' in query_args:
|
||||||
|
if len(items) == albums_per_page:
|
||||||
|
link_next = navigate_next(params)
|
||||||
|
listing.append(link_next)
|
||||||
|
else:
|
||||||
if not 'artist_id' in params:
|
if not 'artist_id' in params:
|
||||||
# Pagination if we've not reached the end of the lsit
|
# Pagination if we've not reached the end of the lsit
|
||||||
# if type(items) != type(True): TO FIX
|
# if type(items) != type(True): TO FIX
|
||||||
|
@ -1497,12 +1506,24 @@ def walk_genres():
|
||||||
except KeyError:
|
except KeyError:
|
||||||
yield from ()
|
yield from ()
|
||||||
|
|
||||||
def walk_albums(ltype, size=None, fromYear=None,toYear=None, genre=None, offset=None):
|
def walk_albums(ltype=None, size=None, fromYear=None,toYear=None, genre=None, offset=None, starred=None):
|
||||||
"""
|
"""
|
||||||
(ID3 tags)
|
(ID3 tags)
|
||||||
Request all albums for a given genre and iterate over each album.
|
Request all albums for a given genre and iterate over each album.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if starred:
|
||||||
|
response = connection.getStarred2()
|
||||||
|
if not response['starred2']['album']: return
|
||||||
|
albums = response['starred2']['album']
|
||||||
|
offset = 0 if not offset else offset
|
||||||
|
if offset >= len(albums): return
|
||||||
|
albums_per_page = int(Addon().get_setting('albums_per_page'))
|
||||||
|
upper = min(len(albums), offset + albums_per_page)
|
||||||
|
albums = albums[offset:upper]
|
||||||
|
for album in albums:
|
||||||
|
yield album
|
||||||
|
else:
|
||||||
if ltype == 'byGenre' and genre is None:
|
if ltype == 'byGenre' and genre is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -112,6 +112,10 @@ msgctxt "#30026"
|
||||||
msgid "Random albums"
|
msgid "Random albums"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgctxt "#30027"
|
||||||
|
msgid "Favorite albums"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#30029"
|
msgctxt "#30029"
|
||||||
msgid "Next page"
|
msgid "Next page"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
|
@ -112,6 +112,10 @@ msgctxt "#30026"
|
||||||
msgid "Random albums"
|
msgid "Random albums"
|
||||||
msgstr "Albums au hasard"
|
msgstr "Albums au hasard"
|
||||||
|
|
||||||
|
msgctxt "#30027"
|
||||||
|
msgid "Favorite albums"
|
||||||
|
msgstr "Albums préférés"
|
||||||
|
|
||||||
msgctxt "#30029"
|
msgctxt "#30029"
|
||||||
msgid "Next page"
|
msgid "Next page"
|
||||||
msgstr "Page suivante"
|
msgstr "Page suivante"
|
||||||
|
|
|
@ -112,6 +112,10 @@ msgctxt "#30026"
|
||||||
msgid "Random albums"
|
msgid "Random albums"
|
||||||
msgstr "Zufällige Alben"
|
msgstr "Zufällige Alben"
|
||||||
|
|
||||||
|
msgctxt "#30027"
|
||||||
|
msgid "Favorite Albums"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#30029"
|
msgctxt "#30029"
|
||||||
msgid "Next page"
|
msgid "Next page"
|
||||||
msgstr "Nächste Seite"
|
msgstr "Nächste Seite"
|
||||||
|
|
Loading…
Reference in New Issue