1 <?xml version="1.0" encoding="utf-8" standalone="yes" ?<?vlc print '>'
4 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
5 < vlm.xml: VLC media player web interface
6 < - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
7 < Copyright (C) 2005-2006 the VideoLAN team
10 < Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
12 < This program is free software; you can redistribute it and/or modify
13 < it under the terms of the GNU General Public License as published by
14 < the Free Software Foundation; either version 2 of the License, or
15 < (at your option) any later version.
17 < This program is distributed in the hope that it will be useful,
18 < but WITHOUT ANY WARRANTY; without even the implied warranty of
19 < MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 < GNU General Public License for more details.
22 < You should have received a copy of the GNU General Public License
23 < along with this program; if not, write to the Free Software
24 < Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
25 < - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
28 local function insert_children(c,t)
31 for _, d in ipairs(c.children) do
32 table.insert(t,d.value or d.name)
34 print("V"..d.value.."|")
37 print("N"..d.name.."|")
42 local function print_table(name,t)
43 print("<"..name.."s>")
45 for _,v in ipairs(t) do
48 print("</"..name..">")
51 print("</"..name.."s>")
53 local function print_media(m)
55 local type_, enabled, loop, output
59 for _,c in ipairs(m.children) do
60 if c.name=="type" then
62 elseif c.name=="enabled" then
64 elseif c.name=="loop" then
66 elseif c.name=="output" then
68 elseif c.name=="inputs" then
69 insert_children(c,inputs)
70 elseif c.name=="options" then
71 insert_children(c,options)
72 elseif c.name=="instances" then
74 for _, d in ipairs(c.children) do
75 local instance = "<instance "
76 for _,e in ipairs(d.children) do
77 instance = instance .. e.name .. "=\"" .. e.value .. "\" "
79 instance = instance .. "/>"
80 table.insert(instances,instance)
85 print("<"..type_.." name=\""..name.."\" enabled=\""..enabled.."\" loop=\""..loop.."\">\n")
86 print("<output>"..output.."</output>\n")
87 print_table("input",inputs)
88 print_table("option",options)
90 if #instances ~= 0 then
91 print(table.concat(instances))
93 print "</instances>\n"
94 print("</"..type_..">\n")
97 local function print_schedule(m)
99 local enabled, date, period, repeat_ = "", "", "", ""
101 for _,c in ipairs(m.children) do
102 if c.name=="enabled" then
104 elseif c.name=="date" then
106 elseif c.name=="period" then
108 elseif c.name=="repeat" then
110 elseif c.name=="commands" then
111 insert_children(c,commands)
114 print("<schedule name=\""..name.."\" enabled=\""..enabled.."\" period=\""..period.."\" repeat=\""..repeat_.."\">\n")
115 print_table("command",commands)
116 print("</schedule>\n")
119 local function print_xml(m)
122 for _, c in ipairs(m.children) do
123 if c.name=="media" and c.children then
124 for _, d in ipairs(c.children) do
127 elseif c.name=="schedule" and c.children then
128 for _, d in ipairs(c.children) do
139 local function print_msg(m)
140 if not m then return end
141 print("<"..m.name..">\n")
143 for _, child in ipairs(m.children) do
149 print("</"..m.name..">\n")
152 local msg = vlm:execute_command("show")