Skip to content

Commit

Permalink
Allow jumping to next/previous title in "play all" mode
Browse files Browse the repository at this point in the history
(EMCGeneralPlayerActions nextTitle/prevTitle on long KEY_CHANNELUP/..DOWN)
  • Loading branch information
Fischreiher committed Aug 24, 2017
1 parent 648f2ed commit bbfa6f7
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/EMCMediaCenter.py
Expand Up @@ -330,14 +330,27 @@ def __onShow(self):
if self.service and self.service.type != sidDVB:
self.realSeekLength = self.getSeekLength()

def evEOF(self, needToClose=False):
def evEOF(self, needToClose=False, prevTitle=False):
# see if there are more to play
print "EMC PLAYER evEOF", self.playall, self.playcount, self.playlist
if self.playall:
# Play All
try:
self.playcount = -1
self.playlist = [ self.playall.next() ]
# for being able to jump back in 'playall' mode, new titles are added to the playlist acting like a cache
# (the generator 'getNextService' cannot easily be made bidirectional, using os.walk)
if prevTitle:
if self.playcount > 0:
self.playcount -= 2
else:
self.playcount -= 1
else:
if self.playcount == -1:
self.playall.next()
elif (self.playcount + 1) == len(self.playlist):
self.playlist.append(self.playall.next())
if len(self.playlist) > 25:
del self.playlist[0]
self.playcount -= 1
except StopIteration:
self.playall = None
self.playlist = []
Expand Down Expand Up @@ -763,7 +776,7 @@ def nextTitle(self):
# InfoBarSeek
self.showAfterSeek()
else:
if len(self.playlist) > 1:
if (len(self.playlist) > 1) or self.playall:
self.evEOF(False)

def prevTitle(self):
Expand All @@ -773,7 +786,9 @@ def prevTitle(self):
# InfoBarSeek
self.showAfterSeek()
else:
if len(self.playlist) > 1:
if self.playall:
self.evEOF(False,True) # True=previous
elif len(self.playlist) > 1:
if self.playcount >= 1:
self.playcount -= 2
self.evEOF(False)
Expand Down

0 comments on commit bbfa6f7

Please sign in to comment.