Compare commits

..

No commits in common. "ef5ceaa4994caf4c3dba81c471ac092a80e7fecd" and "a47da19922729c32e1098ecefba250178a2bfb2b" have entirely different histories.

4 changed files with 14 additions and 9 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 629 KiB

After

Width:  |  Height:  |  Size: 565 KiB

View File

@ -45,7 +45,7 @@ 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
- `move_cursor_u - ctrl+UP`- Move the cursor up one row in the queue
- `move_video - ctrl+m`: Mark/move the selected video in the queue
- `open_channel_in_browser - ctrl+O`: Open the channel page for the currently
playing video in the browser
@ -68,7 +68,7 @@ This script requires the following software to be installed on the system
- `downloader - curl`: The name of the program to use to download the video
- `download_quality 720p`: The maximum download quality
- `font_name - JetBrains Mono`: The name of the font to use
- `font_size - 12`: Size of the font
- `font_size - 14`: 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

View File

@ -13,7 +13,7 @@ clipboard_command=xclip -o
display_limit=6
cursor_icon=➤
marked_icon=⇅
font_size=12
font_size=24
font_name=JetBrains Mono
download_quality=720p
download_directory=~/videos/YouTube

View File

@ -47,7 +47,7 @@ local options = {
downloader = "curl",
download_quality = "720p",
font_name = "JetBrains Mono",
font_size = 12,
font_size = 14,
display_limit = 6,
show_errors = false
}
@ -66,8 +66,8 @@ local colors = {
}
local notransparent = "\\alpha&H00&"
local semitransparent = "\\alpha&H40&"
local sortoftransparent = "\\alpha&H59&"
local semitransparent = "\\alpha&H4D&"
local transparent = "\\alpha&H73&"
local style = {
error = "{\\c&" .. colors.error .. "&" .. notransparent .. "}",
@ -75,12 +75,12 @@ local style = {
hover_selected = "{\\c&" .. colors.hover_selected .. "&\\alpha&H33&}",
cursor = "{\\c&" .. colors.cursor .. "&" .. notransparent .. "}",
marked = "{\\c&" .. colors.marked .. "&" .. notransparent .. "}",
reset = "{\\c&" .. colors.text .. "&" .. sortoftransparent .. "}",
reset = "{\\c&" .. colors.text .. "&" .. transparent .. "}",
header = "{\\fn" .. options.font_name .. "\\fs" .. options.font_size * 1.5 ..
"\\u1\\b1\\c&" .. colors.header .. "&" .. notransparent .. "}",
hover = "{\\c&" .. colors.hover .. "&" .. semitransparent .. "}",
font = "{\\fn" .. options.font_name .. "\\fs" .. options.font_size .. "{" ..
sortoftransparent .. "}"
transparent .. "}"
}
local display_limit = options.display_limit
@ -409,6 +409,11 @@ function YouTubeQueue.add_to_queue(url)
return
end
end
if not string.match(url, "^https://www.youtube.com") then
print_osd_message("URL is not a valid YouTube URL", MSG_DURATION,
style.error)
return
end
if YouTubeQueue.is_in_queue(url) then
print_osd_message("Video already in queue.", MSG_DURATION, style.error)
return
@ -508,7 +513,7 @@ local function on_playback_restart()
local playlist_size = mp.get_property_number("playlist-count", 0)
if playlist_size > 1 then
YouTubeQueue.update_current_index()
elseif current_video == nil then
else
local url = mp.get_property("path")
YouTubeQueue.add_to_queue(url)
end