diff --git a/command.py b/command.py index b5f1e19..54b9e29 100644 --- a/command.py +++ b/command.py @@ -565,7 +565,11 @@ def cmd_help(bot, user, text, command, parameter): def cmd_stop(bot, user, text, command, parameter): global log - bot.stop() + if var.config.getboolean("bot", "clear_when_stop_in_oneshot", fallback=False) \ + and var.playlist.mode == 'one-shot': + cmd_clear(bot, user, text, command, parameter) + else: + bot.stop() bot.send_msg(constants.strings('stopped'), text) diff --git a/configuration.default.ini b/configuration.default.ini index b549c52..2b67106 100644 --- a/configuration.default.ini +++ b/configuration.default.ini @@ -34,6 +34,7 @@ volume = 0.1 # playback mode should be one of "one-shot", "loop", "random", "autoplay" playback_mode = one-shot autoplay_length = 5 +clear_when_stop_in_oneshot = False # target version, stable or testing (testing need to bot installed with git) target_version = stable diff --git a/configuration.example.ini b/configuration.example.ini index fd5d1d6..27b3343 100644 --- a/configuration.example.ini +++ b/configuration.example.ini @@ -33,8 +33,10 @@ port = 64738 # or "random" (randomize the playlist), "autoplay" (randomly grab something from the music library). # This option will be overridden by value in the database. # 'autoplay_length': how many songs the autoplay mode fills the playlist +# 'clear_when_stop_in_oneshot': clear the playlist when stop the bot in one-shot mode. #playback_mode = one-shot #autoplay_length = 5 +#clear_when_stop_in_oneshot = False # target version, stable or testing (testing need to bot installed with git) # stable will use simple bash with curl command to get releases, testing will follow github master branch with git commands diff --git a/interface.py b/interface.py index 9a34f73..a7426f8 100644 --- a/interface.py +++ b/interface.py @@ -334,7 +334,11 @@ def post(): var.cache.build_dir_cache(var.bot) log.info("web: Local file cache refreshed.") elif action == "stop": - var.bot.stop() + if var.config.getboolean("bot", "clear_when_stop_in_oneshot", fallback=False) \ + and var.playlist.mode == 'one-shot': + var.bot.clear() + else: + var.bot.stop() elif action == "pause": var.bot.pause() elif action == "resume":