From 78598e8280281e04a6b0d3946e3afe7fb74aca0b Mon Sep 17 00:00:00 2001 From: Etoh Date: Thu, 27 Jun 2013 16:40:29 +0100 Subject: [PATCH] syncplay.lua: don't send change notification until stream title is known --- resources/syncplay.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/resources/syncplay.lua b/resources/syncplay.lua index 445bf28..8e2535e 100644 --- a/resources/syncplay.lua +++ b/resources/syncplay.lua @@ -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