From a6c6c0dfcc0483b181c558354f57cd3077c7a8bd Mon Sep 17 00:00:00 2001 From: aj Date: Sun, 23 Aug 2020 18:27:02 +0100 Subject: [PATCH] added run playlist button --- music-tools.py | 15 +++++++++++++++ music-tools.pyui | 32 +++++++++++++++++++++++++++++--- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/music-tools.py b/music-tools.py index 77771b9..b240824 100644 --- a/music-tools.py +++ b/music-tools.py @@ -70,6 +70,21 @@ def do_view_tag(sender): webbrowser.open('jayson:///view?clipboard=true') else: 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__': v = ui.load_view() diff --git a/music-tools.pyui b/music-tools.pyui index 6ca79ad..699350c 100644 --- a/music-tools.pyui +++ b/music-tools.pyui @@ -64,6 +64,7 @@ "border_width" : 3, "alignment" : "center", "text" : "", + "text_color" : "RGBA(1.000000,1.000000,1.000000,1.000000)", "font_name" : "", "class" : "Label", "name" : "output_label", @@ -142,7 +143,32 @@ "name" : "view_tag", "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}}", @@ -150,9 +176,9 @@ "attributes" : { "name" : "Music Tools", "enabled" : true, - "border_color" : "RGBA(0.000000,0.000000,0.000000,1.000000)", - "background_color" : "RGBA(1.000000,1.000000,1.000000,1.000000)", + "background_color" : "RGBA(0.274510,0.274510,0.274510,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" : "" }, "selected" : false