mirror of
https://github.com/ksyasuda/mpv-youtube-queue.git
synced 2024-10-28 04:44:11 -07:00
account for 0 based indexing in playlists
This commit is contained in:
parent
a77ad04f41
commit
1211d68dcb
@ -133,8 +133,8 @@ function YouTubeQueue.play_video_at(idx)
|
|||||||
end
|
end
|
||||||
index = idx
|
index = idx
|
||||||
current_video = video_queue[index]
|
current_video = video_queue[index]
|
||||||
mp.commandv("loadfile", current_video.url, "append-play")
|
mp.msg.log("info", "Playing video at index " .. index)
|
||||||
mp.set_property_number("playlist-pos", index)
|
mp.set_property_number("playlist-pos", index - 1) -- zero-based index
|
||||||
return current_video
|
return current_video
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -244,8 +244,7 @@ local function play_next_in_queue()
|
|||||||
local next_video_url = next_video.url
|
local next_video_url = next_video.url
|
||||||
print_video_name(next_video)
|
print_video_name(next_video)
|
||||||
if YouTubeQueue.size() > 1 then
|
if YouTubeQueue.size() > 1 then
|
||||||
mp.commandv("loadfile", next_video_url, "append-play")
|
mp.set_property_number("playlist-pos", YouTubeQueue.get_current_index() - 1)
|
||||||
mp.set_property_number("playlist-pos", YouTubeQueue.get_current_index())
|
|
||||||
else
|
else
|
||||||
mp.commandv("loadfile", next_video_url, "replace")
|
mp.commandv("loadfile", next_video_url, "replace")
|
||||||
end
|
end
|
||||||
@ -279,10 +278,8 @@ local function play_previous_video()
|
|||||||
mp.osd_message("No previous video available.")
|
mp.osd_message("No previous video available.")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local previous_video_url = previous_video.url
|
|
||||||
print_video_name(previous_video)
|
print_video_name(previous_video)
|
||||||
mp.commandv("loadfile", previous_video_url, "append-play")
|
mp.set_property_number("playlist-pos", YouTubeQueue.get_current_index() - 1)
|
||||||
mp.set_property_number("playlist-pos", YouTubeQueue.get_current_index())
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function open_url_in_browser(url)
|
local function open_url_in_browser(url)
|
||||||
|
Loading…
Reference in New Issue
Block a user