mirror of
https://github.com/ksyasuda/mpv-youtube-queue.git
synced 2024-11-22 03:19:54 -08:00
fix load_queue command
- fix parsing/conversion to table from json list
This commit is contained in:
parent
827eb80d6e
commit
42d1f7f7d6
@ -315,7 +315,20 @@ function YouTubeQueue.load_queue()
|
||||
style.error)
|
||||
return false
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user