Damn, spotify json broken :(

This commit is contained in:
Ben Arc 2021-05-10 20:29:26 +01:00
parent 2a4457afec
commit e726d752d8
2 changed files with 13 additions and 11 deletions

View file

@ -25,7 +25,7 @@
<p style="font-size: 22px">Pick a song</p>
<q-select
outlined
v-model="model"
v-model="playlist"
:options="playlists"
label="playlists"
></q-select>
@ -85,8 +85,9 @@
mixins: [windowMixin],
data() {
return {
currentPlaylist: JSON.parse('{{ firstPlaylist[0] | tojson }}'),
currentPlaylist: JSON.parse('{{ firstPlaylist | tojson }}'),
playlists: JSON.parse('{{ playlists | tojson }}'),
playlist: '',
heavyList: [],
queued: []
}
@ -98,7 +99,6 @@
this.queued[1] = this.currentPlaylist[5]
this.queued[2] = this.currentPlaylist[6]
this.queued[3] = this.currentPlaylist[7]
console.log(this.currentPlaylist)
}
})
</script>

View file

@ -108,6 +108,7 @@ async def api_delete_item(juke_id):
################JUKEBOX ENDPOINTS##################
######GET ACCESS TOKEN######
@jukebox_ext.route("/api/v1/jukebox/jb/<sp_id>/<sp_playlist>", methods=["GET"])
async def api_get_jukebox_songs(sp_id, sp_playlist):
@ -128,19 +129,19 @@ async def api_get_jukebox_songs(sp_id, sp_playlist):
return False
else:
return await api_get_jukebox_songs(sp_id, sp_playlist)
return r, HTTPStatus.OK
for item in r.json()["items"]:
tracks.append(
{
"id": item["track"]["id"],
"name": item["track"]["name"],
"album": item["track"]["album"]["name"],
"artist": item["track"]["artists"][0]["name"],
"image": item["track"]["album"]["images"][0]["url"],
"id": str(item["track"]["id"]),
"name": str(item["track"]["name"]),
"album": str(item["track"]["album"]["name"]),
"artist": str(item["track"]["artists"][0]["name"]),
"image": str(item["track"]["album"]["images"][0]["url"]),
}
)
except AssertionError:
something = None
print(jsonify(tracks))
return tracks, HTTPStatus.OK
@ -188,6 +189,7 @@ async def api_get_token(sp_id):
@jukebox_ext.route("/api/v1/jukebox/jb/<sp_id>/<sp_song>/", methods=["GET"])
async def api_get_jukebox_invoice(sp_id, sp_song):
jukebox = await get_jukebox(sp_id)
invoice = await create_invoice(wallet_id=jukebox.wallet,amount=jukebox.amount,memo="Jukebox " + jukebox.name)
invoice = await create_invoice(wallet_id=jukebox.wallet,amount=jukebox.price,memo=jukebox.title)
####new table needed to store payment hashes
return invoice, HTTPStatus.OK