home
·
contact
·
privacy
projects
/
plomrogue2
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
a2894e6
)
Overhaul MusicPlayer code.
author
Christian Heller
<c.heller@plomlompom.de>
Mon, 7 Dec 2020 02:48:42 +0000
(
03:48
+0100)
committer
Christian Heller
<c.heller@plomlompom.de>
Mon, 7 Dec 2020 02:48:42 +0000
(
03:48
+0100)
plomrogue/things.py
patch
|
blob
|
history
diff --git
a/plomrogue/things.py
b/plomrogue/things.py
index 720adc0ec64f0c432ec0f8e9ecbb3d5ecb29a413..c49b204f1c2e320036ab5cd19b4d2b330fec980c 100644
(file)
--- a/
plomrogue/things.py
+++ b/
plomrogue/things.py
@@
-170,7
+170,7
@@
class Thing_MusicPlayer(Thing):
portable = True
repeat = True
next_song_start = datetime.datetime.now()
portable = True
repeat = True
next_song_start = datetime.datetime.now()
- playlist_index =
0
+ playlist_index =
-1
playing = True
def __init__(self, *args, **kwargs):
playing = True
def __init__(self, *args, **kwargs):
@@
-182,12
+182,13
@@
class Thing_MusicPlayer(Thing):
if (not self.playing) or len(self.playlist) == 0:
return
if datetime.datetime.now() > self.next_song_start:
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
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])
self.next_song_start = datetime.datetime.now() +\
datetime.timedelta(seconds=song_data[1])
self.sound('MUSICPLAYER', song_data[0])
@@
-198,7
+199,7
@@
class Thing_MusicPlayer(Thing):
if command == 'HELP':
msg_lines += ['available commands:']
msg_lines += ['HELP – show this help']
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 += ['REWIND – return to start of playlist']
msg_lines += ['LIST – list programmed songs, durations']
msg_lines += ['SKIP – to skip to next song']
@@
-217,7
+218,7
@@
class Thing_MusicPlayer(Thing):
msg_lines += ['%s %s:%s – %s' % (selector, minutes, seconds, entry[0])]
i += 1
return msg_lines
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:
self.playing = False if self.playing else True
self.game.changed = True
if self.playing:
@@
-225,7
+226,7
@@
class Thing_MusicPlayer(Thing):
else:
return ['paused']
elif command == 'REWIND':
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']
self.next_song_start = datetime.datetime.now()
self.game.changed = True
return ['back at start of playlist']