Fix get_artist_singles year field (closes #163)
This commit is contained in:
parent
2857e22067
commit
a011491cfe
2 changed files with 7 additions and 3 deletions
|
|
@ -302,7 +302,7 @@ class BrowsingMixin:
|
|||
:param channelId: channel Id of the artist
|
||||
:param params: params obtained by :py:func:`get_artist`
|
||||
:return: List of albums in the format of :py:func:`get_library_albums`,
|
||||
except artist key is missing.
|
||||
except artists key is missing.
|
||||
|
||||
"""
|
||||
body = {"browseId": channelId, "params": params}
|
||||
|
|
|
|||
|
|
@ -29,11 +29,14 @@ def parse_albums(results):
|
|||
album = {}
|
||||
album['browseId'] = nav(data, TITLE + NAVIGATION_BROWSE_ID)
|
||||
album['title'] = nav(data, TITLE_TEXT)
|
||||
album['type'] = nav(data, SUBTITLE)
|
||||
album['thumbnails'] = nav(data, THUMBNAIL_RENDERER)
|
||||
album['artists'] = []
|
||||
run_count = len(data['subtitle']['runs'])
|
||||
has_artists = False
|
||||
if run_count == 1:
|
||||
album['year'] = nav(data, SUBTITLE)
|
||||
else:
|
||||
album['type'] = nav(data, SUBTITLE)
|
||||
|
||||
if run_count == 3:
|
||||
if nav(data, SUBTITLE2).isdigit():
|
||||
album['year'] = nav(data, SUBTITLE2)
|
||||
|
|
@ -46,6 +49,7 @@ def parse_albums(results):
|
|||
|
||||
if has_artists:
|
||||
subtitle = data['subtitle']['runs'][2]
|
||||
album['artists'] = []
|
||||
album['artists'].append({
|
||||
'name': subtitle['text'],
|
||||
'id': nav(subtitle, NAVIGATION_BROWSE_ID, True)
|
||||
|
|
|
|||
Loading…
Reference in a new issue