[bin] Split mp3dl script from cliplumber
This commit is contained in:
parent
3206e2886f
commit
9102fec35c
2 changed files with 44 additions and 3 deletions
|
@ -51,9 +51,7 @@ case "$choice" in
|
||||||
# Download supports optional folder target
|
# Download supports optional folder target
|
||||||
"download"*)
|
"download"*)
|
||||||
path="$HOME/mus/$(printf "%s" "$choice" | cut -d " " -f 2-)"
|
path="$HOME/mus/$(printf "%s" "$choice" | cut -d " " -f 2-)"
|
||||||
[ -d "$path" ] || mkdir -p "$path"
|
mp3dl -d "$path" "$urls"
|
||||||
cd "$path" || exit
|
|
||||||
youtube-dl -x --audio-format mp3 --no-playlist -o "%(title)s.%(ext)s" "$urls" 2>&1 | grep 'ERROR:' | notify_err
|
|
||||||
;;
|
;;
|
||||||
"crawl")
|
"crawl")
|
||||||
path="$HOME/books/"
|
path="$HOME/books/"
|
||||||
|
|
43
bin/mp3dl
Executable file
43
bin/mp3dl
Executable file
|
@ -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] <video url>"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
dest="$HOME/mus/download/"
|
||||||
|
url=""
|
||||||
|
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
arg="$1"
|
||||||
|
case $arg in
|
||||||
|
-h|--help)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
-d)
|
||||||
|
dest="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
url="$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -z "$url" ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -d "$dest" ] || mkdir -p "$dest"
|
||||||
|
|
||||||
|
notify-send -t 3000 "mp3dl" "Downloading $url..."
|
||||||
|
|
||||||
|
youtube-dl -x --audio-format mp3 --no-playlist -o "$dest/%(title)s.%(ext)s" "$url" 2>&1 \
|
||||||
|
| grep 'ERROR:' \
|
||||||
|
| notify_err
|
Loading…
Reference in a new issue