newsboat-dl (1150B)
1 #!/bin/sh 2 # Download audio/video from newsboat. This script generally isn't executed manually, but via newsboat macros. 3 [ $# -eq 2 ] || { terminal-notifier -title "Not enough arguments" -message "Need exactly 2 arguments." && exit 1; } 4 what="$1" 5 where="$2" 6 downloads="$HOME/Downloads/" 7 audiodir="$downloads/newsboat/audio" 8 videodir="$downloads/newsboat/video" 9 logfile="$HOME/.cache/newsboat-download.log" 10 title=$(youtube-dl --ignore-config --get-title --get-duration --get-description "$where" 2>/dev/null) 11 12 terminal-notifier -title "Started $what download" -message "Downloading \"$title\"" -group "$where" 13 case "$what" in 14 "aonly") 15 mkdir -p "$audiodir" 16 youtube-dl --add-metadata -xic -f bestaudio/best -o "$audiodir/%(title)s-%(creator)s.%(ext)s" "$where" >>"$logfile" 2>&1 17 ;; 18 "av") 19 youtube-dl --add-metadata -ic --write-sub --embed-subs -o "$videodir/%(title)s-%(creator)s.%(ext)s" "$where" >>"$logfile" 2>&1 20 ;; 21 *) 22 terminal-notifier -title "Error" -message "Download option not valid" -group "$where" 23 exit 1 24 ;; 25 esac 26 terminal-notifier -title "Download complete" -message "Downloaded \"$title\"" -group "$where"