2019-07-05 08:03:08 +00:00
|
|
|
#!/bin/sh
|
2019-09-23 04:43:34 +00:00
|
|
|
|
2019-09-24 02:22:50 +00:00
|
|
|
dir="`for d in ~/Music/*;do
|
2019-07-05 08:03:08 +00:00
|
|
|
if [ -d "$d" ]
|
|
|
|
then
|
|
|
|
basename "$d"
|
|
|
|
fi
|
2019-09-24 02:22:50 +00:00
|
|
|
done | dmenu -i -l 10 -p 'Installation location'`"
|
2019-09-23 04:43:34 +00:00
|
|
|
|
2019-07-05 08:03:08 +00:00
|
|
|
if [ -z "$dir" ]; then exit; fi
|
2019-09-24 02:22:50 +00:00
|
|
|
mkdir -p "$HOME/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
|
2022-04-04 05:22:11 +00:00
|
|
|
cmd='yt-dlp --extract-audio --verbose --audio-format mp3'
|
2019-09-24 02:22:50 +00:00
|
|
|
outplaylist="$HOME/Music/${dir}/%(autonumber)02d - %(title)s.%(ext)s"
|
|
|
|
outsingle="$HOME/Music/${dir}/%(title)s.%(ext)s"
|
2019-09-23 04:43:34 +00:00
|
|
|
|
2019-10-20 03:33:26 +00:00
|
|
|
# youtube playlists
|
2020-03-12 21:25:49 +00:00
|
|
|
if echo "$url" | grep -q '&list=\|?list'; then
|
2020-07-06 20:36:37 +00:00
|
|
|
$cmd -i -o "$outplaylist" "$url"
|
2019-10-20 03:33:26 +00:00
|
|
|
# soundcloud sets
|
|
|
|
elif echo "$url" | grep -q '/sets/'; then
|
2020-07-06 20:36:37 +00:00
|
|
|
$cmd -i -o "$outplaylist" "$url"
|
2019-09-23 04:43:34 +00:00
|
|
|
else
|
2019-12-22 05:19:31 +00:00
|
|
|
$cmd -o "$outsingle" "$url"
|
2019-09-23 04:43:34 +00:00
|
|
|
fi
|