From 5fd1f22345551e6ffdb56f73a7a5da42f722666f Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 3 May 2019 00:58:29 -0400 Subject: [PATCH 1/2] Added clear history and clear queue buttons - Updated bot version to v2.3.1 - Added clear history button to command history page - Added clear queue button to youtube queue page --- helpers/global_access.py | 2 +- helpers/templates/history.html | 4 ++++ helpers/templates/youtube.html | 4 ++++ helpers/web_handler.py | 15 +++++++++++++++ tests/test_config.py | 2 +- 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/helpers/global_access.py b/helpers/global_access.py index 4bf99b8d..b92b0d8b 100644 --- a/helpers/global_access.py +++ b/helpers/global_access.py @@ -7,7 +7,7 @@ class GlobalMods: # JJMumbleBot Data - version = "v2.3.0" + version = "v2.3.1" jjmumblebot = None # Whisper Target whisper_target = None diff --git a/helpers/templates/history.html b/helpers/templates/history.html index a82cfb7d..a299b356 100644 --- a/helpers/templates/history.html +++ b/helpers/templates/history.html @@ -54,6 +54,10 @@

Command History

+
+
+ +

{% if cmd_strings %} diff --git a/helpers/templates/youtube.html b/helpers/templates/youtube.html index 51fc3663..86b9e685 100644 --- a/helpers/templates/youtube.html +++ b/helpers/templates/youtube.html @@ -54,6 +54,10 @@

Youtube Queue

+
+
+ +

{% if cur_playing %} diff --git a/helpers/web_handler.py b/helpers/web_handler.py index 8beb070c..dad74b8d 100644 --- a/helpers/web_handler.py +++ b/helpers/web_handler.py @@ -2,6 +2,7 @@ from wtforms import Form, validators, StringField from helpers.global_access import GlobalMods as GM from plugins.youtube.youtube_helper import YoutubeHelper as YH +from plugins.youtube.youtube_helper import clear_queue import utils from shutil import copyfile from cheroot.wsgi import Server as WsgiServer, PathInfoDispatcher @@ -38,6 +39,20 @@ def cmd_history(): return render_template('history.html', cmd_strings=cmd_strings) +@web_app.route("/clear_history", methods=['GET', 'POST']) +def cmd_clear_history(): + GM.cmd_history.clear() + cmd_strings = list(GM.cmd_history.queue_storage) + return render_template('history.html', cmd_strings=cmd_strings) + + +@web_app.route("/clear_youtube", methods=['GET', 'POST']) +def cmd_clear_youtube(): + clear_queue() + cmd_strings = list(YH.queue_instance.queue_storage) + return render_template('youtube.html', cmd_strings=cmd_strings, cur_playing=YH.current_song_info) + + @web_app.route("/youtube", methods=['GET', 'POST']) def cmd_youtube(): cmd_strings = list(YH.queue_instance.queue_storage) diff --git a/tests/test_config.py b/tests/test_config.py index 858ec72a..27da0afb 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -13,7 +13,7 @@ def setUp(self): def test_version(self): bot_version = GM.version - self.assertEqual(bot_version, "v2.3.0") + self.assertEqual(bot_version, "v2.3.1") def test_server_ip(self): server_ip = GM.cfg['Connection_Settings']['ServerIP'] From 2921ac39ba7a7d6ca53d9d7a8edc0ebe60979ab5 Mon Sep 17 00:00:00 2001 From: Jason Date: Fri, 3 May 2019 01:05:19 -0400 Subject: [PATCH 2/2] Fixed html formatting --- helpers/templates/history.html | 4 +++- helpers/templates/youtube.html | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/helpers/templates/history.html b/helpers/templates/history.html index a299b356..3e75ac10 100644 --- a/helpers/templates/history.html +++ b/helpers/templates/history.html @@ -54,7 +54,9 @@

Command History

-
+ +
+
diff --git a/helpers/templates/youtube.html b/helpers/templates/youtube.html index 86b9e685..21c4b6db 100644 --- a/helpers/templates/youtube.html +++ b/helpers/templates/youtube.html @@ -54,7 +54,9 @@

Youtube Queue

-
+
+
+