Commit 5192a05d authored by Francois Cartegnie's avatar Francois Cartegnie

lua intf: httprequests: fix current (fix #8314)

Compare items ID, not paths which creates duplicates
parent 2c122a47
...@@ -55,11 +55,11 @@ function print_playlist(item) ...@@ -55,11 +55,11 @@ function print_playlist(item)
end end
else else
local name, path = vlc.strings.convert_xml_special_chars(item.name or "", item.path or "") 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 = "" local current = ""
-- Is the item the one currently played -- Is the item the one currently played
if(current_item ~= nil) then if(current_item_id ~= nil) then
if(vlc.input.item().uri(current_item) == path) then if(current_item_id == item.id) then
current = 'current="current"' current = 'current="current"'
end end
end end
...@@ -82,4 +82,4 @@ end ...@@ -82,4 +82,4 @@ end
--a(p) --Uncomment to debug --a(p) --Uncomment to debug
print_playlist(p) print_playlist(p)
?> ?>
</root> </root>
\ No newline at end of file
...@@ -334,11 +334,11 @@ parseplaylist = function (item) ...@@ -334,11 +334,11 @@ parseplaylist = function (item)
local result={} local result={}
local name, path = item.name or "" local name, path = item.name or ""
local path = item.path 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 -- Is the item the one currently played
if(current_item ~= nil) then if(current_item_id ~= nil) then
if(vlc.input.item().uri(current_item) == path) then if(current_item_id == item.id) then
result.current = "current" result.current = "current"
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment