From b20776bce35387dc37adbb7cf16f3ca12a1a0a99 Mon Sep 17 00:00:00 2001 From: ksyasuda Date: Sun, 6 Aug 2023 03:13:13 -0700 Subject: [PATCH] update transparency/font size and fix first video caling add to queue repeatedly on skip forward --- README.md | 4 ++-- mpv-youtube-queue.conf | 2 +- mpv-youtube-queue.lua | 17 ++++++----------- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 7727597..1dbdb77 100644 --- a/README.md +++ b/README.md @@ -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_u - ctrl+UP`- Move the cursor up one row in the queue +- `move_cursor_up - 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 - 14`: Size of the font +- `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 diff --git a/mpv-youtube-queue.conf b/mpv-youtube-queue.conf index 90aa6da..3f41fb3 100644 --- a/mpv-youtube-queue.conf +++ b/mpv-youtube-queue.conf @@ -13,7 +13,7 @@ clipboard_command=xclip -o display_limit=6 cursor_icon=➤ marked_icon=⇅ -font_size=24 +font_size=12 font_name=JetBrains Mono download_quality=720p download_directory=~/videos/YouTube diff --git a/mpv-youtube-queue.lua b/mpv-youtube-queue.lua index c98ecb1..63a7ce3 100644 --- a/mpv-youtube-queue.lua +++ b/mpv-youtube-queue.lua @@ -47,7 +47,7 @@ local options = { downloader = "curl", download_quality = "720p", font_name = "JetBrains Mono", - font_size = 14, + font_size = 12, display_limit = 6, show_errors = false } @@ -66,8 +66,8 @@ local colors = { } local notransparent = "\\alpha&H00&" -local semitransparent = "\\alpha&H4D&" -local transparent = "\\alpha&H73&" +local semitransparent = "\\alpha&H40&" +local sortoftransparent = "\\alpha&H59&" 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 .. "&" .. transparent .. "}", + reset = "{\\c&" .. colors.text .. "&" .. sortoftransparent .. "}", 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 .. "{" .. - transparent .. "}" + sortoftransparent .. "}" } local display_limit = options.display_limit @@ -409,11 +409,6 @@ 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 @@ -513,7 +508,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() - else + elseif current_video == nil then local url = mp.get_property("path") YouTubeQueue.add_to_queue(url) end