lua intf: httprequests: fix current (fix #8314)
authorFrancois Cartegnie <fcvlcdev@free.fr>
Sat, 13 Apr 2013 13:04:15 +0000 (15:04 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Sat, 13 Apr 2013 13:52:46 +0000 (15:52 +0200)
Compare items ID, not paths which creates duplicates

share/lua/http/requests/playlist_jstree.xml
share/lua/intf/modules/httprequests.lua

index d8bbe02..bda87d6 100644 (file)
@@ -55,11 +55,11 @@ function print_playlist(item)
                end
     else
         local name, path = vlc.strings.convert_xml_special_chars(item.name or "", item.path or "")
-        local current_item = vlc.input.item()
+        local current_item_id = vlc.playlist.current()
         local current = ""
         -- Is the item the one currently played
-        if(current_item ~= nil) then
-            if(vlc.input.item().uri(current_item) == path) then
+        if(current_item_id ~= nil) then
+            if(current_item_id == item.id) then
                 current = 'current="current"'
             end
         end
@@ -82,4 +82,4 @@ end
 --a(p) --Uncomment to debug
 print_playlist(p)
 ?>
-</root>
\ No newline at end of file
+</root>
index d512227..e387d9b 100644 (file)
@@ -334,11 +334,11 @@ parseplaylist = function (item)
         local result={}
         local name, path = item.name or ""
         local path = item.path or ""
-        local current_item = vlc.input.item()
+        local current_item_id = vlc.playlist.current()
 
         -- Is the item the one currently played
-        if(current_item ~= nil) then
-            if(vlc.input.item().uri(current_item) == path) then
+        if(current_item_id ~= nil) then
+            if(current_item_id == item.id) then
                 result.current = "current"
             end
         end