dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit d8ba64d6222b9a920d073d60febdeac2cc905fae
parent 0d98c829b317ad5d9cc9b466a9078acb35647eee
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Thu, 12 Nov 2020 21:16:54 +0100

Switch scripts to youtube-dlc

youtube-dl got DMCAd and youtube-dlc is a fork with a working fix for
Bandcamp.


Former-commit-id: 2b5837bf115f77e334a2afa0bcc31737180357ac
Diffstat:
Mmpv/script-opts/youtube-quality.conf | 2+-
Mmpv/scripts/youtube-quality.lua | 20++++++++++----------
Mnewsboat/config | 2+-
Mscripts/mpvq | 2+-
Mscripts/newsboat-dl | 6+++---
Mscripts/video-json-download.sh | 2+-
6 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/mpv/script-opts/youtube-quality.conf b/mpv/script-opts/youtube-quality.conf @@ -34,7 +34,7 @@ text_padding_y=5 # how many seconds until the quality menu times out menu_timeout=10 -#use youtube-dl to fetch a list of available formats (overrides quality_strings) +#use youtube-dlc to fetch a list of available formats (overrides quality_strings) fetch_formats=yes # list of ytdl-format strings to choose from diff --git a/mpv/scripts/youtube-quality.lua b/mpv/scripts/youtube-quality.lua @@ -45,7 +45,7 @@ local opts = { --other menu_timeout = 10, - --use youtube-dl to fetch a list of available formats (overrides quality_strings) + --use youtube-dlc to fetch a list of available formats (overrides quality_strings) fetch_formats = true, --default menu entries @@ -114,7 +114,7 @@ function show_menu() draw_menu() end function choose_prefix(i) - if i == selected and i == active then return opts.selected_and_active + if i == selected and i == active then return opts.selected_and_active elseif i == selected then return opts.selected_and_inactive end if i ~= selected and i == active then return opts.unselected_and_active @@ -159,11 +159,11 @@ function show_menu() mp.add_forced_key_binding(opts.toggle_menu_binding, "escape", destroy) draw_menu() - return + return end local ytdl = { - path = "youtube-dl", + path = "youtube-dlc", searched = false, blacklisted = {} } @@ -188,16 +188,16 @@ function download_formats() url = string.gsub(url, "ytdl://", "") -- Strip possible ytdl:// prefix. -- don't fetch the format list if we already have it - if format_cache[url] ~= nil then + if format_cache[url] ~= nil then local res = format_cache[url] return res, table_size(res) end - mp.osd_message("fetching available formats with youtube-dl...", 60) + mp.osd_message("fetching available formats with youtube-dlc...", 60) if not (ytdl.searched) then - local ytdl_mcd = mp.find_config_file("youtube-dl") + local ytdl_mcd = mp.find_config_file("youtube-dlc") if not (ytdl_mcd == nil) then - msg.verbose("found youtube-dl at: " .. ytdl_mcd) + msg.verbose("found youtube-dlc at: " .. ytdl_mcd) ytdl.path = ytdl_mcd end ytdl.searched = true @@ -222,7 +222,7 @@ function download_formats() end res = {} - msg.verbose("youtube-dl succeeded!") + msg.verbose("youtube-dlc succeeded!") for i,v in ipairs(json.formats) do if v.vcodec ~= "none" then local fps = v.fps and v.fps.."fps" or "" @@ -242,7 +242,7 @@ end -- register script message to show menu -mp.register_script_message("toggle-quality-menu", +mp.register_script_message("toggle-quality-menu", function() if destroyer ~= nil then destroyer() diff --git a/newsboat/config b/newsboat/config @@ -53,7 +53,7 @@ bind-key SPACE macro-prefix macro SPACE set browser "open -g %u"; open-in-browser; set browser "linkhandler %u" macro v set browser "linkhandler"; open-in-browser ; set browser "linkhandler %u" macro w set browser "w3m -config ~/.config/w3m/config %u"; open-in-browser; set browser "linkhandler %u" -macro i set browser "youtube-dl --get-title --get-duration --get-description %u | less"; open-in-browser; set browser "linkhandler %u" +macro i set browser "youtube-dlc --get-title --get-duration --get-description %u | less"; open-in-browser; set browser "linkhandler %u" macro c set browser "printf '%s' %u | clc" ; open-in-browser ; set browser "linkhandler %u" macro u set browser "urlview"; open-in-browser ; set browser "linkhandler %u" macro a set browser "newsboat-dl aonly %u 1>/dev/null 2>&1 & disown"; open-in-browser ; set browser "linkhandler %u" diff --git a/scripts/mpvq b/scripts/mpvq @@ -16,7 +16,7 @@ play() { # link archive arc(){ - title=$(youtube-dl --ignore-config --get-title "$1" 2>/dev/null) + title=$(youtube-dlc --ignore-config --get-title "$1" 2>/dev/null) printf "%b\n" "$title\t$1" >> "$HOME/.cache/mpv/linkarchive" } diff --git a/scripts/newsboat-dl b/scripts/newsboat-dl @@ -6,16 +6,16 @@ downloads="$HOME/Downloads/" audiodir="$downloads/newsboat/audio" videodir="$downloads/newsboat/video" logfile="$HOME/.cache/newsboat-download.log" -title=$(youtube-dl --ignore-config --get-title --get-duration --get-description "$where" 2>/dev/null) +title=$(youtube-dlc --ignore-config --get-title --get-duration --get-description "$where" 2>/dev/null) terminal-notifier -title "Started $what download" -message "Downloading \"$title\"" -group "$where" case "$what" in "aonly") mkdir -p "$audiodir" - youtube-dl --add-metadata -xic -f bestaudio/best -o "$audiodir/%(title)s-%(creator)s.%(ext)s" "$where" 2>&1 >> "$logfile" + youtube-dlc --add-metadata -xic -f bestaudio/best -o "$audiodir/%(title)s-%(creator)s.%(ext)s" "$where" 2>&1 >> "$logfile" ;; "av") - youtube-dl --add-metadata -ic --write-sub --embed-subs -o "$videodir/%(title)s-%(creator)s.%(ext)s" "$where" 2>&1 >> "$logfile" + youtube-dlc --add-metadata -ic --write-sub --embed-subs -o "$videodir/%(title)s-%(creator)s.%(ext)s" "$where" 2>&1 >> "$logfile" ;; *) terminal-notifier -title "Error" -message "Download option not valid" -group "$where" diff --git a/scripts/video-json-download.sh b/scripts/video-json-download.sh @@ -12,7 +12,7 @@ for i in `seq 0 $nvideos`; do url="$(cat "$1" | jq ."$name")" echo "$name: $url" - youtube-dl -o "$(echo $name | tr -d '"' | sed 's/.mp4//').mp4" "$(echo $url | tr -d '"')" &>/dev/null & + youtube-dlc -o "$(echo $name | tr -d '"' | sed 's/.mp4//').mp4" "$(echo $url | tr -d '"')" &>/dev/null & echo "Downloading $name" if [ $(expr $i % 4) -eq 0 ]; then