diff --git a/configuration.default.ini b/configuration.default.ini
index f4723e6..d7dbea3 100644
--- a/configuration.default.ini
+++ b/configuration.default.ini
@@ -11,6 +11,8 @@ volume = 0.1
admin = User1;User2; # Allow user to kill the bot
music_folder = /home/azlux/botamusique/music_folder/
tmp_folder = /tmp/
+pip3_path = venv/bin/pip
+auto_update = True
# in MB, 0 for no cache, -1 for unlimited size
tmp_folder_max_size = 10
@@ -44,6 +46,7 @@ stop_and_getout = oust
joinme = joinme
queue = queue
repeat = repeat
+update = update
[radio]
ponyville = http://192.99.131.205:8000/stream.mp3
diff --git a/mumbleBot.py b/mumbleBot.py
index 0a2744d..9eb6723 100644
--- a/mumbleBot.py
+++ b/mumbleBot.py
@@ -26,7 +26,6 @@ from mutagen.easyid3 import EasyID3
class MumbleBot:
def __init__(self, args):
signal.signal(signal.SIGINT, self.ctrl_caught)
-
self.volume = var.config.getfloat('bot', 'volume')
self.channel = args.channel
var.current_music = {}
@@ -184,6 +183,23 @@ class MumbleBot:
else:
self.mumble.users[text.actor].send_message(var.config.get('strings', 'not_admin'))
+ elif command == var.config.get('command', 'update'):
+ if not self.is_admin(user):
+ self.mumble.users[text.actor].send_message("Starting the update")
+ tp = sp.check_output([var.config.get('bot', 'pip3_path'), 'install','--upgrade','youtube-dl']).decode()
+ msg=""
+ if "Requirement already up-to-date" in tp:
+ msg += "Youtube-dl is up-to-date"
+ else :
+ msg += "Update done : " + tp.split('Successfully installed')[1]
+ if 'Your branch is up-to-date' in sp.check_output(['/usr/bin/env','git','status']).decode():
+ msg += "
Botamusique is up-to-date"
+ else :
+ msg += "
Botamusique have available update"
+ self.mumble.users[text.actor].send_message(msg)
+ else:
+ self.mumble.users[text.actor].send_message(var.config.get('strings', 'not_admin'))
+
elif command == var.config.get('command', 'stop_and_getout'):
self.stop()
if self.channel: