Add index to playlist and make play_set better

This commit is contained in:
Peder Bergebakken Sundt 2018-02-28 21:06:28 +01:00
parent 92fcac7689
commit 6b88676dc4

View File

@ -70,7 +70,7 @@ async def play_set(request, mpv_control):
if "play" not in request.args: if "play" not in request.args:
raise APIError("No query parameter \"play\" provided") raise APIError("No query parameter \"play\" provided")
success = await mpv_control \ success = await mpv_control \
.pause_set(request.args["play"][0] not in ["true", "1", True]) .pause_set(str(request.args["play"][0]).lower() not in ["true", "1"])
return locals() return locals()
@bp.get("/volume") @bp.get("/volume")
@ -125,6 +125,7 @@ async def noe(request, mpv_control):
async def playlist_get(request, mpv_control): async def playlist_get(request, mpv_control):
value = await mpv_control.playlist_get() value = await mpv_control.playlist_get()
for i, v in enumerate(value): for i, v in enumerate(value):
v["index"] = i
if "current" in v and v["current"] == True: if "current" in v and v["current"] == True:
v["playing"] = await mpv_control.pause_get() == False v["playing"] = await mpv_control.pause_get() == False
del i, v del i, v