home *** CD-ROM | disk | FTP | other *** search
/ mail.altrad.com / 2015.02.mail.altrad.com.tar / mail.altrad.com / TEST / vlc-2-0-5-win32.exe / lua / http / requests / playlist_jstree.xml < prev    next >
Extensible Markup Language  |  2012-12-12  |  3KB  |  85 lines

  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. <  Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
  10. <  This program is free software; you can redistribute it and/or modify
  11. <  it under the terms of the GNU General Public License as published by
  12. <  the Free Software Foundation; either version 2 of the License, or
  13. <  (at your option) any later version.
  14. <  This program is distributed in the hope that it will be useful,
  15. <  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. <  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. <  GNU General Public License for more details.
  18. <  You should have received a copy of the GNU General Public License
  19. <  along with this program; if not, write to the Free Software
  20. <  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  21. < - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  22. ]] ?>
  23. <root>
  24. <?vlc
  25. --[[
  26. function a(t,pre)
  27.   local pre = pre or ""
  28.   for k,v in pairs(t) do
  29.     vlc.msg.err(pre..tostring(k).." : "..tostring(v))
  30.     if type(v) == "table" then
  31.       a(v,pre.."  ")
  32.     end
  33.   end
  34. end
  35. --]]
  36.  
  37. function print_playlist(item)
  38.     if item.flags.disabled then return end
  39.     if(item.children) then
  40.         local name = vlc.strings.convert_xml_special_chars(item.name or "")
  41.         if(name ~= "Undefined") then
  42.             print('<item id="plid_' ..tostring(item.id).. '" name="' ..tostring(name).. '" ro="' ..(item.flags.ro and "ro" or "rw").. '"><content><name>' ..name.. '</name></content>')
  43.             for _, child in ipairs(item.children) do
  44.                 print_playlist(child)
  45.             end
  46.             print('</item>')
  47.         else
  48.             for _, child in ipairs(item.children) do
  49.                 print_playlist(child)
  50.             end
  51.         end
  52.     else
  53.         local name, path = vlc.strings.convert_xml_special_chars(item.name or "", item.path or "")
  54.         local current_item = vlc.input.item()
  55.         local current = ""
  56.         -- Is the item the one currently played
  57.         if(current_item ~= nil) then
  58.             if(vlc.input.item().uri(current_item) == path) then
  59.                 current = 'current="current"'
  60.             end
  61.         end
  62.         print('<item id="plid_' ..tostring(item.id).. '" uri="' ..tostring(path).. '" name="' ..name.. '" ro="' ..(item.flags.ro and "ro" or "rw").. '" duration ="' ..math.floor(item.duration).. '" ' ..current.. ' ><content><name>' ..name.. '</name></content></item>')
  63.     end
  64. end
  65.  
  66. local p
  67. if _GET["search"] then
  68.   if _GET["search"] ~= "" then
  69.     _G.search_key = _GET["search"]
  70.   else
  71.     _G.search_key = nil
  72.   end
  73.   local key = vlc.strings.decode_uri(_GET["search"])
  74.   p = vlc.playlist.search(key)
  75. else
  76.   p = vlc.playlist.get()
  77. end
  78. --a(p) --Uncomment to debug
  79. print_playlist(p)
  80. ?>
  81. </root>