mirror of
https://github.com/Syncplay/syncplay
synced 2025-02-18 12:06:51 +00:00
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 notimplemented = "not-implemented"
|
||||
local unknowncommand = "unknown-command"
|
||||
local unknownstream = "(Unknown Stream)"
|
||||
|
||||
local oldfilepath
|
||||
local oldinputstate
|
||||
@ -120,7 +121,7 @@ function detectchanges()
|
||||
newinputstate = "input"
|
||||
newfilepath = get_filepath()
|
||||
|
||||
if newfilepath ~= oldfilepath then
|
||||
if newfilepath ~= oldfilepath and get_filepath() ~= unknownstream then
|
||||
oldfilepath = newfilepath
|
||||
notificationbuffer = notificationbuffer .. "filepath-change"..notificationmarker..msgterminator
|
||||
end
|
||||
@ -245,7 +246,7 @@ function get_filepath ()
|
||||
if metas and metas["title"] and string.len(metas["title"]) > 0 then
|
||||
response = ":::(Stream: "..metas["title"]..")"
|
||||
else
|
||||
response = ":::(Stream)"
|
||||
response = unknownstream
|
||||
end
|
||||
end
|
||||
else
|
||||
@ -288,12 +289,12 @@ function get_duration ()
|
||||
|
||||
if input then
|
||||
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
|
||||
local i = 0
|
||||
repeat
|
||||
vlc.misc.mwait(vlc.misc.mdate() + durationdelay)
|
||||
response = vlc.input.item():duration()
|
||||
response = item:duration()
|
||||
i = i + 1
|
||||
until response > 0 or i > 5
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user