mirror of
https://github.com/Syncplay/syncplay
synced 2025-02-21 21:46:49 +00:00
Future-proof mpv _getProperty
This commit is contained in:
parent
19a22b9105
commit
1bdea76397
@ -149,7 +149,7 @@ class MplayerPlayer(BasePlayer):
|
||||
def lineReceived(self, line):
|
||||
if line:
|
||||
self._client.ui.showDebugMessage("player << {}".format(line))
|
||||
if "Failed to get value of property" in line:
|
||||
if "Failed to get value of property" in line or "=(unavailable)" in line:
|
||||
if "filename" in line:
|
||||
self._getFilename()
|
||||
elif "length" in line:
|
||||
|
@ -101,6 +101,14 @@ class OldMpvPlayer(MpvPlayer):
|
||||
class NewMpvPlayer(OldMpvPlayer):
|
||||
lastResetTime = None
|
||||
|
||||
def _getProperty(self, property_):
|
||||
floatProperties = ['length','time-pos']
|
||||
if property_ in floatProperties:
|
||||
propertyID = u"={}".format(property_)
|
||||
else:
|
||||
propertyID = property_
|
||||
self._listener.sendLine(u"print_text ""ANS_{}=${{{}}}""".format(property_, propertyID))
|
||||
|
||||
def _storePosition(self, value):
|
||||
if self._recentlyReset():
|
||||
self._position = 0
|
||||
|
Loading…
Reference in New Issue
Block a user