From be8f61c0a5be99d861e7d71f0b4be8f897fecc21 Mon Sep 17 00:00:00 2001 From: Pierre Ynard Date: Fri, 2 Dec 2016 12:06:50 +0100 Subject: [PATCH] cli: use proper binding to get current stream length ... instead of the "length" object variable. Ref #17285 --- share/lua/intf/cli.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/share/lua/intf/cli.lua b/share/lua/intf/cli.lua index d848d32b20..6926025325 100644 --- a/share/lua/intf/cli.lua +++ b/share/lua/intf/cli.lua @@ -430,6 +430,15 @@ function get_title(name,client) end end +function get_length(name,client) + local item = vlc.input.item() + if item then + client:append(math.floor(item:duration())) + else + client:append("") + end +end + function ret_print(foo,start,stop) local start = start or "" local stop = stop or "" @@ -590,7 +599,7 @@ commands_ordered = { { "get_time"; { func = get_time("time"); help = "seconds elapsed since stream's beginning" } }; { "is_playing"; { func = is_playing; help = "1 if a stream plays, 0 otherwise" } }; { "get_title"; { func = get_title; help = "the title of the current stream" } }; - { "get_length"; { func = get_time("length"); help = "the length of the current stream" } }; + { "get_length"; { func = get_length; help = "the length of the current stream" } }; { "" }; { "volume"; { func = volume; args = "[X]"; help = "set/get audio volume" } }; { "volup"; { func = ret_print(vlc.volume.up,"( audio volume: "," )"); args = "[X]"; help = "raise audio volume X steps" } };