Add shuffleId, radioId to artist results [search, get_artist, get_library_artists, get_library_subscriptions, get_library_upload_artists] (closes #153)
This commit is contained in:
parent
623f846e29
commit
1c664b6799
6 changed files with 28 additions and 25 deletions
|
|
@ -47,6 +47,7 @@ class Parser:
|
|||
|
||||
if resultType in ['artist']:
|
||||
search_result['artist'] = get_item_text(data, 0)
|
||||
parse_menu_playlists(data, search_result)
|
||||
|
||||
elif resultType in ['album']:
|
||||
search_result['title'] = get_item_text(data, 0)
|
||||
|
|
@ -114,28 +115,6 @@ class Parser:
|
|||
search_result['releaseDate'] = runs[2]
|
||||
search_result['resultType'] = 'album'
|
||||
|
||||
watch_menu = find_objects_by_key(nav(data, MENU_ITEMS), 'menuNavigationItemRenderer')
|
||||
for item in [_x['menuNavigationItemRenderer'] for _x in watch_menu]:
|
||||
icon = nav(item, ['icon', 'iconType'])
|
||||
if icon == 'MUSIC_SHUFFLE':
|
||||
watch_key = 'shuffleId'
|
||||
elif icon == 'MIX':
|
||||
watch_key = 'radioId'
|
||||
else:
|
||||
# ADD_TO_PLAYLIST
|
||||
# ALBUM
|
||||
# ARTIST
|
||||
# SHARE
|
||||
continue
|
||||
|
||||
watch_id = nav(item, ['navigationEndpoint', 'watchPlaylistEndpoint', 'playlistId'],
|
||||
True)
|
||||
if not watch_id:
|
||||
watch_id = nav(item, ['navigationEndpoint', 'watchEndpoint', 'playlistId'],
|
||||
True)
|
||||
if watch_id:
|
||||
search_result[watch_key] = watch_id
|
||||
|
||||
search_result['thumbnails'] = nav(data, THUMBNAILS)
|
||||
search_results.append(search_result)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue