forked from openlp/openlp
Hopefully fix the next button when things are on repeat.
This commit is contained in:
parent
ef4b69c50f
commit
e59e717480
@ -575,34 +575,26 @@ class AudioPlayer(QtCore.QObject):
|
||||
self.playlist.append(Phonon.MediaSource(filename))
|
||||
|
||||
def next(self):
|
||||
if not self.repeat and self.currentIndex + 1 == len(self.playlist):
|
||||
return
|
||||
isPlaying = self.mediaObject.state() == Phonon.PlayingState
|
||||
self.currentIndex += 1
|
||||
if self.repeat and self.currentIndex == len(self.playlist):
|
||||
self.currentIndex = 0
|
||||
self.mediaObject.clearQueue()
|
||||
self.mediaObject.clear()
|
||||
self.currentIndex += 1
|
||||
if len(self.playlist) <= self.currentIndex:
|
||||
if self.repeat:
|
||||
self.currentIndex = 0
|
||||
else:
|
||||
self.currentIndex = -1
|
||||
if self.currentIndex >= 0:
|
||||
self.mediaObject.enqueue(self.playlist[self.currentIndex])
|
||||
if isPlaying:
|
||||
self.mediaObject.play()
|
||||
self.mediaObject.enqueue(self.playlist[self.currentIndex])
|
||||
if isPlaying:
|
||||
self.mediaObject.play()
|
||||
|
||||
def goTo(self, index):
|
||||
isPlaying = self.mediaObject.state() == Phonon.PlayingState
|
||||
self.mediaObject.clearQueue()
|
||||
self.mediaObject.clear()
|
||||
self.currentIndex = index
|
||||
if len(self.playlist) <= self.currentIndex:
|
||||
if self.repeat:
|
||||
self.currentIndex = 0
|
||||
else:
|
||||
self.currentIndex = -1
|
||||
if self.currentIndex >= 0:
|
||||
self.mediaObject.enqueue(self.playlist[self.currentIndex])
|
||||
if isPlaying:
|
||||
self.mediaObject.play()
|
||||
self.mediaObject.enqueue(self.playlist[self.currentIndex])
|
||||
if isPlaying:
|
||||
self.mediaObject.play()
|
||||
|
||||
def connectSlot(self, signal, slot):
|
||||
QtCore.QObject.connect(self.mediaObject, signal, slot)
|
||||
|
Loading…
Reference in New Issue
Block a user