From 0e83bf8b6eaede4851fb7ee78ea1783d616a20d3 Mon Sep 17 00:00:00 2001 From: Ricky Jon Date: Sat, 15 Dec 2018 10:15:48 +1100 Subject: [PATCH] Download video relative to your screen size --- .bashrc | 3 ++- .config/newsboat/config | 3 ++- .config/ranger/rc.conf | 5 +++-- .scripts/tools/dmenuhandler | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.bashrc b/.bashrc index 2040b2ee..3efe2bf5 100644 --- a/.bashrc +++ b/.bashrc @@ -45,9 +45,10 @@ alias diff="diff --color=auto" alias ccat="highlight --out-format=ansi" # Color cat - print file with syntax highlighting. # Internet -alias yt="youtube-dl --add-metadata -ic" # Download video link +alias yt="youtube-dl --add-metadata -ic -f '(best[height<=`xrandr | sed -n '/connected primary/p' | awk '{print $4}' | sed 's/x/\n/g' | sed -n 1p`])/best'" #Download video link alias yta="yt -x -f bestaudio/best" # Download only audio alias YT="youtube-viewer" shdl() { curl -O $(curl -s http://sci-hub.tw/"$@" | grep location.href | grep -o http.*pdf) ;} vf() { $EDITOR $(fzf) ;} +cur_pri_size_h() { xrandr | sed -n '/connected primary/p' | awk '{print $4}' | sed 's/x/\n/g' | sed -n 1p } diff --git a/.config/newsboat/config b/.config/newsboat/config index c31afdf9..fc1c5953 100644 --- a/.config/newsboat/config +++ b/.config/newsboat/config @@ -32,7 +32,8 @@ color article cyan default browser linkhandler macro , open-in-browser -macro t set browser "tsp youtube-dl --add-metadata -ic"; open-in-browser ; set browser linkhandler +macro t set browser "tsp youtube-dl --add-metadata -ic -f '(best[height<=`xrandr | sed -n '/connected primary/p' | awk '{print $4}' | sed 's/x/\n/g' | sed -n 1p`])/best'"; open-in-browser ; set browser linkhandler + macro a set browser "tsp youtube-dl --add-metadata -xic -f bestaudio/best"; open-in-browser ; set browser linkhandler macro v set browser "setsid nohup mpv"; open-in-browser ; set browser linkhandler macro w set browser "w3m"; open-in-browser ; set browser linkhandler diff --git a/.config/ranger/rc.conf b/.config/ranger/rc.conf index 9e67b37b..7f0ea10f 100644 --- a/.config/ranger/rc.conf +++ b/.config/ranger/rc.conf @@ -513,5 +513,6 @@ map Tt eval fm.open_console('shell eyeD3 -t "" ' + fm.thisfile.relative_path, po map Tn eval fm.open_console('shell eyeD3 -n "" ' + fm.thisfile.relative_path, position=16) #Downloading -map ytv console shell youtube-dl -ic%space -map yta console shell youtube-dl -xic%space + +map ytv console shell youtube-dl --add-metadata -ic -f '(best[height<=`xrandr | sed -n '/connected primary/p' | awk '{print $4}' | sed 's/x/\n/g' | sed -n 1p`])/best' %space +map yta console shell youtube-dl -xic -f bestaudio/best%space diff --git a/.scripts/tools/dmenuhandler b/.scripts/tools/dmenuhandler index f00178b7..7563f1c9 100755 --- a/.scripts/tools/dmenuhandler +++ b/.scripts/tools/dmenuhandler @@ -7,7 +7,7 @@ case "$(printf "copy url\\nmpv\\nmpv (loop)\\nqueue download\\n\\nqueue youtube- mpv) setsid mpv -quiet "$1" >/dev/null 2>&1 & ;; "mpv (loop)") setsid mpv -quiet --loop "$1" >/dev/null 2>&1 & ;; "queue download") tsp curl -LO "$1" >/dev/null 2>&1 ;; - "queue youtube-dl") tsp youtube-dl --write-metadata -ic "$1" >/dev/null 2>&1 ;; + "queue youtube-dl") tsp "youtube-dl --add-metadata -ic -f '(best[height<=`xrandr | sed -n '/connected primary/p' | awk '{print $4}' | sed 's/x/\n/g' | sed -n 1p`])/best'" "$1" >/dev/null 2>&1 ;; browser) setsid "$TRUEBROWSER" "$1" >/dev/null 2>&1 & ;; feh) setsid feh "$1" >/dev/null 2>&1 & ;; w3m) w3m "$1" >/dev/null 2>&1 ;;