]> git.sesse.net Git - vlc/blob - share/http-lua/requests/playlist.xml
463f5d345a8cbf96de57f4864b7ea68b25dba28e
[vlc] / share / http-lua / requests / playlist.xml
1 <?xml version="1.0" encoding="utf-8" standalone="yes" ?<?vlc print'>'?>
2 <?vlc --[[
3 vim:syntax=lua
4 <!--  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
5 <  playlist.xml: VLC media player web interface
6 < - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
7 <  Copyright (C) 2005-2006 the VideoLAN team
8 <  $Id$
9
10 <  Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
11
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.
16
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.
21
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 < - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
26 ]] ?>
27
28 <?vlc
29 --[[<node id="0" name="Undefined" ro="ro">]]
30 function print_playlist(item)
31   if item.children then
32     local name = vlc.convert_xml_special_chars(item.name)
33     print("<node id=\""..tostring(item.id).."\" name=\""..name.."\" ro=\""..(item.flags.ro and "ro" or "rw").."\">")
34     for _, c in ipairs(item.children) do
35       print_playlist(c)
36     end
37     print("</node>")
38   else
39     local name, path = vlc.convert_xml_special_chars(item.name,item.path or "")
40     print("<leaf id='"..tostring(item.id).."' uri='"..path.."' name='"..name.."' ro='"..(item.flags.ro and "ro" or "rw").."' duration='"..tostring(item.duration).."'/>")
41   end
42 end
43 function a(t,pre)
44   local pre = pre or ""
45   for k,v in pairs(t) do
46     vlc.msg.err(pre..tostring(k).." : "..tostring(v))
47     if type(v) == "table" then
48       a(v,pre.."  ")
49     end
50   end
51 end
52 --[[
53 for cat,pl in pairs(p) do
54   print("<node id=\"-1\" name=\""..cat.."\" ro=\"ro\">")
55   print_playlist(pl)
56   print("</node>")
57 end
58 --]]
59 local p = vlc.playlist.get()
60 -- a(p) Uncomment to debug
61 print_playlist(p)
62 ?>
63
64 <?vlc --[[
65 </node>
66 <node id="9" name="Nevermind" ro="rw">
67 <leaf id="10" current="current" uri="file:///mnt/stuff/media/Nirvana/Nevermind/01 - Smells Like Teen Spirit.mp3" name="Smells Like Teen Spirit" ro="rw" duration="-1"/>
68 ]]?>