misc.configdir(): Get the user's VLC config directory.
misc.cachedir(): Get the user's VLC cache directory.
-misc.datadir_list( name ): FIXME: write description ... or ditch function if it isn't usefull anymore, we have datadir and userdatadir :)
+misc.datadir_list( name ): FIXME: write description ... or ditch function
+ if it isn't usefull anymore, we have datadir and userdatadir :)
misc.mdate(): Get the current date (in milliseconds).
misc.mwait(): Wait for the given date (in milliseconds).
net.close( fd ): Close file descriptor.
net.send( fd, string, [length] ): Send data on fd.
net.recv( fd, [max length] ): Receive data from fd.
-net.select( nfds, fds_read, fds_write, timeout ): Monitor a bunch of file descriptors. Returns number of fds to handle and the amount of time not slept. See "man select".
+net.select( nfds, fds_read, fds_write, timeout ): Monitor a bunch of file
+ descriptors. Returns number of fds to handle and the amount of time not
+ slept. See "man select".
net.fd_set_new(): Create a new fd_set.
local fds = vlc.net.fd_set_new()
fds:clr( fd ) -- remove fd from set
Volume
------
volume.set( level ): Set volume to an absolute level between 0 and 1024.
+ 256 is 100%.
volume.get(): Get volume.
volume.up( [n] ): Increment volume by n steps of 32. n defaults to 1.
volume.down( [n] ): Decrement volume by n steps of 32. n defaults to 1.
--[==========================================================================[
rc.lua: remote control module for VLC
--[==========================================================================[
- Copyright (C) 2007 the VideoLAN team
+ Copyright (C) 2007-2009 the VideoLAN team
$Id$
Authors: Antoine Cellerier <dionoea at videolan dot org>
end
end
list = list..")"
- if count ~= 0 then
+ if count ~= 0 and env.welcome then
env.welcome = env.welcome .. "\r\nWarning: "..count.." functions are still unimplemented "..list.."."
end
end
return vlcerr
end
+function call_object_command(cmd,client,arg)
+ local var, val = split_input(arg)
+ local ok, vlcmsg, vlcerr, vlcerrmsg = pcall( vlc.var.command, cmd, var, val )
+ if not ok then
+ client:append("Error in `"..cmd.." "..var.." "..val.."' ".. vlcmsg) -- when pcall fails the 2nd arg is the error message
+ end
+ if vlcmsg ~= "" then
+ client:append(vlcmsg)
+ end
+ return vlcerr
+end
+
--[[ Setup host ]]
require("host")
h = host.host()
client:switch_status(host.status.write)
if commands[cmd] then
call_command(cmd,client,arg)
+ elseif string.sub(cmd,0,1)=='@'
+ and call_object_command(string.sub(cmd,2,#cmd),client,arg) == 0 then
+ --
+ elseif client.type == host.client_type.stdio
+ and call_libvlc_command(cmd,client,arg) == 0 then
+ --
else
- if client.type == host.client_type.stdio
- and call_libvlc_command(cmd,client,arg) == 0 then
- else
- local choices = {}
- if client.env.autocompletion ~= 0 then
- for v,_ in common.pairs_sorted(commands) do
- if string.sub(v,0,#cmd)==cmd then
- table.insert(choices, v)
- end
+ local choices = {}
+ if client.env.autocompletion ~= 0 then
+ for v,_ in common.pairs_sorted(commands) do
+ if string.sub(v,0,#cmd)==cmd then
+ table.insert(choices, v)
end
end
- if #choices == 1 and client.env.autoalias ~= 0 then
- -- client:append("Aliasing to \""..choices[1].."\".")
- cmd = choices[1]
- call_command(cmd,client,arg)
- else
- client:append("Unknown command `"..cmd.."'. Type `help' for help.")
- if #choices ~= 0 then
- client:append("Possible choices are:")
- local cols = math.floor(client.env.width/(client.env.colwidth+1))
- local fmt = "%-"..client.env.colwidth.."s"
- for i = 1, #choices do
- choices[i] = string.format(fmt,choices[i])
- end
- for i = 1, #choices, cols do
- local j = i + cols - 1
- if j > #choices then j = #choices end
- client:append(" "..table.concat(choices," ",i,j))
- end
+ end
+ if #choices == 1 and client.env.autoalias ~= 0 then
+ -- client:append("Aliasing to \""..choices[1].."\".")
+ cmd = choices[1]
+ call_command(cmd,client,arg)
+ else
+ client:append("Unknown command `"..cmd.."'. Type `help' for help.")
+ if #choices ~= 0 then
+ client:append("Possible choices are:")
+ local cols = math.floor(client.env.width/(client.env.colwidth+1))
+ local fmt = "%-"..client.env.colwidth.."s"
+ for i = 1, #choices do
+ choices[i] = string.format(fmt,choices[i])
+ end
+ for i = 1, #choices, cols do
+ local j = i + cols - 1
+ if j > #choices then j = #choices end
+ client:append(" "..table.concat(choices," ",i,j))
end
end
end