mirror of
https://github.com/ksyasuda/mpv-youtube-queue.git
synced 2025-12-21 18:05:17 -08:00
Compare commits
13 Commits
ef5ceaa499
...
use-mpv-ut
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ff60b12e61 | ||
|
|
6ca5de8aa4 | ||
|
|
64bde58672 | ||
|
|
6e3d782081 | ||
|
|
cc8c677e0b | ||
|
|
a39a7c6a95 | ||
|
|
af81562606 | ||
|
|
8b4d2639e6 | ||
|
|
f5b5887616 | ||
|
|
33918e87d0 | ||
|
|
fd742b00cb | ||
|
|
5e038d212e | ||
| c67ac189b0 |
10
.github/workflows/luackeck.yml
vendored
Normal file
10
.github/workflows/luackeck.yml
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
name: Luacheck
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
sile:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Luacheck linter
|
||||
uses: lunarmodules/luacheck@v1
|
||||
46
README.md
46
README.md
@@ -1,7 +1,10 @@
|
||||
# mpv-youtube-queue
|
||||
|
||||
A Lua script for mpv that allows you to add YouTube videos to a queue,
|
||||
navigate through the queue, and select a video to play.
|
||||
<div align="center">
|
||||
|
||||
A Lua script that implements the YouTube 'Add to Queue' functionality for mpv
|
||||
|
||||
</div>
|
||||
|
||||

