Always loop at tne of playlist + At EOF go to next playlist index, not next filename
This commit is contained in:
parent
8f0a22ee3b
commit
b7fff7e32c
@ -181,26 +181,43 @@ class SyncplayClient(object):
|
|||||||
|
|
||||||
@needsSharedPlaylistsEnabled
|
@needsSharedPlaylistsEnabled
|
||||||
def loadNextFileInPlaylist(self):
|
def loadNextFileInPlaylist(self):
|
||||||
if self._playlistIndex is None or len(self._playlist) <= self._playlistIndex+1:
|
if self._notPlayingCurrentIndex():
|
||||||
return
|
|
||||||
filename = self._playlist[self._playlistIndex+1]
|
|
||||||
if filename == "<LOOP>":
|
|
||||||
filename = self._playlist[0]
|
|
||||||
if utils.isURL(filename):
|
|
||||||
for URI in constants.SAFE_URIS:
|
|
||||||
if filename.startswith(URI):
|
|
||||||
self._player.openFile(filename, resetPosition=True)
|
|
||||||
return
|
|
||||||
self.ui.showErrorMessage(getMessage("cannot-add-unsafe-path-error").format(filename))
|
|
||||||
return
|
return
|
||||||
|
if self._thereIsNextPlaylistIndex():
|
||||||
|
self.switchToNewPlaylistIndex(self._nextPlaylistIndex(), resetPosition=True)
|
||||||
else:
|
else:
|
||||||
path = self.findFilenameInDirectories(filename)
|
self.rewindFile()
|
||||||
if path:
|
|
||||||
self._player.openFile(path, resetPosition=True)
|
def _notPlayingCurrentIndex(self):
|
||||||
else:
|
if self._playlistIndex is None or self._playlist is None or len(self._playlist) <= self._playlistIndex:
|
||||||
self.ui.showErrorMessage(getMessage("cannot-find-file-for-playlist-switch-error").format(filename))
|
self.ui.showDebugMessage(u"Not playing current index - Index none or length issue")
|
||||||
return
|
return True
|
||||||
# TODO: Find Path properly
|
currentPlaylistFilename = self._playlist[self._playlistIndex]
|
||||||
|
if self.userlist.currentUser.file and currentPlaylistFilename == self.userlist.currentUser.file['name']:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
self.ui.showDebugMessage(u"Not playing current index - Filename mismatch or no file")
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _thereIsNextPlaylistIndex(self):
|
||||||
|
if self._playlistIndex is None:
|
||||||
|
return False
|
||||||
|
elif len(self._playlist) == 1:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
|
def _nextPlaylistIndex(self):
|
||||||
|
if self.playlistIsAtEnd():
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
return self._playlistIndex+1
|
||||||
|
|
||||||
|
def playlistIsAtEnd(self):
|
||||||
|
return len(self._playlist) <= self._playlistIndex+1
|
||||||
|
|
||||||
|
def rewindFile(self):
|
||||||
|
self.setPosition(0)
|
||||||
|
|
||||||
def updatePlayerStatus(self, paused, position):
|
def updatePlayerStatus(self, paused, position):
|
||||||
position -= self.getUserOffset()
|
position -= self.getUserOffset()
|
||||||
@ -503,13 +520,13 @@ class SyncplayClient(object):
|
|||||||
|
|
||||||
|
|
||||||
@needsSharedPlaylistsEnabled
|
@needsSharedPlaylistsEnabled
|
||||||
def switchToNewPlaylistIndex(self, index):
|
def switchToNewPlaylistIndex(self, index, resetPosition=False):
|
||||||
try:
|
try:
|
||||||
filename = self._playlist[index]
|
filename = self._playlist[index]
|
||||||
if utils.isURL(filename):
|
if utils.isURL(filename):
|
||||||
for URI in constants.SAFE_URIS:
|
for URI in constants.SAFE_URIS:
|
||||||
if filename.startswith(URI):
|
if filename.startswith(URI):
|
||||||
self._player.openFile(filename)
|
self._player.openFile(filename, resetPosition=resetPosition)
|
||||||
return
|
return
|
||||||
self.ui.showErrorMessage(getMessage("cannot-add-unsafe-path-error").format(filename))
|
self.ui.showErrorMessage(getMessage("cannot-add-unsafe-path-error").format(filename))
|
||||||
return
|
return
|
||||||
@ -517,7 +534,7 @@ class SyncplayClient(object):
|
|||||||
path = self.findFilenameInDirectories(filename)
|
path = self.findFilenameInDirectories(filename)
|
||||||
# TODO: Find Path properly
|
# TODO: Find Path properly
|
||||||
if path:
|
if path:
|
||||||
self._player.openFile(path)
|
self._player.openFile(path, resetPosition)
|
||||||
else:
|
else:
|
||||||
self.ui.showErrorMessage(getMessage("cannot-find-file-for-playlist-switch-error").format(filename))
|
self.ui.showErrorMessage(getMessage("cannot-find-file-for-playlist-switch-error").format(filename))
|
||||||
return
|
return
|
||||||
|
|||||||
@ -19,6 +19,7 @@ FALLBACK_INITIAL_LANGUAGE = "en"
|
|||||||
FALLBACK_PUBLIC_SYNCPLAY_SERVERS = [[u'syncplay.pl:8995 (France)', u'syncplay.pl:8995'],[u'syncplay.pl:8996 (France)', u'syncplay.pl:8996'],[u'syncplay.pl:8997 (France)', u'syncplay.pl:8997'],[u'syncplay.pl:8998 (France)', u'syncplay.pl:8998'],[u'syncplay.pl:8999 (France)', u'syncplay.pl:8999']]
|
FALLBACK_PUBLIC_SYNCPLAY_SERVERS = [[u'syncplay.pl:8995 (France)', u'syncplay.pl:8995'],[u'syncplay.pl:8996 (France)', u'syncplay.pl:8996'],[u'syncplay.pl:8997 (France)', u'syncplay.pl:8997'],[u'syncplay.pl:8998 (France)', u'syncplay.pl:8998'],[u'syncplay.pl:8999 (France)', u'syncplay.pl:8999']]
|
||||||
PLAYLIST_LOAD_NEXT_FILE_MINIMUM_LENGTH = 10 # Seconds
|
PLAYLIST_LOAD_NEXT_FILE_MINIMUM_LENGTH = 10 # Seconds
|
||||||
PLAYLIST_LOAD_NEXT_FILE_TIME_FROM_END_THRESHOLD = 5 # Seconds (only triggered if file is paused, e.g. due to EOF)
|
PLAYLIST_LOAD_NEXT_FILE_TIME_FROM_END_THRESHOLD = 5 # Seconds (only triggered if file is paused, e.g. due to EOF)
|
||||||
|
PLAYLIST_LOOPS = True
|
||||||
|
|
||||||
#Overriden by config
|
#Overriden by config
|
||||||
SHOW_OSD = True # Sends Syncplay messages to media player OSD
|
SHOW_OSD = True # Sends Syncplay messages to media player OSD
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user