end of playlist fix
This commit is contained in:
parent
3a6aba9545
commit
fb03e8a67a
14
mumbleBot.py
14
mumbleBot.py
@ -125,6 +125,7 @@ class MumbleBot:
|
|||||||
parameter = ''
|
parameter = ''
|
||||||
if len(message) > 1:
|
if len(message) > 1:
|
||||||
parameter = message[1]
|
parameter = message[1]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -171,8 +172,10 @@ class MumbleBot:
|
|||||||
|
|
||||||
elif command == var.config.get('command', 'play_playlist') and parameter:
|
elif command == var.config.get('command', 'play_playlist') and parameter:
|
||||||
offset = 1
|
offset = 1
|
||||||
if len(message) > 2:
|
try:
|
||||||
offset = int(message[2])
|
offset = int(parameter.split(" ")[-1])
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
var.playlist.append(["playlist", parameter, user, var.config.getint('bot', 'max_track_playlist'), offset])
|
var.playlist.append(["playlist", parameter, user, var.config.getint('bot', 'max_track_playlist'), offset])
|
||||||
self.async_download_next()
|
self.async_download_next()
|
||||||
|
|
||||||
@ -364,6 +367,7 @@ class MumbleBot:
|
|||||||
path, title = self.download_music(url)
|
path, title = self.download_music(url)
|
||||||
var.current_music["path"] = path
|
var.current_music["path"] = path
|
||||||
|
|
||||||
|
if os.path.isfile(path):
|
||||||
audio = EasyID3(path)
|
audio = EasyID3(path)
|
||||||
if audio["title"]:
|
if audio["title"]:
|
||||||
title = audio["title"][0]
|
title = audio["title"][0]
|
||||||
@ -381,6 +385,12 @@ class MumbleBot:
|
|||||||
logging.debug(thumbnail_html)
|
logging.debug(thumbnail_html)
|
||||||
if var.config.getboolean('bot', 'announce_current_music'):
|
if var.config.getboolean('bot', 'announce_current_music'):
|
||||||
self.send_msg_channel(var.config.get('strings', 'now_playing') % (title, thumbnail_html))
|
self.send_msg_channel(var.config.get('strings', 'now_playing') % (title, thumbnail_html))
|
||||||
|
else:
|
||||||
|
if var.current_music["type"] == "playlist":
|
||||||
|
var.current_music['current_index'] = var.current_music['number_track_to_play']
|
||||||
|
if self.get_next():
|
||||||
|
self.launch_next()
|
||||||
|
self.async_download_next()
|
||||||
|
|
||||||
elif var.current_music["type"] == "file":
|
elif var.current_music["type"] == "file":
|
||||||
path = var.config.get('bot', 'music_folder') + var.current_music["path"]
|
path = var.config.get('bot', 'music_folder') + var.current_music["path"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user