|
||||
|
||||
@@ -12,9 +15,9 @@ navigate through the queue, and select a video to play.
|
||||
- Select a video to play from the queue with an interactive menu,
|
||||
or navigate through the queue with keyboard shortcuts
|
||||
- Edit the order of videos in the queue
|
||||
- Open the URL of the currently playing video in a new browser tab
|
||||
- Open the channel page of the currently playing video
|
||||
- Open the URL or channel page of the currently playing video in a new browser tab
|
||||
- Download the currently playing video
|
||||
- Download a video in the queue
|
||||
|
||||
## Notes
|
||||
|
||||
@@ -44,33 +47,44 @@ This script requires the following software to be installed on the system
|
||||
|
||||
- `add_to_queue - ctrl+a`: Add a video in the clipboard to the queue
|
||||
- `download_current_video - ctrl+d`: Download the currently playing video
|
||||
- `move_cursor_down - ctrl+DOWN`:N - Move the cursor down one row in the queue
|
||||
- `move_cursor_up - ctrl+UP`- Move the cursor up one row in the queue
|
||||
- `download_selected_video - ctrl+D`: Download the currently selected video
|
||||
in the queue
|
||||
- `move_cursor_down - ctrl+j`: Move the cursor down one row in the queue
|
||||
- `move_cursor_up - ctrl+k`- Move the cursor up one row in the queue
|
||||
- `move_video - ctrl+m`: Mark/move the selected video in the queue
|
||||
- `play_next_in_queue - ctrl+n`: Play the next video in the queue
|
||||
- `open_video_in_browser - ctrl+o`: Open the currently playing video in the browser
|
||||
- `open_channel_in_browser - ctrl+O`: Open the channel page for the currently
|
||||
playing video in the browser
|
||||
- `open_video_in_browser - ctrl+o`: Open the currently playing video in the browser
|
||||
- `play_next_in_queue - ctrl+n`: Play the next video in the queue
|
||||
- `play_previous_in_queue - ctrl+p`: Play the previous video in the queue
|
||||
- `print_current_video - ctrl+P`: Print the name and channel of the currently
|
||||
playing video to the OSD
|
||||
- `print_queue - ctrl+q`: Print the contents of the queue to the OSD
|
||||
- `remove_from_queue - ctrl+x`: Remove the currently selected video from the
|
||||
queue
|
||||
- `play_selected_video - ctrl+ENTER`: Play the currently selected video in
|
||||
the queue
|
||||
|
||||
### Default Option
|
||||
|
||||
- `clipboard_command - xclip -o`: The command to use to get the contents of the clipboard
|
||||
- `browser - firefox`: The browser to use when opening a video or channel page
|
||||
- `clipboard_command - xclip -o`: The command to use to get the contents of the clipboard
|
||||
- `cursor_icon - ➤`: The icon to use for the cursor
|
||||
- `marked_icon - ⇅`: The icon to use to mark a video as ready to be moved in
|
||||
the queue
|
||||
- `download_directory ~/videos/YouTube`: The directory to use when downloading
|
||||
a video
|
||||
- `downloader - curl`: The name of the program to use to download the video
|
||||
- `display_limit - 6`: The maximum amount of videos to show on the OSD at once
|
||||
- `download_directory - ~/videos/YouTube`: The directory to use when
|
||||
downloading a video
|
||||
- `download_quality 720p`: The maximum download quality
|
||||
- `downloader - curl`: The name of the program to use to download the video
|
||||
- `font_name - JetBrains Mono`: The name of the font to use
|
||||
- `font_size - 12`: Size of the font
|
||||
- `display_limit - 6`: The maximum amount of videos to show on the OSD at once
|
||||
- `show_errors - no`: Show error messages on the OSD
|
||||
- `marked_icon - ⇅`: The icon to use to mark a video as ready to be moved in
|
||||
the queue
|
||||
- `show_errors - yes`: Show error messages on the OSD
|
||||
- `ytdlp_file_format - mp4`: The preferred file format for downloaded videos
|
||||
- `ytdlp_output_template - %(uploader)s/%(title)s.%(ext)s`: The [yt-dlp output
|
||||
template string](https://github.com/yt-dlp/yt-dlp#output-template)
|
||||
- Full path with the default `download_directory`
|
||||
is: `~/videos/YouTube/<uploader>/<title>.<ext>`
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -1,22 +1,27 @@
|
||||
add_to_queue=ctrl+a
|
||||
download_current_video=ctrl+d
|
||||
download_selected_video=ctrl+D
|
||||
move_cursor_down=ctrl+j
|
||||
move_cursor_up=ctrl+k
|
||||
move_video=ctrl+m
|
||||
play_next_in_queue=ctrl+n
|
||||
play_previous_in_queue=ctrl+p
|
||||
print_queue=ctrl+q
|
||||
move_cursor_up=ctrl+UP
|
||||
move_cursor_down=ctrl+DOWN
|
||||
play_selected_video=ctrl+ENTER
|
||||
open_video_in_browser=ctrl+o
|
||||
open_channel_in_browser=ctrl+O
|
||||
play_previous_in_queue=ctrl+p
|
||||
print_current_video=ctrl+P
|
||||
print_queue=ctrl+q
|
||||
remove_from_queue=ctrl+x
|
||||
play_selected_video=ctrl+ENTER
|
||||
browser=firefox
|
||||
clipboard_command=xclip -o
|
||||
display_limit=6
|
||||
cursor_icon=➤
|
||||
marked_icon=⇅
|
||||
font_size=12
|
||||
font_name=JetBrains Mono
|
||||
download_quality=720p
|
||||
display_limit=6
|
||||
download_directory=~/videos/YouTube
|
||||
download_format_str=%(uploader)s/%(title)s.%(ext)s
|
||||
download_quality=720p
|
||||
downloader=curl
|
||||
show_errors=no
|
||||
font_name=JetBrains Mono
|
||||
font_size=12
|
||||
marked_icon=⇅
|
||||
show_errors=yes
|
||||
ytdlp_file_format=mp4
|
||||
ytdlp_output_template=%(uploader)s/%(title)s.%(ext)s
|
||||
|
||||
@@ -15,41 +15,38 @@
|
||||
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
local mp = require 'mp'
|
||||
mp.options = require 'mp.options'
|
||||
local YouTubeQueue = {}
|
||||
local video_queue = {}
|
||||
local current_video = nil
|
||||
local index = 0
|
||||
local selected_index = 1
|
||||
local MSG_DURATION = 1.5
|
||||
local marked_index = nil
|
||||
local utils = require 'mp.utils'
|
||||
local styleOn = mp.get_property("osd-ass-cc/0")
|
||||
local styleOff = mp.get_property("osd-ass-cc/1")
|
||||
|
||||
local options = {
|
||||
add_to_queue = "ctrl+a",
|
||||
download_current_video = "ctrl+d",
|
||||
move_cursor_down = "ctrl+DOWN",
|
||||
move_cursor_up = "ctrl+UP",
|
||||
download_selected_video = "ctrl+D",
|
||||
move_cursor_down = "ctrl+j",
|
||||
move_cursor_up = "ctrl+k",
|
||||
move_video = "ctrl+m",
|
||||
open_channel_in_browser = "ctrl+O",
|
||||
open_video_in_browser = "ctrl+o",
|
||||
play_next_in_queue = "ctrl+n",
|
||||
open_video_in_browser = "ctrl+o",
|
||||
open_channel_in_browser = "ctrl+O",
|
||||
play_previous_in_queue = "ctrl+p",
|
||||
play_selected_video = "ctrl+ENTER",
|
||||
print_current_video = "ctrl+P",
|
||||
print_queue = "ctrl+q",
|
||||
clipboard_command = "xclip -o",
|
||||
remove_from_queue = "ctrl+x",
|
||||
play_selected_video = "ctrl+ENTER",
|
||||
browser = "firefox",
|
||||
clipboard_command = "xclip -o",
|
||||
cursor_icon = "➤",
|
||||
marked_icon = "⇅",
|
||||
display_limit = 6,
|
||||
download_directory = "~/videos/YouTube",
|
||||
download_format_str = "%(uploader)s/%(title)s.%(ext)s",
|
||||
downloader = "curl",
|
||||
download_quality = "720p",
|
||||
downloader = "curl",
|
||||
font_name = "JetBrains Mono",
|
||||
font_size = 12,
|
||||
display_limit = 6,
|
||||
show_errors = false
|
||||
marked_icon = "⇅",
|
||||
show_errors = true,
|
||||
ytdlp_file_format = "mp4",
|
||||
ytdlp_output_template = "%(uploader)s/%(title)s.%(ext)s"
|
||||
}
|
||||
|
||||
mp.options.read_options(options, "mpv-youtube-queue")
|
||||
@@ -83,11 +80,29 @@ local style = {
|
||||
sortoftransparent .. "}"
|
||||
}
|
||||
|
||||
local YouTubeQueue = {}
|
||||
local video_queue = {}
|
||||
local MSG_DURATION = 1.5
|
||||
local display_limit = options.display_limit
|
||||
local index = 0
|
||||
local selected_index = 1
|
||||
local display_offset = 0
|
||||
local marked_index = nil
|
||||
local current_video = nil
|
||||
|
||||
-- HELPERS {{{
|
||||
|
||||
-- surround string with single quotes if it does not already have them
|
||||
local function surround_with_quotes(s)
|
||||
if string.sub(s, 0, 1) == "'" and string.sub(s, -1) == "'" then
|
||||
return s
|
||||
else
|
||||
return "'" .. s .. "'"
|
||||
end
|
||||
end
|
||||
|
||||
local function remove_quotes(s) return string.gsub(s, "'", "") end
|
||||
|
||||
-- run sleep shell command for n seconds
|
||||
local function sleep(n) os.execute("sleep " .. tonumber(n)) end
|
||||
|
||||
@@ -99,10 +114,30 @@ local function print_osd_message(message, duration, s)
|
||||
duration)
|
||||
end
|
||||
|
||||
-- returns true if the provided path exists and is a file
|
||||
local function is_file(filepath)
|
||||
mp.msg.info("FILEPATH: " .. filepath)
|
||||
local result = utils.file_info(filepath)
|
||||
if result == nil then
|
||||
print_osd_message("File not found: " .. filepath, 3, style.error)
|
||||
return false
|
||||
end
|
||||
return result.is_file
|
||||
end
|
||||
|
||||
-- returns the filename given a path (e.g. /home/user/file.txt -> file.txt)
|
||||
local function split_path(filepath)
|
||||
if is_file(filepath) then return utils.split_path(filepath) end
|
||||
end
|
||||
|
||||
local function print_current_video()
|
||||
local current = YouTubeQueue.get_current_video()
|
||||
print_osd_message("Playing: " .. current.video_name .. ' by ' ..
|
||||
current.channel_name, 3)
|
||||
if is_file(current.video_url) then
|
||||
print_osd_message("Playing: " .. current.video_name, 3)
|
||||
else
|
||||
print_osd_message("Playing: " .. current.video_name .. ' by ' ..
|
||||
current.channel_name, 3)
|
||||
end
|
||||
end
|
||||
|
||||
local function expanduser(path)
|
||||
@@ -121,7 +156,7 @@ local function expanduser(path)
|
||||
end
|
||||
|
||||
local function open_url_in_browser(url)
|
||||
local command = options.browser .. " " .. url
|
||||
local command = options.browser .. " " .. surround_with_quotes(url)
|
||||
os.execute(command)
|
||||
end
|
||||
|
||||
@@ -133,28 +168,6 @@ local function open_channel_in_browser()
|
||||
open_url_in_browser(YouTubeQueue.get_current_video().channel_url)
|
||||
end
|
||||
|
||||
local function get_video_info(url)
|
||||
local command =
|
||||
'yt-dlp --print channel_url --print uploader --print title --playlist-items 1 ' ..
|
||||
url
|
||||
local handle = io.popen(command)
|
||||
if handle == nil then return nil, nil, nil end
|
||||
|
||||
local result = handle:read("*a")
|
||||
handle:close()
|
||||
|
||||
-- Split the result into URL, name, and video title
|
||||
local channel_url, channel_name, video_name = result:match(
|
||||
"(.-)\n(.-)\n(.*)")
|
||||
|
||||
-- Remove trailing whitespace
|
||||
if channel_url ~= nil then channel_url = channel_url:gsub("%s+$", "") end
|
||||
if channel_name ~= nil then channel_name = channel_name:gsub("%s+$", "") end
|
||||
if video_name ~= nil then video_name = video_name:gsub("%s+$", "") end
|
||||
|
||||
return channel_url, channel_name, video_name
|
||||
end
|
||||
|
||||
-- local function is_valid_ytdlp_url(url)
|
||||
-- local command = 'yt-dlp --simulate \'' .. url .. '\' >/dev/null 2>&1'
|
||||
-- local handle = io.popen(command .. "; echo $?")
|
||||
@@ -203,6 +216,28 @@ function YouTubeQueue.get_clipboard_content()
|
||||
return result
|
||||
end
|
||||
|
||||
function YouTubeQueue.get_video_info(url)
|
||||
local command =
|
||||
'yt-dlp --print channel_url --print uploader --print title --playlist-items 1 ' ..
|
||||
surround_with_quotes(url)
|
||||
local handle = io.popen(command)
|
||||
if handle == nil then return nil, nil, nil end
|
||||
|
||||
local result = handle:read("*a")
|
||||
handle:close()
|
||||
|
||||
-- Split the result into URL, name, and video title
|
||||
local channel_url, channel_name, video_name = result:match(
|
||||
"(.-)\n(.-)\n(.*)")
|
||||
|
||||
-- Remove trailing whitespace
|
||||
if channel_url ~= nil then channel_url = channel_url:gsub("%s+$", "") end
|
||||
if channel_name ~= nil then channel_name = channel_name:gsub("%s+$", "") end
|
||||
if video_name ~= nil then video_name = video_name:gsub("%s+$", "") end
|
||||
|
||||
return channel_url, channel_name, video_name
|
||||
end
|
||||
|
||||
-- }}}
|
||||
|
||||
-- QUEUE FUNCTIONS {{{
|
||||
@@ -386,6 +421,8 @@ function YouTubeQueue.play_next_in_queue()
|
||||
return
|
||||
end
|
||||
local current_index = YouTubeQueue.get_current_index()
|
||||
-- if the current video is not the first in the queue, then play the video
|
||||
-- else, check if the video is playing and if not play the video with replace
|
||||
if YouTubeQueue.size() > 1 then
|
||||
mp.set_property_number("playlist-pos", current_index - 1)
|
||||
else
|
||||
@@ -399,8 +436,10 @@ function YouTubeQueue.play_next_in_queue()
|
||||
sleep(MSG_DURATION)
|
||||
end
|
||||
|
||||
-- add the video to the queue from the clipboard
|
||||
function YouTubeQueue.add_to_queue(url)
|
||||
-- add the video to the queue from the clipboard or call from script-message
|
||||
-- updates the internal playlist by default, pass 0 to disable
|
||||
function YouTubeQueue.add_to_queue(url, update_internal_playlist)
|
||||
if update_internal_playlist == nil then update_internal_playlist = 0 end
|
||||
if url == nil or url == "" then
|
||||
url = YouTubeQueue.get_clipboard_content()
|
||||
if url == nil or url == "" then
|
||||
@@ -413,26 +452,47 @@ function YouTubeQueue.add_to_queue(url)
|
||||
print_osd_message("Video already in queue.", MSG_DURATION, style.error)
|
||||
return
|
||||
end
|
||||
local channel_url, channel_name, video_name = get_video_info(url)
|
||||
if (channel_url == nil or channel_name == nil or video_name == nil) or
|
||||
(channel_url == "" or channel_name == "" or video_name == "") then
|
||||
print_osd_message("Error getting video info.", MSG_DURATION, style.error)
|
||||
return
|
||||
|
||||
local video, channel_url, channel_name, video_name, video_url
|
||||
if is_file(url) then
|
||||
video_url = url
|
||||
channel_url, video_name = split_path(video_url)
|
||||
mp.msg.info("channel_url: " .. channel_url)
|
||||
mp.msg.info("video_name: " .. video_name)
|
||||
channel_name = "Local file"
|
||||
|
||||
video = {
|
||||
video_url = video_url,
|
||||
video_name = video_name,
|
||||
channel_url = channel_url,
|
||||
channel_name = channel_name
|
||||
}
|
||||
else
|
||||
channel_url, channel_name, video_name = YouTubeQueue.get_video_info(url)
|
||||
url = remove_quotes(url)
|
||||
if (channel_url == nil or channel_name == nil or video_name == nil) or
|
||||
(channel_url == "" or channel_name == "" or video_name == "") then
|
||||
print_osd_message("Error getting video info.", MSG_DURATION,
|
||||
style.error)
|
||||
else
|
||||
video = {
|
||||
video_url = url,
|
||||
video_name = video_name,
|
||||
channel_url = channel_url,
|
||||
channel_name = channel_name
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
local video = {
|
||||
video_url = url,
|
||||
video_name = video_name,
|
||||
channel_url = channel_url,
|
||||
channel_name = channel_name
|
||||
}
|
||||
table.insert(video_queue, video)
|
||||
-- if the queue was empty, start playing the video
|
||||
-- otherwise, add the video to the playlist
|
||||
if not YouTubeQueue.get_current_video() then
|
||||
YouTubeQueue.play_next_in_queue()
|
||||
else
|
||||
elseif update_internal_playlist == 0 then
|
||||
mp.commandv("loadfile", url, "append-play")
|
||||
print_osd_message("Added " .. video_name .. " to queue.", MSG_DURATION)
|
||||
end
|
||||
print_osd_message("Added " .. video_name .. " to queue.", MSG_DURATION)
|
||||
end
|
||||
|
||||
-- play the previous video in the queue
|
||||
@@ -450,46 +510,81 @@ function YouTubeQueue.play_previous_video()
|
||||
sleep(MSG_DURATION)
|
||||
end
|
||||
|
||||
function YouTubeQueue.download_video_at(idx)
|
||||
local o = options
|
||||
local v = video_queue[idx]
|
||||
local q = o.download_quality:sub(1, -2)
|
||||
local dl_dir = expanduser(o.download_directory)
|
||||
local command = 'yt-dlp -f \'bestvideo[height<=' .. q .. '][ext=' ..
|
||||
options.ytdlp_file_format .. ']+bestaudio/best[height<=' ..
|
||||
q .. ']/bestvideo[height<=' .. q ..
|
||||
']+bestaudio/best[height<=' .. q .. ']\' -o "' .. dl_dir ..
|
||||
"/" .. options.ytdlp_output_template ..
|
||||
'" --downloader ' .. o.downloader .. ' ' .. v.video_url
|
||||
|
||||
-- Run the download command
|
||||
local handle = io.popen(command)
|
||||
if handle == nil then
|
||||
print_osd_message("Error starting download.", MSG_DURATION, style.error)
|
||||
return
|
||||
end
|
||||
print_osd_message("Starting download for " .. v.video_name, MSG_DURATION)
|
||||
local result = handle:read("*a")
|
||||
handle:close()
|
||||
if result == nil then
|
||||
print_osd_message("Error starting download.", MSG_DURATION, style.error)
|
||||
return
|
||||
end
|
||||
|
||||
if result then
|
||||
print_osd_message("Finished downloading " .. v.video_name, MSG_DURATION)
|
||||
else
|
||||
print_osd_message("Error downloading " .. v.video_name, MSG_DURATION,
|
||||
style.error)
|
||||
end
|
||||
end
|
||||
|
||||
function YouTubeQueue.download_current_video()
|
||||
if current_video and current_video ~= "" then
|
||||
local o = options
|
||||
local v = current_video
|
||||
local q = o.download_quality:sub(1, -2)
|
||||
local dl_dir = expanduser(o.download_directory)
|
||||
local command = 'yt-dlp -f \'bestvideo[height<=' .. q ..
|
||||
']+bestaudio/best[height<=' .. q .. ']\' -o "' ..
|
||||
dl_dir .. "/" .. options.download_format_str ..
|
||||
'" --downloader ' .. o.downloader .. ' ' ..
|
||||
v.video_url
|
||||
|
||||
-- Run the download command
|
||||
local handle = io.popen(command)
|
||||
if handle == nil then
|
||||
print_osd_message("Error starting download.", MSG_DURATION,
|
||||
style.error)
|
||||
return
|
||||
end
|
||||
print_osd_message("Starting download for " .. v.video_name, MSG_DURATION)
|
||||
local result = handle:read("*a")
|
||||
handle:close()
|
||||
if result == nil then
|
||||
print_osd_message("Error starting download.", MSG_DURATION,
|
||||
style.error)
|
||||
return
|
||||
end
|
||||
|
||||
if result then
|
||||
print_osd_message("Finished downloading " .. v.video_name,
|
||||
MSG_DURATION)
|
||||
else
|
||||
print_osd_message("Error downloading " .. v.video_name,
|
||||
MSG_DURATION, style.error)
|
||||
end
|
||||
if is_file(current_video.video_url) then
|
||||
print_osd_message("Current video is a local file... doing nothing.",
|
||||
MSG_DURATION, style.error)
|
||||
return
|
||||
end
|
||||
if current_video ~= nil and current_video ~= "" then
|
||||
YouTubeQueue.download_video_at(index)
|
||||
else
|
||||
print_osd_message("No video to download.", MSG_DURATION, style.error)
|
||||
end
|
||||
end
|
||||
|
||||
function YouTubeQueue.download_selected_video()
|
||||
if selected_index == 1 and current_video == nil then
|
||||
print_osd_message("No video to download.", MSG_DURATION, style.error)
|
||||
return
|
||||
end
|
||||
if is_file(YouTubeQueue.get_video_at(selected_index)) then
|
||||
print_osd_message("Current video is a local file... doing nothing.",
|
||||
MSG_DURATION, style.error)
|
||||
return
|
||||
end
|
||||
YouTubeQueue.download_video_at(selected_index)
|
||||
end
|
||||
|
||||
function YouTubeQueue.remove_from_queue()
|
||||
if index == selected_index then
|
||||
print_osd_message("Cannot remove current video", MSG_DURATION,
|
||||
style.error)
|
||||
return
|
||||
end
|
||||
table.remove(video_queue, selected_index)
|
||||
mp.commandv("playlist-remove", selected_index - 1)
|
||||
print_osd_message("Deleted " .. current_video.video_name .. " from queue.",
|
||||
MSG_DURATION)
|
||||
if selected_index > 1 then selected_index = selected_index - 1 end
|
||||
index = index - 1
|
||||
YouTubeQueue.print_queue()
|
||||
end
|
||||
|
||||
-- }}}
|
||||
|
||||
-- LISTENERS {{{
|
||||
@@ -506,7 +601,7 @@ local function on_track_changed() YouTubeQueue.update_current_index() end
|
||||
-- Function to be called when the playback-restart event is triggered
|
||||
local function on_playback_restart()
|
||||
local playlist_size = mp.get_property_number("playlist-count", 0)
|
||||
if playlist_size > 1 then
|
||||
if current_video ~= nil and playlist_size > 1 then
|
||||
YouTubeQueue.update_current_index()
|
||||
elseif current_video == nil then
|
||||
local url = mp.get_property("path")
|
||||
@@ -525,9 +620,9 @@ mp.add_key_binding(options.play_previous_in_queue, "play_previous_video",
|
||||
YouTubeQueue.play_previous_video)
|
||||
mp.add_key_binding(options.print_queue, "print_queue", YouTubeQueue.print_queue)
|
||||
mp.add_key_binding(options.move_cursor_up, "move_cursor_up",
|
||||
YouTubeQueue.move_cursor_up)
|
||||
YouTubeQueue.move_cursor_up, { repeatable = true })
|
||||
mp.add_key_binding(options.move_cursor_down, "move_cursor_down",
|
||||
YouTubeQueue.move_cursor_down)
|
||||
YouTubeQueue.move_cursor_down, { repeatable = true })
|
||||
mp.add_key_binding(options.play_selected_video, "play_selected_video",
|
||||
YouTubeQueue.play_selected_video)
|
||||
mp.add_key_binding(options.open_video_in_browser, "open_video_in_browser",
|
||||
@@ -538,8 +633,12 @@ mp.add_key_binding(options.open_channel_in_browser, "open_channel_in_browser",
|
||||
open_channel_in_browser)
|
||||
mp.add_key_binding(options.download_current_video, "download_current_video",
|
||||
YouTubeQueue.download_current_video)
|
||||
mp.add_key_binding(options.download_selected_video, "download_selected_video",
|
||||
YouTubeQueue.download_selected_video)
|
||||
mp.add_key_binding(options.move_video, "move_video",
|
||||
YouTubeQueue.mark_and_move_video)
|
||||
mp.add_key_binding(options.remove_from_queue, "delete_video",
|
||||
YouTubeQueue.remove_from_queue)
|
||||
|
||||
mp.register_event("end-file", on_end_file)
|
||||
mp.register_event("track-changed", on_track_changed)
|
||||
|
||||
Reference in New Issue
Block a user