< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
< Copyright (C) 2005-2006 the VideoLAN team
< $Id$
-<
+<
< Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
-<
+< Authors: Rob Jonson <rob -at- hobbyistsoftware -dot- com>
+<
< This program is free software; you can redistribute it and/or modify
< it under the terms of the GNU General Public License as published by
< the Free Software Foundation; either version 2 of the License, or
< (at your option) any later version.
-<
+<
< This program is distributed in the hope that it will be useful,
< but WITHOUT ANY WARRANTY; without even the implied warranty of
< MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
< GNU General Public License for more details.
-<
+<
< You should have received a copy of the GNU General Public License
< along with this program; if not, write to the Free Software
< Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
]] ?>
<?vlc
---[[<node id="0" name="Undefined" ro="ro">]]
-function print_playlist(item)
- if item.flags.disabled then return end
- if item.children then
- local name = vlc.strings.convert_xml_special_chars(item.name)
- print("<node id=\""..tostring(item.id).."\" name=\""..name.."\" ro=\""..(item.flags.ro and "ro" or "rw").."\">")
- for _, c in ipairs(item.children) do
- print_playlist(c)
+
+--package.loaded.httprequests = nil --uncomment to debug changes
+require "httprequests"
+
+local printleaf = function(item)
+ print ("\n<leaf")
+
+ for k,v in pairs(item) do
+
+ if (k~="type") then
+ print(" "..httprequests.xmlString(k).."=\""..httprequests.xmlString(v).."\"")
+ end
end
- print("</node>")
- else
- local name, path = vlc.strings.convert_xml_special_chars(item.name,item.path or "")
- print("<leaf id='"..tostring(item.id).."' uri='"..path.."' name='"..name.."' ro='"..(item.flags.ro and "ro" or "rw").."' duration='"..tostring(item.duration).."'/>")
- end
+
+ print ("/>")
end
-function a(t,pre)
- local pre = pre or ""
- for k,v in pairs(t) do
- vlc.msg.err(pre..tostring(k).." : "..tostring(v))
- if type(v) == "table" then
- a(v,pre.." ")
+
+local printnode = function(item)
+ local children=NULL
+
+ print ("\n<node")
+
+ for k,v in pairs(item) do
+
+ if (k=="type") then
+
+ elseif (k=="children") then
+ children=v._array
+ else
+ print(" "..httprequests.xmlString(k).."=\""..httprequests.xmlString(v).."\"")
+ end
end
- end
-end
---[[
-for cat,pl in pairs(p) do
- print("<node id=\"-1\" name=\""..cat.."\" ro=\"ro\">")
- print_playlist(pl)
- print("</node>")
+
+ print (">")
+
+ return children
end
---]]
-local p
-if _GET["search"] then
- if _GET["search"] ~= "" then
- _G.search_key = _GET["search"]
- else
- _G.search_key = nil
- end
- local key = vlc.strings.decode_uri(_GET["search"])
- p = vlc.playlist.search(key)
-else
- p = vlc.playlist.get()
+
+printitem = function(item)
+ local children=NULL
+
+ if item.type=="node" then
+ children=printnode(item)
+ if (children) then
+ for i,v in ipairs(children) do
+ printitem(v)
+ end
+ end
+ print ("</node>")
+ else
+ printleaf(item)
+ end
+
end
--- a(p) Uncomment to debug
-print_playlist(p)
-?>
-<?vlc --[[
-</node>
-<node id="9" name="Nevermind" ro="rw">
-<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"/>
-]]?>
+httprequests.processcommands()
+
+local pt=httprequests.playlisttable()
+
+printitem(pt)
+
+
+?>
\ No newline at end of file