+
+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('<node id="' ..tostring(item.id).. '" name="' ..tostring(name).. '" ro="' ..(item.flags.ro and "ro" or "rw").. '">')
+ for _, child in ipairs(item.children) do
+ print_playlist(child)
+ end
+ print('</node>')
+ 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('<leaf id="' ..tostring(item.id).. '" uri="' ..tostring(path).. '" name="' ..name.. '" ro="' ..(item.flags.ro and "ro" or "rw").. '" duration ="' ..tostring(item.duration).. '" ' ..current.. ' />')
+ end
+end
+