added run playlist button

This commit is contained in:
aj 2020-08-23 18:27:02 +01:00
parent 924e5912aa
commit a6c6c0dfcc
2 changed files with 44 additions and 3 deletions

View File

@ -71,6 +71,21 @@ def do_view_tag(sender):
else: else:
sender.superview['output_label'].text = f'Failed {res.status_code} {res.body}' sender.superview['output_label'].text = f'Failed {res.status_code} {res.body}'
@ui.in_background
def do_run_playlist(sender):
name = dialogs.input_alert(title="Playlist Name")
if name and len(name) > 0:
res = rsession.get("https://music.sarsoo.xyz/api/playlist/run",
params={"name": name}, auth=auth)
if 200 <= res.status_code < 300:
output = 'Success'
else:
output = f'Failed {res.status_code} {res.body}'
sender.superview['output_label'].text = output
if __name__ == '__main__': if __name__ == '__main__':
v = ui.load_view() v = ui.load_view()
v.present('sheet') v.present('sheet')

View File

@ -64,6 +64,7 @@
"border_width" : 3, "border_width" : 3,
"alignment" : "center", "alignment" : "center",
"text" : "", "text" : "",
"text_color" : "RGBA(1.000000,1.000000,1.000000,1.000000)",
"font_name" : "<System>", "font_name" : "<System>",
"class" : "Label", "class" : "Label",
"name" : "output_label", "name" : "output_label",
@ -142,7 +143,32 @@
"name" : "view_tag", "name" : "view_tag",
"font_size" : 15 "font_size" : 15
}, },
"selected" : true "selected" : false
},
{
"nodes" : [
],
"frame" : "{{6, 246}, {288, 32}}",
"class" : "Button",
"attributes" : {
"uuid" : "CA0E7F94-5A7F-4FE4-8BBE-E3A8249D899B",
"font_size" : 15,
"corner_radius" : 8,
"background_color" : "RGBA(0.439216,0.439216,0.439216,1.000000)",
"frame" : "{{106, 146}, {80, 32}}",
"border_color" : "RGBA(0.000000,0.000000,0.000000,1.000000)",
"border_width" : 3,
"tint_color" : "RGBA(1.000000,1.000000,1.000000,1.000000)",
"title" : "Run Playlist",
"action" : "do_run_playlist",
"alpha" : 1,
"font_bold" : false,
"class" : "Button",
"name" : "run_playlist",
"flex" : "W"
},
"selected" : false
} }
], ],
"frame" : "{{0, 0}, {300, 324}}", "frame" : "{{0, 0}, {300, 324}}",
@ -150,9 +176,9 @@
"attributes" : { "attributes" : {
"name" : "Music Tools", "name" : "Music Tools",
"enabled" : true, "enabled" : true,
"border_color" : "RGBA(0.000000,0.000000,0.000000,1.000000)", "background_color" : "RGBA(0.274510,0.274510,0.274510,1.000000)",
"background_color" : "RGBA(1.000000,1.000000,1.000000,1.000000)",
"tint_color" : "RGBA(0.000000,0.478000,1.000000,1.000000)", "tint_color" : "RGBA(0.000000,0.478000,1.000000,1.000000)",
"border_color" : "RGBA(0.000000,0.000000,0.000000,1.000000)",
"flex" : "" "flex" : ""
}, },
"selected" : false "selected" : false