Advance playlist on end of file in mpv
This commit is contained in:
parent
5c3982f313
commit
54cebbe00a
@ -500,6 +500,9 @@ class SyncplayClient(object):
|
|||||||
return True
|
return True
|
||||||
return self._globalPaused
|
return self._globalPaused
|
||||||
|
|
||||||
|
def eofReportedByPlayer(self, filepath):
|
||||||
|
self.playlist.eofReportedByPlayer(filepath)
|
||||||
|
|
||||||
def updateFile(self, filename, duration, path):
|
def updateFile(self, filename, duration, path):
|
||||||
self.lastUpdatedFileTime = time.time()
|
self.lastUpdatedFileTime = time.time()
|
||||||
newPath = ""
|
newPath = ""
|
||||||
@ -1963,6 +1966,11 @@ class SyncplayPlaylist():
|
|||||||
secondsSinceLastChange = time.time() - self._lastPlaylistIndexChange
|
secondsSinceLastChange = time.time() - self._lastPlaylistIndexChange
|
||||||
return secondsSinceLastChange > constants.PLAYLIST_LOAD_NEXT_FILE_TIME_FROM_END_THRESHOLD
|
return secondsSinceLastChange > constants.PLAYLIST_LOAD_NEXT_FILE_TIME_FROM_END_THRESHOLD
|
||||||
|
|
||||||
|
def eofReportedByPlayer(self, filepath):
|
||||||
|
if self.notJustChangedPlaylist():
|
||||||
|
self._ui.showDebugMessage("Advancing to next item in playlist due to media player EOF report: {}".format(filepath))
|
||||||
|
self.loadNextFileInPlaylist()
|
||||||
|
|
||||||
@needsSharedPlaylistsEnabled
|
@needsSharedPlaylistsEnabled
|
||||||
def loadNextFileInPlaylist(self):
|
def loadNextFileInPlaylist(self):
|
||||||
if self._notPlayingCurrentIndex():
|
if self._notPlayingCurrentIndex():
|
||||||
|
|||||||
@ -213,6 +213,9 @@ class MpvPlayer(BasePlayer):
|
|||||||
else:
|
else:
|
||||||
return self._position
|
return self._position
|
||||||
|
|
||||||
|
def eofDetected(self, path):
|
||||||
|
self._client.eofReportedByPlayer(path)
|
||||||
|
|
||||||
def _storePosition(self, value):
|
def _storePosition(self, value):
|
||||||
if value is None:
|
if value is None:
|
||||||
self._client.ui.showDebugMessage("NONE TYPE POSITION!")
|
self._client.ui.showDebugMessage("NONE TYPE POSITION!")
|
||||||
@ -420,6 +423,9 @@ class MpvPlayer(BasePlayer):
|
|||||||
|
|
||||||
def _handleUnknownLine(self, line):
|
def _handleUnknownLine(self, line):
|
||||||
self.mpvErrorCheck(line)
|
self.mpvErrorCheck(line)
|
||||||
|
if "<eof>" in line:
|
||||||
|
line = line[5:-6]
|
||||||
|
self.eofDetected(line)
|
||||||
|
|
||||||
if "<chat>" in line:
|
if "<chat>" in line:
|
||||||
line = line.replace(constants.MPV_INPUT_BACKSLASH_SUBSTITUTE_CHARACTER, "\\")
|
line = line.replace(constants.MPV_INPUT_BACKSLASH_SUBSTITUTE_CHARACTER, "\\")
|
||||||
|
|||||||
@ -295,6 +295,15 @@ end
|
|||||||
|
|
||||||
chat_timer=mp.add_periodic_timer(TICK_INTERVAL, chat_update)
|
chat_timer=mp.add_periodic_timer(TICK_INTERVAL, chat_update)
|
||||||
|
|
||||||
|
mp.observe_property('eof-reached', 'bool', function(e)
|
||||||
|
if mp.get_property_native("eof-reached") == true then
|
||||||
|
line = mp.get_property_native("path")
|
||||||
|
line = line.gsub(line,"\\", "\\\\")
|
||||||
|
mp.command('print-text "<eof>' .. line .. '</eof>"')
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
mp.register_script_message('chat', function(e)
|
mp.register_script_message('chat', function(e)
|
||||||
add_chat(e)
|
add_chat(e)
|
||||||
end)
|
end)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user