mirror of
https://github.com/ksyasuda/mpv-youtube-queue.git
synced 2024-11-22 03:19:54 -08:00
Compare commits
2 Commits
ac73fb2ba2
...
2d47774f6c
Author | SHA1 | Date | |
---|---|---|---|
|
2d47774f6c | ||
|
05becd9cbb |
10
.github/workflows/luackeck.yml
vendored
10
.github/workflows/luackeck.yml
vendored
@ -1,10 +0,0 @@
|
|||||||
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
|
|
@ -49,8 +49,6 @@ This script requires the following software to be installed on the system
|
|||||||
- `download_current_video - ctrl+d`: Download the currently playing video
|
- `download_current_video - ctrl+d`: Download the currently playing video
|
||||||
- `download_selected_video - ctrl+D`: Download the currently selected video
|
- `download_selected_video - ctrl+D`: Download the currently selected video
|
||||||
in the queue
|
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
|
- `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
|
- `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_video_in_browser - ctrl+o`: Open the currently playing video in the browser
|
||||||
@ -62,6 +60,8 @@ This script requires the following software to be installed on the system
|
|||||||
- `print_queue - ctrl+q`: Print the contents of the queue 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
|
- `remove_from_queue - ctrl+x`: Remove the currently selected video from the
|
||||||
queue
|
queue
|
||||||
|
- `move_cursor_up - ctrl+UP`- Move the cursor up one row in the queue
|
||||||
|
- `move_cursor_down - ctrl+DOWN`: Move the cursor down one row in the queue
|
||||||
- `play_selected_video - ctrl+ENTER`: Play the currently selected video in
|
- `play_selected_video - ctrl+ENTER`: Play the currently selected video in
|
||||||
the queue
|
the queue
|
||||||
|
|
||||||
@ -82,8 +82,7 @@ This script requires the following software to be installed on the system
|
|||||||
- `show_errors - yes`: Show error messages on the OSD
|
- `show_errors - yes`: Show error messages on the OSD
|
||||||
- `ytdlp_output_template - %(uploader)s/%(title)s.%(ext)s`: The [yt-dlp output
|
- `ytdlp_output_template - %(uploader)s/%(title)s.%(ext)s`: The [yt-dlp output
|
||||||
template string](https://github.com/yt-dlp/yt-dlp#output-template)
|
template string](https://github.com/yt-dlp/yt-dlp#output-template)
|
||||||
- Full path with the default `download_directory`
|
- Full default path is: `~/videos/YouTube/<uploader>/<title>.<ext>`
|
||||||
is: `~/videos/YouTube/<uploader>/<title>.<ext>`
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
add_to_queue=ctrl+a
|
add_to_queue=ctrl+a
|
||||||
download_current_video=ctrl+d
|
download_current_video=ctrl+d
|
||||||
download_selected_video=ctrl+D
|
download_selected_video=ctrl+D
|
||||||
move_cursor_down=ctrl+j
|
|
||||||
move_cursor_up=ctrl+k
|
|
||||||
move_video=ctrl+m
|
move_video=ctrl+m
|
||||||
play_next_in_queue=ctrl+n
|
play_next_in_queue=ctrl+n
|
||||||
open_video_in_browser=ctrl+o
|
open_video_in_browser=ctrl+o
|
||||||
@ -11,12 +9,15 @@ play_previous_in_queue=ctrl+p
|
|||||||
print_current_video=ctrl+P
|
print_current_video=ctrl+P
|
||||||
print_queue=ctrl+q
|
print_queue=ctrl+q
|
||||||
remove_from_queue=ctrl+x
|
remove_from_queue=ctrl+x
|
||||||
|
move_cursor_up=ctrl+UP
|
||||||
|
move_cursor_down=ctrl+DOWN
|
||||||
play_selected_video=ctrl+ENTER
|
play_selected_video=ctrl+ENTER
|
||||||
browser=firefox
|
browser=firefox
|
||||||
clipboard_command=xclip -o
|
clipboard_command=xclip -o
|
||||||
cursor_icon=➤
|
cursor_icon=➤
|
||||||
display_limit=6
|
display_limit=6
|
||||||
download_directory=~/videos/YouTube
|
download_directory=~/videos/YouTube
|
||||||
|
download_format_str=%(uploader)s/%(title)s.%(ext)s
|
||||||
download_quality=720p
|
download_quality=720p
|
||||||
downloader=curl
|
downloader=curl
|
||||||
font_name=JetBrains Mono
|
font_name=JetBrains Mono
|
||||||
|
@ -15,6 +15,13 @@
|
|||||||
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
local mp = require 'mp'
|
local mp = require 'mp'
|
||||||
mp.options = require 'mp.options'
|
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 styleOn = mp.get_property("osd-ass-cc/0")
|
local styleOn = mp.get_property("osd-ass-cc/0")
|
||||||
local styleOff = mp.get_property("osd-ass-cc/1")
|
local styleOff = mp.get_property("osd-ass-cc/1")
|
||||||
|
|
||||||
@ -22,8 +29,6 @@ local options = {
|
|||||||
add_to_queue = "ctrl+a",
|
add_to_queue = "ctrl+a",
|
||||||
download_current_video = "ctrl+d",
|
download_current_video = "ctrl+d",
|
||||||
download_selected_video = "ctrl+D",
|
download_selected_video = "ctrl+D",
|
||||||
move_cursor_down = "ctrl+j",
|
|
||||||
move_cursor_up = "ctrl+k",
|
|
||||||
move_video = "ctrl+m",
|
move_video = "ctrl+m",
|
||||||
play_next_in_queue = "ctrl+n",
|
play_next_in_queue = "ctrl+n",
|
||||||
open_video_in_browser = "ctrl+o",
|
open_video_in_browser = "ctrl+o",
|
||||||
@ -32,6 +37,8 @@ local options = {
|
|||||||
print_current_video = "ctrl+P",
|
print_current_video = "ctrl+P",
|
||||||
print_queue = "ctrl+q",
|
print_queue = "ctrl+q",
|
||||||
remove_from_queue = "ctrl+x",
|
remove_from_queue = "ctrl+x",
|
||||||
|
move_cursor_up = "ctrl+UP",
|
||||||
|
move_cursor_down = "ctrl+DOWN",
|
||||||
play_selected_video = "ctrl+ENTER",
|
play_selected_video = "ctrl+ENTER",
|
||||||
browser = "firefox",
|
browser = "firefox",
|
||||||
clipboard_command = "xclip -o",
|
clipboard_command = "xclip -o",
|
||||||
@ -43,7 +50,7 @@ local options = {
|
|||||||
font_name = "JetBrains Mono",
|
font_name = "JetBrains Mono",
|
||||||
font_size = 12,
|
font_size = 12,
|
||||||
marked_icon = "⇅",
|
marked_icon = "⇅",
|
||||||
show_errors = true,
|
show_errors = false,
|
||||||
ytdlp_output_template = "%(uploader)s/%(title)s.%(ext)s"
|
ytdlp_output_template = "%(uploader)s/%(title)s.%(ext)s"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,15 +85,8 @@ local style = {
|
|||||||
sortoftransparent .. "}"
|
sortoftransparent .. "}"
|
||||||
}
|
}
|
||||||
|
|
||||||
local YouTubeQueue = {}
|
|
||||||
local video_queue = {}
|
|
||||||
local MSG_DURATION = 1.5
|
|
||||||
local display_limit = options.display_limit
|
local display_limit = options.display_limit
|
||||||
local index = 0
|
|
||||||
local selected_index = 1
|
|
||||||
local display_offset = 0
|
local display_offset = 0
|
||||||
local marked_index = nil
|
|
||||||
local current_video = nil
|
|
||||||
|
|
||||||
-- HELPERS {{{
|
-- HELPERS {{{
|
||||||
|
|
||||||
@ -388,8 +388,6 @@ function YouTubeQueue.play_next_in_queue()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
local current_index = YouTubeQueue.get_current_index()
|
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
|
if YouTubeQueue.size() > 1 then
|
||||||
mp.set_property_number("playlist-pos", current_index - 1)
|
mp.set_property_number("playlist-pos", current_index - 1)
|
||||||
else
|
else
|
||||||
@ -432,8 +430,6 @@ function YouTubeQueue.add_to_queue(url)
|
|||||||
channel_name = channel_name
|
channel_name = channel_name
|
||||||
}
|
}
|
||||||
table.insert(video_queue, video)
|
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
|
if not YouTubeQueue.get_current_video() then
|
||||||
YouTubeQueue.play_next_in_queue()
|
YouTubeQueue.play_next_in_queue()
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user