support for playlists now available

This commit is contained in:
shockrah 2019-09-22 21:43:34 -07:00
parent 6de646bd4d
commit f63bf2a44d

17
ytdl
View File

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