<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
< status.xml: VLC media player web interface
< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
-< Copyright (C) 2005-2006 the VideoLAN team
+< Copyright (C) 2005-2009 the VideoLAN team
< $Id$
<
< Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
local command = _GET['command']
local id = tonumber(_GET['id'] or -1)
local val = _GET['val']
+local options = _GET['option']
+if type(options) ~= "table" then -- Deal with the 0 or 1 option case
+ options = { options }
+end
---vlc.msg.err("requests/status.xml got:","input: "..tostring(input),"command: "..tostring(command),"id: "..tostring(id),"val: "..tostring(val))
+---[[]] vlc.msg.err("requests/status.xml got:","input: "..tostring(input),"command: "..tostring(command),"id: "..tostring(id),"val: "..tostring(val))
local function stripslashes(s)
return string.gsub(s,"\\(%.)","%1")
local status = vlc.playlist.status()
if command == "in_play" then
- local options = {}
- for o in string.gmatch(input," :[^ ]*") do -- FIXME: options should be in seperate variables, not in the same string as the input.
- table.insert(options,string.sub(o,3))
+ --[[
+ vlc.msg.err( "<options>" )
+ for a,b in ipairs(options) do
+ vlc.msg.err(b)
end
+ vlc.msg.err( "</options>" )
+ --]]
vlc.playlist.add({{path=stripslashes(input),options=options}})
elseif command == "in_enqueue" then
- vlc.playlist.enqueue(stripslashes(input))
+ vlc.playlist.enqueue({{path=stripslashes(input),options=options}})
elseif command == "pl_play" then
- vlc.playlist.goto(id)
+ if id == -1 then
+ vlc.playlist.play()
+ else
+ vlc.playlist.goto(id)
+ end
elseif command == "pl_pause" then
- vlc.msg.err("FIXME: pl_pause implementation is ugly")
- common.hotkey("key-play-pause") -- gruik
+ vlc.playlist.pause()
elseif command == "pl_stop" then
vlc.playlist.stop()
elseif command == "pl_next" then
vlc.sd.add(val)
end
elseif command == "fullscreen" then
- vlc.fullscreen()
+ vlc.video.fullscreen()
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
local val = nil
local input = vlc.object.input()
+local item = vlc.input.item()
local playlist = vlc.object.playlist()
local vout = input and vlc.object.find(input,'vout','child')
?>
<root>
<volume><?vlc print(vlc.volume.get()) ?></volume>
- <length><?vlc if input then print(vlc.var.get(input,"length")) else print(0) end?></length>
- <time><?vlc if input then print(vlc.var.get(input,"time")) else print(0) end?></time>
+ <length><?vlc if input then print(math.floor(vlc.var.get(input,"length"))) else print(0) end?></length>
+ <time><?vlc if input then print(math.floor(vlc.var.get(input,"time"))) else print(0) end?></time>
<state><?vlc print(status) ?></state>
<position><?vlc if input then print(vlc.var.get(input,"position")) else print(0) end?></position>
<fullscreen><?vlc if vout then vlc.var.get(vout,"fullscreen") else print(0) end?></fullscreen>
<loop><?vlc print(vlc.var.get(playlist,"loop")) ?></loop>
<repeat><?vlc print(vlc.var.get(playlist,"repeat")) ?></repeat>
<information>
+ <category name="meta">
+ <?vlc
+ if item then
+ local metas = item:metas()
+ for k,v in pairs(metas) do
+ print("<info name='"..k.."'>"..vlc.strings.convert_xml_special_chars(v).."</info>")
+ end
+ end
+ ?>
+ </category>
<?vlc
- if input then
- local info = vlc.input_info()
+ if item then
+ local info = item:info()
for k, v in pairs(info) do
print("<category name='"..k.."'>")
for k2, v2 in pairs(v) do
- print("<info name='"..k2.."'>"..v2.."</info>")
+ print("<info name='"..k2.."'>"..vlc.strings.convert_xml_special_chars(v2).."</info>")
end
print("</category>")
end
</information>
<stats>
<?vlc
- if input then
- local stats = vlc.playlist.stats()
+ if item then
+ local stats = item:stats()
for k,v in pairs(stats) do
local tag = string.gsub(k,"_","")
print("<"..tag..">"..tostring(v).."</"..tag..">\n")