fix load_queue command

- fix parsing/conversion to table from json list
This commit is contained in:
sudacode 2024-09-08 22:12:53 -07:00
parent 827eb80d6e
commit 42d1f7f7d6

View File

@ -315,7 +315,20 @@ function YouTubeQueue.load_queue()
style.error) style.error)
return false return false
else else
for i in result do YouTubeQueue.add_to_queue(i) end if result.status == 0 then
-- split urls based on commas
local urls = {}
-- Remove the brackets from json list
local l = result.stdout:sub(2, -3)
local item
for turl in l:gmatch('[^,]+') do
item = turl:match("^%s*(.-)%s*$"):gsub('"', "'")
table.insert(urls, item)
end
for _, turl in ipairs(urls) do
YouTubeQueue.add_to_queue(turl)
end
end
end end
end) end)
end end