]> git.sesse.net Git - vlc/commitdiff
lua http interface: add clumsy current-detection in playlist.xml request
authorIlkka Ollakka <ileoo@videolan.org>
Sun, 28 Mar 2010 11:36:52 +0000 (14:36 +0300)
committerIlkka Ollakka <ileoo@videolan.org>
Sun, 28 Mar 2010 11:39:24 +0000 (14:39 +0300)
Not really nice looking or anything, but I'm not that familiar with lua.
Also not sure if comparing paths/uris is the way, didn't spot any way to
get same id from both of those (or missed something trivial).

share/lua/http/requests/playlist.xml

index 28101962545f31ee38903079fc090615a4b80b5e..8a17660d8eedd5c4e98f8a4929db903b58ba1caa 100644 (file)
@@ -38,7 +38,12 @@ function print_playlist(item)
     print("</node>")
   else
     local name, path = vlc.strings.convert_xml_special_chars(item.name or "",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).."'/>")
+    local currentItem = vlc.input.item().uri( vlc.input.item() )
+    local current = ""
+    if currentItem == path then
+       current="current='current'"
+    end
+    print("<leaf id='"..tostring(item.id).."' uri='"..path.."' name='"..name.."' ro='"..(item.flags.ro and "ro" or "rw").."' duration='"..tostring(item.duration).."' "..current.." />")
   end
 end
 function a(t,pre)