Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 49 additions & 7 deletions syncplay/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ def __init__(self, playerClass, ui, config):
self.lastRewindTime = None
self.lastUpdatedFileTime = None
self.lastAdvanceTime = None
self.openedStrmSource = None
self.openedStrmResolvedPath = None
self.openedStrmSourceTime = None
self.fileOpenBeforeChangingPlaylistIndex = None
self.waitingToLoadNewfile = False
self.waitingToLoadNewfileSince = None
Expand Down Expand Up @@ -559,21 +562,53 @@ def eofReportedByPlayer(self):
self.ui.showDebugMessage("Fixing file duration to allow for playlist advancement")
self.userlist.currentUser.file["duration"] = self._playerPosition

def _isStrmPath(self, filePath):
if not filePath:
return False
return urlparse(filePath).path.lower().endswith(".strm")

def updateFile(self, filename, duration, path):
self.lastUpdatedFileTime = time.time()
newPath = ""
if utils.isURL(path):
filename = path
if not path:
return
try:
size = os.path.getsize(path)
except:
usingOpenedStrmSource = False
if self.openedStrmSource:
if self.openedStrmResolvedPath is None:
resolutionTimedOut = (
self.openedStrmSourceTime is None or
time.time() - self.openedStrmSourceTime > constants.STREAM_ADDITIONAL_IGNORE_TIME
)
if resolutionTimedOut:
self.openedStrmSource = None
self.openedStrmResolvedPath = None
self.openedStrmSourceTime = None
elif self._isStrmPath(path):
usingOpenedStrmSource = True
else:
self.openedStrmResolvedPath = path
usingOpenedStrmSource = True
elif path == self.openedStrmResolvedPath:
usingOpenedStrmSource = True
else:
self.openedStrmSource = None
self.openedStrmResolvedPath = None
self.openedStrmSourceTime = None
if usingOpenedStrmSource:
path = self.openedStrmSource
filename = path if utils.isURL(path) else os.path.basename(path)
size = 0
else:
if utils.isURL(path):
filename = path
try:
path = path.decode('utf-8')
size = os.path.getsize(path)
except:
size = 0
try:
path = path.decode('utf-8')
size = os.path.getsize(path)
except:
size = 0
if not utils.isURL(path) and os.path.exists(path):
self.fileSwitch.notifyUserIfFileNotInMediaDirectory(filename, path)
filename, size = self.__executePrivacySettings(filename, size)
Expand Down Expand Up @@ -656,6 +691,13 @@ def openFile(self, filePath, resetPosition=False, fromUser=False):
self.playlist.loadPlaylistFromFile(filePath, resetPosition)
return

self.openedStrmSource = None
self.openedStrmResolvedPath = None
self.openedStrmSourceTime = None
if self._isStrmPath(filePath):
self.openedStrmSource = filePath
self.openedStrmSourceTime = time.time()

self.playlist.openedFile()
self._player.openFile(filePath, resetPosition)
if resetPosition:
Expand Down
2 changes: 1 addition & 1 deletion syncplay/messages_en.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
"vlc-failed-connection": "Failed to connect to VLC. If you have not installed syncplay.lua and are using the latest verion of VLC then please refer to https://syncplay.pl/LUA/ for instructions. Syncplay and VLC 4 are not currently compatible, so either use VLC 3 or an alternative such as mpv.",
"vlc-failed-noscript": "VLC has reported that the syncplay.lua interface script has not been installed. Please refer to https://syncplay.pl/LUA/ for instructions.",
"vlc-failed-versioncheck": "This version of VLC is not supported by Syncplay.",
"vlc-initial-warning": 'VLC does not always provide accurate position information to Syncplay, especially for .mp4 and .avi files. If you experience problems with erroneous seeking then please try an alternative media player such as <a href="https://mpv.io/">mpv</a> (or <a href="https://github.com/stax76/mpv.net/">mpv.net</a> for Windows users).',
"vlc-initial-warning": 'VLC does not always provide accurate position information to Syncplay, especially for streams and .mp4 and .avi files. If you experience problems with erroneous seeking then please try an alternative media player such as <a href="https://mpv.io/">mpv</a> (or <a href="https://github.com/stax76/mpv.net/">mpv.net</a> for Windows users).',

"feature-sharedPlaylists": "shared playlists", # used for not-supported-by-server-error
"feature-chat": "chat", # used for not-supported-by-server-error
Expand Down