Skip to content

Commit

Permalink
Added !sbplaying command to sound_board plugin
Browse files Browse the repository at this point in the history
- Added the !sbplaying command to the sound_board plugin so users can now see what the currently playing sound_board track is.
  • Loading branch information
DuckBoss committed Jun 9, 2020
1 parent 1b7bd0b commit 661db8a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions JJMumbleBot/plugins/extensions/sound_board/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<b>!sbvolume '0..1'</b>: Sets the sound board audio volume.<br>
<b>!sblist/!sbl</b>: Displays all the available sound board tracks in private messages.<br>
<b>!sblist_echo/!sble</b>: Displays all the available sound board tracks in the channel chat.<br>
<b>!sbplaying</b>: Displays the current sound board track and the duration of the clip.<br>
<b>!sbstop/!sbs</b>: Stops the currently playing sound board track.<br>
<b>!sbdownload 'youtube_url' 'file_name'</b>: Downloads a sound clip from a youtube link and adds it to the sound board.<br>
<b>!sbdelete 'file_name.wav'</b>: Deletes a clip from the sound board storage. Be sure to specify the .wav extension.
1 change: 1 addition & 0 deletions JJMumbleBot/plugins/extensions/sound_board/metadata.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ PluginCommands: [
"sbvolume",
"sblist",
"sblist_echo",
"sbplaying",
"sbstop",
"sbdownload",
"sbdelete",
Expand Down
1 change: 1 addition & 0 deletions JJMumbleBot/plugins/extensions/sound_board/privileges.csv
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sbvolume,3
sbrandom,3
sblist,2
sblist_echo,3
sbplaying,2
sbstop,2
sbdownload,3
sbdelete,3
14 changes: 13 additions & 1 deletion JJMumbleBot/plugins/extensions/sound_board/sound_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
from JJMumbleBot.plugins.extensions.sound_board.resources.strings import *
from JJMumbleBot.plugins.extensions.sound_board.utility import sound_board_utility as sbu
from JJMumbleBot.plugins.extensions.sound_board.utility import settings as sbu_settings
from JJMumbleBot.lib.utils.runtime_utils import get_bot_name
from JJMumbleBot.lib.utils import dir_utils
import os
import random
from datetime import datetime
from datetime import datetime, timedelta
from bs4 import BeautifulSoup


Expand Down Expand Up @@ -158,6 +159,17 @@ def process(self, text):
GS.gui_service.quick_gui(f"Deleted sound clip : {all_messages[1].strip()}", text_type='header',
box_align='left')

elif command == "sbplaying":
if not privileges.plugin_privilege_checker(text, command, self.plugin_name):
return
if GS.audio_dni[1] == self.metadata[C_PLUGIN_INFO][P_PLUGIN_NAME] and GS.audio_dni[0] is True:
track_duration = sbu.get_audio_length(sbu_settings.current_track)
rprint(f'{get_bot_name()}({self.plugin_name}) is playing: {sbu_settings.current_track} (duration: {str(timedelta(seconds = round(track_duration))) if track_duration > 0 else "Unavailable"})', origin=L_COMMAND)
GS.gui_service.quick_gui(
f'{get_bot_name()}({self.plugin_name}) is playing: {sbu_settings.current_track} (duration: {str(timedelta(seconds = round(track_duration))) if track_duration > 0 else "Unavailable"})',
text_type='header',
box_align='left')

elif command == "sbrandom":
if not privileges.plugin_privilege_checker(text, command, self.plugin_name):
return
Expand Down

0 comments on commit 661db8a

Please sign in to comment.