Add 'loopSingleFiles' option to 'client_settings' (default: False)

This commit is contained in:
Et0h 2016-05-07 12:17:43 +01:00
parent f7b78557b1
commit 23f223e7ec
2 changed files with 14 additions and 2 deletions

View File

@ -463,6 +463,9 @@ class SyncplayClient(object):
def changeToPlaylistIndex(self, *args, **kwargs): def changeToPlaylistIndex(self, *args, **kwargs):
self.playlist.changeToPlaylistIndex(*args, **kwargs) self.playlist.changeToPlaylistIndex(*args, **kwargs)
def loopSingleFiles(self):
return self._config["loopSingleFiles"]
def isPlaylistLoopingEnabled(self): def isPlaylistLoopingEnabled(self):
return self._config["loopAtEndOfPlaylist"] return self._config["loopAtEndOfPlaylist"]
@ -1486,7 +1489,13 @@ class SyncplayPlaylist():
def loadNextFileInPlaylist(self): def loadNextFileInPlaylist(self):
if self._notPlayingCurrentIndex(): if self._notPlayingCurrentIndex():
return return
if self._thereIsNextPlaylistIndex():
if len(self._playlist) == 1 and self._client.loopSingleFiles():
self._client.rewindFile()
self._client.setPaused(False)
reactor.callLater(0.5, self._client.setPaused, False,)
elif self._thereIsNextPlaylistIndex():
self.switchToNewPlaylistIndex(self._nextPlaylistIndex(), resetPosition=True) self.switchToNewPlaylistIndex(self._nextPlaylistIndex(), resetPosition=True)
def _updateUndoPlaylistBuffer(self, newPlaylist, newRoom): def _updateUndoPlaylistBuffer(self, newPlaylist, newRoom):
@ -1512,7 +1521,7 @@ class SyncplayPlaylist():
def _thereIsNextPlaylistIndex(self): def _thereIsNextPlaylistIndex(self):
if self._playlistIndex is None: if self._playlistIndex is None:
return False return False
elif len(self._playlist) == 1: elif len(self._playlist) == 1 and not self._client.loopSingleFiles():
return False return False
elif self._playlistIsAtEnd(): elif self._playlistIsAtEnd():
return self._client.isPlaylistLoopingEnabled() return self._client.isPlaylistLoopingEnabled()

View File

@ -36,6 +36,7 @@ class ConfigurationGetter(object):
"mediaSearchDirectories": None, "mediaSearchDirectories": None,
"sharedPlaylistEnabled": True, "sharedPlaylistEnabled": True,
"loopAtEndOfPlaylist": False, "loopAtEndOfPlaylist": False,
"loopSingleFiles" : False,
"onlySwitchToTrustedURIs": False, "onlySwitchToTrustedURIs": False,
"trustedURIs": None, "trustedURIs": None,
"file": None, "file": None,
@ -109,6 +110,7 @@ class ConfigurationGetter(object):
"showDurationNotification", "showDurationNotification",
"sharedPlaylistEnabled", "sharedPlaylistEnabled",
"loopAtEndOfPlaylist", "loopAtEndOfPlaylist",
"loopSingleFiles",
"onlySwitchToTrustedURIs" "onlySwitchToTrustedURIs"
] ]
self._tristate = [ self._tristate = [
@ -141,6 +143,7 @@ class ConfigurationGetter(object):
"pauseOnLeave", "readyAtStart", "autoplayMinUsers", "pauseOnLeave", "readyAtStart", "autoplayMinUsers",
"autoplayInitialState", "mediaSearchDirectories", "autoplayInitialState", "mediaSearchDirectories",
"sharedPlaylistEnabled", "loopAtEndOfPlaylist", "sharedPlaylistEnabled", "loopAtEndOfPlaylist",
"loopSingleFiles",
"onlySwitchToTrustedURIs", "trustedURIs"], "onlySwitchToTrustedURIs", "trustedURIs"],
"gui": ["showOSD", "showOSDWarnings", "showSlowdownOSD", "gui": ["showOSD", "showOSDWarnings", "showSlowdownOSD",
"showDifferentRoomOSD", "showSameRoomOSD", "showDifferentRoomOSD", "showSameRoomOSD",