syncplay.lua: don't send change notification until stream title is known
This commit is contained in:
parent
b98b4e170f
commit
78598e8280
@ -90,6 +90,7 @@ local notificationmarker = "-notification"
|
|||||||
local noinput = "no-input"
|
local noinput = "no-input"
|
||||||
local notimplemented = "not-implemented"
|
local notimplemented = "not-implemented"
|
||||||
local unknowncommand = "unknown-command"
|
local unknowncommand = "unknown-command"
|
||||||
|
local unknownstream = "(Unknown Stream)"
|
||||||
|
|
||||||
local oldfilepath
|
local oldfilepath
|
||||||
local oldinputstate
|
local oldinputstate
|
||||||
@ -120,7 +121,7 @@ function detectchanges()
|
|||||||
newinputstate = "input"
|
newinputstate = "input"
|
||||||
newfilepath = get_filepath()
|
newfilepath = get_filepath()
|
||||||
|
|
||||||
if newfilepath ~= oldfilepath then
|
if newfilepath ~= oldfilepath and get_filepath() ~= unknownstream then
|
||||||
oldfilepath = newfilepath
|
oldfilepath = newfilepath
|
||||||
notificationbuffer = notificationbuffer .. "filepath-change"..notificationmarker..msgterminator
|
notificationbuffer = notificationbuffer .. "filepath-change"..notificationmarker..msgterminator
|
||||||
end
|
end
|
||||||
@ -245,7 +246,7 @@ function get_filepath ()
|
|||||||
if metas and metas["title"] and string.len(metas["title"]) > 0 then
|
if metas and metas["title"] and string.len(metas["title"]) > 0 then
|
||||||
response = ":::(Stream: "..metas["title"]..")"
|
response = ":::(Stream: "..metas["title"]..")"
|
||||||
else
|
else
|
||||||
response = ":::(Stream)"
|
response = unknownstream
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -288,12 +289,12 @@ function get_duration ()
|
|||||||
|
|
||||||
if input then
|
if input then
|
||||||
local item = vlc.input.item()
|
local item = vlc.input.item()
|
||||||
if item then
|
if (item and item:duration()) then
|
||||||
-- Try to get duration, which might not be available straight away
|
-- Try to get duration, which might not be available straight away
|
||||||
local i = 0
|
local i = 0
|
||||||
repeat
|
repeat
|
||||||
vlc.misc.mwait(vlc.misc.mdate() + durationdelay)
|
vlc.misc.mwait(vlc.misc.mdate() + durationdelay)
|
||||||
response = vlc.input.item():duration()
|
response = item:duration()
|
||||||
i = i + 1
|
i = i + 1
|
||||||
until response > 0 or i > 5
|
until response > 0 or i > 5
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user