dotfiles/scripts/playlist-dl

15 lines
395 B
Bash
Executable File

#!/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 ../