Code: Select all
def handle_command_play(self, song=None, pointer=None):
if song is not None and pointer is not None:
self.song = self.set_song(song=song)
self.playlist_pointer = pointer
self.player.set_media(self.song)
pause = 2
elif self.player.is_playing():
pause = 1
else:
pause = 0
if pause < 2:
self.player.set_pause(pause) # if pause is zero, resume -- if non-zero, pause
else:
self.player.play()
return self.player.is_playing()
Code: Select all
else:
print self.player.is_playing()
self.player.play()
print self.player.is_playing()
Any idea why this might be working backward for me? I'm looking at the source and it clearly says, "@return: 1 if the media player is playing, 0 otherwise \libvlc_return_bool."
EDIT: I should mention -- the media is playing and pausing just fine, the problem comes in that the return is what I use to change the play button image to the pause button image and that's working oddly. And, yes, I know the code doesn't have error-checking and is rough in some places -- this is an early draft proof-of-concept.