portable = True
repeat = True
next_song_start = datetime.datetime.now()
- playlist_index = 0
+ playlist_index = -1
playing = True
def __init__(self, *args, **kwargs):
if (not self.playing) or len(self.playlist) == 0:
return
if datetime.datetime.now() > self.next_song_start:
- song_data = self.playlist[self.playlist_index]
self.playlist_index += 1
if self.playlist_index == len(self.playlist):
self.playlist_index = 0
if not self.repeat:
self.playing = False
+ return
+ song_data = self.playlist[self.playlist_index]
self.next_song_start = datetime.datetime.now() +\
datetime.timedelta(seconds=song_data[1])
self.sound('MUSICPLAYER', song_data[0])
if command == 'HELP':
msg_lines += ['available commands:']
msg_lines += ['HELP – show this help']
- msg_lines += ['PLAY – toggle playback on/off']
+ msg_lines += ['ON/OFF – toggle playback on/off']
msg_lines += ['REWIND – return to start of playlist']
msg_lines += ['LIST – list programmed songs, durations']
msg_lines += ['SKIP – to skip to next song']
msg_lines += ['%s %s:%s – %s' % (selector, minutes, seconds, entry[0])]
i += 1
return msg_lines
- elif command == 'PLAY':
+ elif command == 'ON/OFF':
self.playing = False if self.playing else True
self.game.changed = True
if self.playing:
else:
return ['paused']
elif command == 'REWIND':
- self.playlist_index = 0
+ self.playlist_index = -1
self.next_song_start = datetime.datetime.now()
self.game.changed = True
return ['back at start of playlist']