rice/ytdl

26 lines
576 B
Plaintext
Raw Normal View History

2019-07-05 08:03:08 +00:00
#!/bin/sh
2019-09-23 04:43:34 +00:00
2019-07-05 08:03:08 +00:00
dir=`for d in ~/Music/*;do
if [ -d "$d" ]
then
basename "$d"
fi
done | dmenu -i -l 10 -p 'Pick a directory'`
2019-09-23 04:43:34 +00:00
2019-07-05 08:03:08 +00:00
if [ -z "$dir" ]; then exit; fi
2019-09-23 04:43:34 +00:00
mkdir -p "~/Music/$dir"
2019-07-05 08:03:08 +00:00
url=`echo '' | dmenu -p 'Enter a url'`
if [ -z "$url" ]; then exit; fi
# youtube-dl constantly breaks so --verbose is here for your pleasure
2019-09-23 04:43:34 +00:00
cmd='youtube-dl --extract-audio --verbose --audio-format mp3'
outplaylist="-o ~/Music/$dir/%(autonumber)02d $url"
outsingle="-o ~/Music/$dir/%(title)s.%(ext)s $url"
if echo "$url" | grep -q '&list='; then
$cmd $outplaylist
else
$cmd $outsingle
fi