[vlc-commits] commit: lua http interface: add clumsy current-detection in playlist. xml request (Ilkka Ollakka )

git at videolan.org git at videolan.org
Sun Mar 28 13:40:07 CEST 2010


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sun Mar 28 14:36:52 2010 +0300| [1b455e3637cec179c29d6f6d7a63857a007f9e1a] | committer: Ilkka Ollakka 

lua http interface: add clumsy current-detection in playlist.xml request

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).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1b455e3637cec179c29d6f6d7a63857a007f9e1a
---

 share/lua/http/requests/playlist.xml |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/share/lua/http/requests/playlist.xml b/share/lua/http/requests/playlist.xml
index 2810196..8a17660 100644
--- a/share/lua/http/requests/playlist.xml
+++ b/share/lua/http/requests/playlist.xml
@@ -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)



More information about the vlc-commits mailing list