From 9102fec35c901fa73abb449ecc84301512e91f9a Mon Sep 17 00:00:00 2001 From: lara Date: Thu, 31 Dec 2020 16:08:46 +0100 Subject: [PATCH] [bin] Split mp3dl script from cliplumber --- bin/cliplumber | 4 +--- bin/mp3dl | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) create mode 100755 bin/mp3dl diff --git a/bin/cliplumber b/bin/cliplumber index e48d4a0..08e95ab 100755 --- a/bin/cliplumber +++ b/bin/cliplumber @@ -51,9 +51,7 @@ case "$choice" in # Download supports optional folder target "download"*) path="$HOME/mus/$(printf "%s" "$choice" | cut -d " " -f 2-)" - [ -d "$path" ] || mkdir -p "$path" - cd "$path" || exit - youtube-dl -x --audio-format mp3 --no-playlist -o "%(title)s.%(ext)s" "$urls" 2>&1 | grep 'ERROR:' | notify_err + mp3dl -d "$path" "$urls" ;; "crawl") path="$HOME/books/" diff --git a/bin/mp3dl b/bin/mp3dl new file mode 100755 index 0000000..f9893d0 --- /dev/null +++ b/bin/mp3dl @@ -0,0 +1,43 @@ +#!/bin/sh + +set -eu + +# Load helper functions +source "$(dirname "$(rreadlink "$0")")/../lib/utils.sh" + +usage() { + >&2 echo "Usage: $0 [-d folder_dest]