get_album: add album and artists to tracks (closes #257)
This commit is contained in:
parent
2e8c09a430
commit
d046011b73
1 changed files with 39 additions and 29 deletions
|
|
@ -438,37 +438,44 @@ class BrowsingMixin:
|
||||||
Each track is in the following format::
|
Each track is in the following format::
|
||||||
|
|
||||||
{
|
{
|
||||||
"title": "Revival",
|
"title": "Revival",
|
||||||
"type": "Album",
|
"type": "Album",
|
||||||
"thumbnails": [],
|
"thumbnails": [],
|
||||||
"description": "Revival is the ninth studio album by American rapper Eminem. ...",
|
"description": "Revival is the...",
|
||||||
"artists": [{
|
"artists": [
|
||||||
"name": "Eminem",
|
{
|
||||||
"id": "UCedvOgsKFzcK3hA5taf3KoQ"
|
"name": "Eminem",
|
||||||
}],
|
"id": "UCedvOgsKFzcK3hA5taf3KoQ"
|
||||||
"year": "2017",
|
}
|
||||||
"trackCount": 19,
|
],
|
||||||
"duration": "1 hour, 17 minutes",
|
"year": "2017",
|
||||||
"duration_seconds": 4657,
|
"trackCount": 19,
|
||||||
"audioPlaylistId": "OLAK5uy_nMr9h2VlS-2PULNz3M3XVXQj_P3C2bqaY",
|
"duration": "1 hour, 17 minutes",
|
||||||
"tracks": [
|
"audioPlaylistId": "OLAK5uy_nMr9h2VlS-2PULNz3M3XVXQj_P3C2bqaY",
|
||||||
|
"tracks": [
|
||||||
|
{
|
||||||
|
"videoId": "iKLU7z_xdYQ",
|
||||||
|
"title": "Walk On Water (feat. Beyoncé)",
|
||||||
|
"artists": [
|
||||||
{
|
{
|
||||||
"videoId": "iKLU7z_xdYQ",
|
"name": "Eminem",
|
||||||
"title": "Walk On Water (feat. Beyoncé)",
|
"id": "UCedvOgsKFzcK3hA5taf3KoQ"
|
||||||
"artists": None,
|
|
||||||
"album": None,
|
|
||||||
"likeStatus": "INDIFFERENT",
|
|
||||||
"thumbnails": None,
|
|
||||||
"isAvailable": True,
|
|
||||||
"isExplicit": True,
|
|
||||||
"duration": "5:03",
|
|
||||||
"feedbackTokens":
|
|
||||||
{
|
|
||||||
"add": "AB9zfpJww...",
|
|
||||||
"remove": "AB9zfpI807..."
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"album": "Revival",
|
||||||
|
"likeStatus": "INDIFFERENT",
|
||||||
|
"thumbnails": null,
|
||||||
|
"isAvailable": true,
|
||||||
|
"isExplicit": true,
|
||||||
|
"duration": "5:03",
|
||||||
|
"duration_seconds": 303,
|
||||||
|
"feedbackTokens": {
|
||||||
|
"add": "AB9zfpK...",
|
||||||
|
"remove": "AB9zfpK..."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"duration_seconds": 4657
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
body = {'browseId': browseId}
|
body = {'browseId': browseId}
|
||||||
|
|
@ -478,6 +485,9 @@ class BrowsingMixin:
|
||||||
results = nav(response, SINGLE_COLUMN_TAB + SECTION_LIST_ITEM + MUSIC_SHELF)
|
results = nav(response, SINGLE_COLUMN_TAB + SECTION_LIST_ITEM + MUSIC_SHELF)
|
||||||
album['tracks'] = parse_playlist_items(results['contents'])
|
album['tracks'] = parse_playlist_items(results['contents'])
|
||||||
album['duration_seconds'] = sum_total_duration(album)
|
album['duration_seconds'] = sum_total_duration(album)
|
||||||
|
for i, track in enumerate(album['tracks']):
|
||||||
|
album['tracks'][i]['album'] = album['title']
|
||||||
|
album['tracks'][i]['artists'] = album['artists']
|
||||||
|
|
||||||
return album
|
return album
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue