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):
self.playlist.changeToPlaylistIndex(*args, **kwargs)
def loopSingleFiles(self):
return self._config["loopSingleFiles"]
def isPlaylistLoopingEnabled(self):
return self._config["loopAtEndOfPlaylist"]
@ -1486,7 +1489,13 @@ class SyncplayPlaylist():
def loadNextFileInPlaylist(self):
if self._notPlayingCurrentIndex():
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)
def _updateUndoPlaylistBuffer(self, newPlaylist, newRoom):
@ -1512,7 +1521,7 @@ class SyncplayPlaylist():
def _thereIsNextPlaylistIndex(self):
if self._playlistIndex is None:
return False
elif len(self._playlist) == 1:
elif len(self._playlist) == 1 and not self._client.loopSingleFiles():
return False
elif self._playlistIsAtEnd():
return self._client.isPlaylistLoopingEnabled()

View File

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