Add playlist-dl script

pull/1/head
kalle 2022-07-29 19:13:15 +02:00
parent 4e2f5a8bd6
commit 9ed0387ce2
1 changed files with 14 additions and 0 deletions

14
scripts/playlist-dl Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -x
echo "Looking up playlist name..."
pl_line=$(youtube-dl --flat-playlist "$1" | grep "\[download\] Downloading playlist: ")
pl_name=$(echo ${pl_line:33} | tr '/' ' ')
echo "Found playlist by name: $pl_name"
echo "Downloading it into directory: $pl_name"
mkdir "$pl_name"
cd "$pl_name"
youtube-dl --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" "$1"
cd ../