From f2448cb450a6030999c095d7a0789c3da2701a3c Mon Sep 17 00:00:00 2001 From: Jason Date: Sat, 27 Apr 2019 16:19:46 -0400 Subject: [PATCH] Updated youtube plugin - Added help data for new commands - Modified autoplay command to work even if an audio thread isn't active --- plugins/youtube/youtube.py | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/plugins/youtube/youtube.py b/plugins/youtube/youtube.py index bd84c2bc..dd046134 100644 --- a/plugins/youtube/youtube.py +++ b/plugins/youtube/youtube.py @@ -14,7 +14,9 @@ class Plugin(PluginBase): help_data = "All commands can be run by typing it in the channel or privately messaging JJMumbleBot.
\ !youtube/!yt 'search_term': Searches youtube for a song/video.
\ !play/!p 'item_number' 'item_count'(optional): Plays the selected song from youtube.
\ - !link 'youtube_link': Plays the given youtube link.
\ + !autoplay: Toggles the youtube queue autoplay functionality
\ + !link 'youtube_link': Adds the given youtube link to the queue.
\ + !linkfront 'youtube_link': Priority inserts the given link to the front of the queue.
\ !stop: Stops the currently playing track and clears the queue.
\ !shuffle: Shuffles all the tracks in the queue.
\ !volume/!v '0..1': Sets the bot audio volume.
\ @@ -69,22 +71,21 @@ def process_command(self, text): elif command == "autoplay": if not pv.plugin_privilege_checker(text, command, self.priv_path): return - if YH.music_thread is not None: - if YH.autoplay: - YH.autoplay = False; - GM.gui.quick_gui( - "Autoplay has been disabled.", - text_type='header', - box_align='left') - GM.logger.info("Autoplay has been disabled in the youtube plugin.") - else: - YH.autoplay = True - GM.gui.quick_gui( - "Autoplay has been enabled.", - text_type='header', - box_align='left') - GM.logger.info("Autoplay has been enabled in the youtube plugin.") - return + if YH.autoplay: + YH.autoplay = False; + GM.gui.quick_gui( + "Autoplay has been disabled.", + text_type='header', + box_align='left') + GM.logger.info("Autoplay has been disabled in the youtube plugin.") + else: + YH.autoplay = True + GM.gui.quick_gui( + "Autoplay has been enabled.", + text_type='header', + box_align='left') + GM.logger.info("Autoplay has been enabled in the youtube plugin.") + return elif command == "shuffle": if not pv.plugin_privilege_checker(text, command, self.priv_path):