commit fc006492f8586c41b4c6b0235f8ba2f07fa97e28 parent 90a94eba9c642f8c8b5516c0b7d8161628472d51 Author: Alex Balgavy <a.balgavy@gmail.com> Date: Mon, 22 Jun 2020 12:23:35 +0200 newsboat-dl: for dispatching a/v downloads from newsboat Former-commit-id: 11aab4225ed52e73da97ecd1ef73888745ff304b Diffstat:
A | scripts/newsboat-dl | | | 25 | +++++++++++++++++++++++++ |
1 file changed, 25 insertions(+), 0 deletions(-)
diff --git a/scripts/newsboat-dl b/scripts/newsboat-dl @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +[ $# -eq 2 ] || { terminal-notifier -title "Not enough arguments" -message "Need exactly 2 arguments." && exit 1; } +what="$1" +where="$2" +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) + +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" + ;; + "av") + youtube-dl --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" + exit 1 + ;; +esac +terminal-notifier -title "Download complete" -message "Downloaded \"$title\"" -group "$where"