Skip to content

Commit

Permalink
fix load_queue command
Browse files Browse the repository at this point in the history
- fix parsing/conversion to table from json list
  • Loading branch information
ksyasuda committed Sep 9, 2024
1 parent 827eb80 commit 42d1f7f
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion mpv-youtube-queue.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 42d1f7f

Please sign in to comment.