Update duration for streams to fix playlist advancement (#334)
This commit is contained in:
parent
54cebbe00a
commit
9441d85d97
@ -131,7 +131,7 @@ COMMANDS_DELETE = ['delete', 'd', 'qd']
|
|||||||
MPC_MIN_VER = "1.6.4"
|
MPC_MIN_VER = "1.6.4"
|
||||||
MPC_BE_MIN_VER = "1.5.2.3123"
|
MPC_BE_MIN_VER = "1.5.2.3123"
|
||||||
VLC_MIN_VERSION = "2.2.1"
|
VLC_MIN_VERSION = "2.2.1"
|
||||||
VLC_INTERFACE_VERSION = "0.3.6"
|
VLC_INTERFACE_VERSION = "0.3.7"
|
||||||
VLC_LATENCY_ERROR_THRESHOLD = 2.0
|
VLC_LATENCY_ERROR_THRESHOLD = 2.0
|
||||||
MPV_UNRESPONSIVE_THRESHOLD = 60.0
|
MPV_UNRESPONSIVE_THRESHOLD = 60.0
|
||||||
CONTROLLED_ROOMS_MIN_VERSION = "1.3.0"
|
CONTROLLED_ROOMS_MIN_VERSION = "1.3.0"
|
||||||
@ -287,7 +287,7 @@ VLC_SLAVE_EXTRA_ARGS = getValueForOS({
|
|||||||
MPV_SUPERSEDE_IF_DUPLICATE_COMMANDS = ["set_property time-pos ", "loadfile "]
|
MPV_SUPERSEDE_IF_DUPLICATE_COMMANDS = ["set_property time-pos ", "loadfile "]
|
||||||
MPV_REMOVE_BOTH_IF_DUPLICATE_COMMANDS = ["cycle pause"]
|
MPV_REMOVE_BOTH_IF_DUPLICATE_COMMANDS = ["cycle pause"]
|
||||||
MPLAYER_ANSWER_REGEX = "^ANS_([a-zA-Z_-]+)=(.+)$|^(Exiting)\.\.\. \((.+)\)$"
|
MPLAYER_ANSWER_REGEX = "^ANS_([a-zA-Z_-]+)=(.+)$|^(Exiting)\.\.\. \((.+)\)$"
|
||||||
VLC_ANSWER_REGEX = r"(?:^(?P<command>[a-zA-Z_]+)(?:\: )?(?P<argument>.*))"
|
VLC_ANSWER_REGEX = r"(?:^(?P<command>[a-zA-Z_-]+)(?:\: )?(?P<argument>.*))"
|
||||||
UI_COMMAND_REGEX = r"^(?P<command>[^\ ]+)(?:\ (?P<parameter>.+))?"
|
UI_COMMAND_REGEX = r"^(?P<command>[^\ ]+)(?:\ (?P<parameter>.+))?"
|
||||||
UI_OFFSET_REGEX = r"^(?:o|offset)\ ?(?P<sign>[/+-])?(?P<time>\d{1,9}(?:[^\d\.](?:\d{1,9})){0,2}(?:\.(?:\d{1,3}))?)$"
|
UI_OFFSET_REGEX = r"^(?:o|offset)\ ?(?P<sign>[/+-])?(?P<time>\d{1,9}(?:[^\d\.](?:\d{1,9})){0,2}(?:\.(?:\d{1,3}))?)$"
|
||||||
UI_SEEK_REGEX = r"^(?:s|seek)?\ ?(?P<sign>[+-])?(?P<time>\d{1,4}(?:[^\d\.](?:\d{1,6})){0,2}(?:\.(?:\d{1,3}))?)$"
|
UI_SEEK_REGEX = r"^(?:s|seek)?\ ?(?P<sign>[+-])?(?P<time>\d{1,4}(?:[^\d\.](?:\d{1,6})){0,2}(?:\.(?:\d{1,3}))?)$"
|
||||||
|
|||||||
@ -297,7 +297,7 @@ class VlcPlayer(BasePlayer):
|
|||||||
# value = value.decode('utf-8')
|
# value = value.decode('utf-8')
|
||||||
self._filepath = value
|
self._filepath = value
|
||||||
self._pathAsk.set()
|
self._pathAsk.set()
|
||||||
elif name == "duration":
|
elif name == "duration" or name == "duration-change":
|
||||||
if value == "no-input":
|
if value == "no-input":
|
||||||
self._duration = 0
|
self._duration = 0
|
||||||
elif value == "invalid-32-bit-value":
|
elif value == "invalid-32-bit-value":
|
||||||
@ -306,6 +306,11 @@ class VlcPlayer(BasePlayer):
|
|||||||
else:
|
else:
|
||||||
self._duration = float(value.replace(",", "."))
|
self._duration = float(value.replace(",", "."))
|
||||||
self._durationAsk.set()
|
self._durationAsk.set()
|
||||||
|
if name == "duration-change":
|
||||||
|
self._filechanged = True
|
||||||
|
t = threading.Thread(target=self._onFileUpdate)
|
||||||
|
t.setDaemon(True)
|
||||||
|
t.start()
|
||||||
elif name == "playstate":
|
elif name == "playstate":
|
||||||
self._paused = bool(value != 'playing') if (value != "no-input" and self._filechanged == False) else self._client.getGlobalPaused()
|
self._paused = bool(value != 'playing') if (value != "no-input" and self._filechanged == False) else self._client.getGlobalPaused()
|
||||||
diff = time.time() - self._lastVLCPositionUpdate if self._lastVLCPositionUpdate else 0
|
diff = time.time() - self._lastVLCPositionUpdate if self._lastVLCPositionUpdate else 0
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
Principal author: Etoh
|
Principal author: Etoh
|
||||||
Other contributors: DerGenaue, jb, Pilotat
|
Other contributors: DerGenaue, jb, Pilotat
|
||||||
Project: https://syncplay.pl/
|
Project: https://syncplay.pl/
|
||||||
Version: 0.3.6
|
Version: 0.3.7
|
||||||
|
|
||||||
Note:
|
Note:
|
||||||
* This interface module is intended to be used in conjunction with Syncplay.
|
* This interface module is intended to be used in conjunction with Syncplay.
|
||||||
@ -78,7 +78,7 @@ Syncplay should install this automatically to your user folder.
|
|||||||
|
|
||||||
--]==========================================================================]
|
--]==========================================================================]
|
||||||
|
|
||||||
local connectorversion = "0.3.6"
|
local connectorversion = "0.3.7"
|
||||||
local vlcversion = vlc.misc.version()
|
local vlcversion = vlc.misc.version()
|
||||||
local vlcmajorversion = tonumber(vlcversion:sub(1,1)) -- get the major version of VLC
|
local vlcmajorversion = tonumber(vlcversion:sub(1,1)) -- get the major version of VLC
|
||||||
|
|
||||||
@ -114,6 +114,8 @@ local newfilepath
|
|||||||
local newinputstate
|
local newinputstate
|
||||||
local oldtitle = 0
|
local oldtitle = 0
|
||||||
local newtitle = 0
|
local newtitle = 0
|
||||||
|
local oldduration = 0
|
||||||
|
local newduration = 0
|
||||||
|
|
||||||
local channel1
|
local channel1
|
||||||
local channel2
|
local channel2
|
||||||
@ -179,6 +181,11 @@ function detectchanges()
|
|||||||
oldtitle = newtitle
|
oldtitle = newtitle
|
||||||
notificationbuffer = notificationbuffer .. "playstate"..msgseperator..tostring(get_play_state())..msgterminator
|
notificationbuffer = notificationbuffer .. "playstate"..msgseperator..tostring(get_play_state())..msgterminator
|
||||||
notificationbuffer = notificationbuffer .. "position"..msgseperator..tostring(get_time())..msgterminator
|
notificationbuffer = notificationbuffer .. "position"..msgseperator..tostring(get_time())..msgterminator
|
||||||
|
newduration = get_duration()
|
||||||
|
if oldduration ~= newduration then
|
||||||
|
oldduration = newduration
|
||||||
|
notificationbuffer = notificationbuffer .. "duration-change"..msgseperator..tostring(newduration)..msgterminator
|
||||||
|
end
|
||||||
else
|
else
|
||||||
notificationbuffer = notificationbuffer .. "playstate"..msgseperator..noinput..msgterminator
|
notificationbuffer = notificationbuffer .. "playstate"..msgseperator..noinput..msgterminator
|
||||||
notificationbuffer = notificationbuffer .. "position"..msgseperator..noinput..msgterminator
|
notificationbuffer = notificationbuffer .. "position"..msgseperator..noinput..msgterminator
|
||||||
@ -189,7 +196,6 @@ function detectchanges()
|
|||||||
oldinputstate = newinputstate
|
oldinputstate = newinputstate
|
||||||
notificationbuffer = notificationbuffer.."inputstate-change"..msgseperator..tostring(newinputstate)..msgterminator
|
notificationbuffer = notificationbuffer.."inputstate-change"..msgseperator..tostring(newinputstate)..msgterminator
|
||||||
end
|
end
|
||||||
|
|
||||||
return notificationbuffer
|
return notificationbuffer
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -406,7 +412,7 @@ function get_duration ()
|
|||||||
local i = 0
|
local i = 0
|
||||||
response = 0
|
response = 0
|
||||||
repeat
|
repeat
|
||||||
vlc.misc.mwait(vlc.misc.mdate() + durationdelay)
|
-- vlc.misc.mwait(vlc.misc.mdate() + durationdelay)
|
||||||
if item and item:duration() then
|
if item and item:duration() then
|
||||||
response = item:duration()
|
response = item:duration()
|
||||||
if response < 1 then
|
if response < 1 then
|
||||||
@ -420,7 +426,6 @@ function get_duration ()
|
|||||||
else
|
else
|
||||||
errormsg = noinput
|
errormsg = noinput
|
||||||
end
|
end
|
||||||
|
|
||||||
return response, errormsg
|
return response, errormsg
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -490,7 +495,10 @@ function do_command ( command, argument)
|
|||||||
|
|
||||||
if command == "get-interface-version" then response = "interface-version"..msgseperator..connectorversion..msgterminator
|
if command == "get-interface-version" then response = "interface-version"..msgseperator..connectorversion..msgterminator
|
||||||
elseif command == "get-vlc-version" then response = "vlc-version"..msgseperator..vlcversion..msgterminator
|
elseif command == "get-vlc-version" then response = "vlc-version"..msgseperator..vlcversion..msgterminator
|
||||||
elseif command == "get-duration" then response = "duration"..msgseperator..errormerge(get_duration())..msgterminator
|
elseif command == "get-duration" then
|
||||||
|
newduration = errormerge(get_duration())
|
||||||
|
response = "duration"..msgseperator..newduration..msgterminator
|
||||||
|
oldduration = newduration
|
||||||
elseif command == "get-filepath" then response = "filepath"..msgseperator..errormerge(get_filepath())..msgterminator
|
elseif command == "get-filepath" then response = "filepath"..msgseperator..errormerge(get_filepath())..msgterminator
|
||||||
elseif command == "get-filename" then response = "filename"..msgseperator..errormerge(get_filename())..msgterminator
|
elseif command == "get-filename" then response = "filename"..msgseperator..errormerge(get_filename())..msgterminator
|
||||||
elseif command == "get-title" then response = "title"..msgseperator..errormerge(get_var("title", 0))..msgterminator
|
elseif command == "get-title" then response = "title"..msgseperator..errormerge(get_var("title", 0))..msgterminator
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user