refactor: changed all 'loop' into 'repeat', which is the term used in iTunes
This commit is contained in:
		@@ -611,7 +611,7 @@ def cmd_mode(bot, user, text, command, parameter):
 | 
			
		||||
    if not parameter:
 | 
			
		||||
        bot.send_msg(constants.strings("current_mode", mode=var.playlist.mode), text)
 | 
			
		||||
        return
 | 
			
		||||
    if not parameter in ["one-shot", "loop", "random"]:
 | 
			
		||||
    if not parameter in ["one-shot", "repeat", "random"]:
 | 
			
		||||
        bot.send_msg(constants.strings('unknown_mode', mode=parameter), text)
 | 
			
		||||
    else:
 | 
			
		||||
        var.db.set('playlist', 'playback_mode', parameter)
 | 
			
		||||
 
 | 
			
		||||
@@ -200,7 +200,7 @@ help = <h3>Commands</h3>
 | 
			
		||||
       <li> <b>!<u>sk</u>ip </b> - jump to the next song </li>
 | 
			
		||||
       <li> <b>!<u>v</u>olume </b> {volume} - get or change the volume (from 0 to 100) </li>
 | 
			
		||||
       <li> <b>!<u>m</u>ode </b> [{mode}] - get or set the playback mode, {mode} should be one of <i>one-shot</i> (play the playlist
 | 
			
		||||
       once), <i>loop</i> (looping through the playlist), <i>random</i> (randomize the playlist)</li>
 | 
			
		||||
       once), <i>repeat</i> (looping through the playlist), <i>random</i> (randomize the playlist)</li>
 | 
			
		||||
       <li> <b>!duck </b> on/off - enable or disable ducking function </li>
 | 
			
		||||
       <li> <b>!duckv </b> - set the volume of the bot when ducking is activated </li>
 | 
			
		||||
       <li> <b>!<u>duckt</u>hres </b> - set the threshold of volume to activate ducking (3000 by default) </li>
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,7 @@ port = 64738
 | 
			
		||||
#volume = 0.1
 | 
			
		||||
 | 
			
		||||
# 'playback_mode' defined the playback mode of the bot.
 | 
			
		||||
# it should be one of "one-shot" (play the playlist once), "loop" (looping through the playlist),
 | 
			
		||||
# it should be one of "one-shot" (play the playlist once), "repeat" (looping through the playlist),
 | 
			
		||||
# or "random" (randomize the playlist).
 | 
			
		||||
# This option will be overridden by value in the database.
 | 
			
		||||
#playback_mode = one-shot
 | 
			
		||||
 
 | 
			
		||||
@@ -268,8 +268,8 @@ def post():
 | 
			
		||||
                var.botamusique.resume()
 | 
			
		||||
            if action == "one-shot":
 | 
			
		||||
                var.playlist.set_mode("one-shot")
 | 
			
		||||
            if action == "loop":
 | 
			
		||||
                var.playlist.set_mode("loop")
 | 
			
		||||
            if action == "repeat":
 | 
			
		||||
                var.playlist.set_mode("repeat")
 | 
			
		||||
            elif action == "stop":
 | 
			
		||||
                var.botamusique.stop()
 | 
			
		||||
            elif action == "pause":
 | 
			
		||||
 
 | 
			
		||||
@@ -8,13 +8,13 @@ import logging
 | 
			
		||||
class PlayList(list):
 | 
			
		||||
    current_index = -1
 | 
			
		||||
    version = 0 # increase by one after each change
 | 
			
		||||
    mode = "one-shot" # "loop", "random"
 | 
			
		||||
    mode = "one-shot" # "repeat", "random"
 | 
			
		||||
 | 
			
		||||
    def __init__(self, *args):
 | 
			
		||||
        super().__init__(*args)
 | 
			
		||||
 | 
			
		||||
    def set_mode(self, mode):
 | 
			
		||||
        # modes are "one-shot", "loop", "random"
 | 
			
		||||
        # modes are "one-shot", "repeat", "random"
 | 
			
		||||
        self.mode = mode
 | 
			
		||||
        if mode == "random":
 | 
			
		||||
            self.randomize()
 | 
			
		||||
@@ -66,7 +66,7 @@ class PlayList(list):
 | 
			
		||||
            if self.mode == "one-shot":
 | 
			
		||||
                self.clear()
 | 
			
		||||
                return False
 | 
			
		||||
            elif self.mode == "loop":
 | 
			
		||||
            elif self.mode == "repeat":
 | 
			
		||||
                return self[0]
 | 
			
		||||
            elif self.mode == "random":
 | 
			
		||||
                self.randomize()
 | 
			
		||||
 
 | 
			
		||||
@@ -758,7 +758,7 @@ if __name__ == '__main__':
 | 
			
		||||
    else:
 | 
			
		||||
        playback_mode = var.config.get('bot', 'playback_mode', fallback="one-shot")
 | 
			
		||||
 | 
			
		||||
    if playback_mode in ["one-shot", "loop", "random"]:
 | 
			
		||||
    if playback_mode in ["one-shot", "repeat", "random"]:
 | 
			
		||||
        var.playlist.set_mode(playback_mode)
 | 
			
		||||
 | 
			
		||||
    if var.config.getboolean('bot', 'save_playlist', fallback=True):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user