Commit fd7f9a09 authored by Antoine Cellerier's avatar Antoine Cellerier

Add new common.volume(). Understands use of strings like "+10", "-10" or "10"...

Add new common.volume(). Understands use of strings like "+10", "-10" or "10" for relative or absolute volume changes. Fixes volume in http interface.
parent 8cce5134
...@@ -89,7 +89,7 @@ elseif command == "fullscreen" then ...@@ -89,7 +89,7 @@ elseif command == "fullscreen" then
elseif command == "snapshot" then elseif command == "snapshot" then
common.snapshot() common.snapshot()
elseif command == "volume" then elseif command == "volume" then
vlc.volume.set(tonumber(val)) common.volume(val)
elseif command == "seek" then elseif command == "seek" then
common.seek(val) common.seek(val)
elseif command == "key" then elseif command == "key" then
......
...@@ -85,3 +85,11 @@ function seek(value) ...@@ -85,3 +85,11 @@ function seek(value)
vlc.var.set(input,"time",tonumber(value)) vlc.var.set(input,"time",tonumber(value))
end end
end end
function volume(value)
if type(value)=="string" and string.sub(value,1,1) == "+" or string.sub(value,1,1) == "-" then
vlc.volume.set(vlc.volume.get()+tonumber(value))
else
vlc.volume.set(tostring(value))
end
end
...@@ -397,7 +397,7 @@ end ...@@ -397,7 +397,7 @@ end
function volume(name,client,value) function volume(name,client,value)
if value then if value then
vlc.volume.set(value) common.volume(value)
else else
client:append(tostring(vlc.volume.get())) client:append(tostring(vlc.volume.get()))
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment