From 7ff6d243f17340f7f080b0c007adbd3a86379b4a Mon Sep 17 00:00:00 2001 From: Rob Jonson Date: Sun, 25 Sep 2011 22:59:56 +0100 Subject: [PATCH] playlist.xml now draws it's data from the common model in httprequests.lua output data is the same for backwards compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémi Denis-Courmont --- share/lua/http/requests/playlist.xml | 102 +++++++++++++++------------ 1 file changed, 58 insertions(+), 44 deletions(-) diff --git a/share/lua/http/requests/playlist.xml b/share/lua/http/requests/playlist.xml index 23fdb64b95..745237f2c2 100644 --- a/share/lua/http/requests/playlist.xml +++ b/share/lua/http/requests/playlist.xml @@ -8,6 +8,7 @@ vim:syntax=lua < $Id$ < < Authors: Antoine Cellerier +< Authors: Rob Jonson < < 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 @@ -26,53 +27,66 @@ vim:syntax=lua ]] ?> ") end ---]] - -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 or "") - print('') - for _, child in ipairs(item.children) do - print_playlist(child) - end - print('') - else - local name, path = vlc.strings.convert_xml_special_chars(item.name or "", item.path or "") - local current_item = vlc.input.item() - local current = "" - -- Is the item the one currently played - if(current_item ~= nil) then - if(vlc.input.item().uri(current_item) == path) then - current = 'current="current"' - end - end - print('') + +local printnode = function(item) + local children=NULL + + print ("\n") + + 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 ("") + else + printleaf(item) + end + end ---a(p) --Uncomment to debug -print_playlist(p) -?> + +httprequests.processcommands() + +local pt=httprequests.playlisttable() + +printitem(pt) + + +?> \ No newline at end of file -- 2.39.2