Add new common.volume(). Understands use of strings like "+10", "-10" or "10" for relative or absolute volume changes. Fixes volume in http interface.

This commit is contained in:
Antoine Cellerier 2009-12-21 23:24:30 +01:00
parent 8cce51341d
commit fd7f9a09f0
3 changed files with 10 additions and 2 deletions

View File

@ -89,7 +89,7 @@ elseif command == "fullscreen" then
elseif command == "snapshot" then
common.snapshot()
elseif command == "volume" then
vlc.volume.set(tonumber(val))
common.volume(val)
elseif command == "seek" then
common.seek(val)
elseif command == "key" then

View File

@ -85,3 +85,11 @@ function seek(value)
vlc.var.set(input,"time",tonumber(value))
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

View File

@ -397,7 +397,7 @@ end
function volume(name,client,value)
if value then
vlc.volume.set(value)
common.volume(value)
else
client:append(tostring(vlc.volume.get()))
end