main
1#!/bin/bash
2function playlist-dl {
3 NAME=${1}
4 PLAYLIST=${2}
5 mkdir -p media/${NAME}
6 pushd media/${NAME}
7
8 ## Embedded thumbnail must be:
9 # - jpg
10 # - 250x250 px
11 yt-dlp \
12 --extract-audio \
13 --audio-format mp3 \
14 --audio-quality 0 \
15 --output "%(title)s.%(ext)s" \
16 --restrict-filenames \
17 --add-metadata \
18 --embed-metadata \
19 --embed-thumbnail \
20 --convert-thumbnails jpg \
21 --postprocessor-args "ThumbnailsConvertor+ffmpeg_o:-q:v 1" \
22 --postprocessor-args "EmbedThumbnail+ffmpeg_o:-c:v mjpeg -vf crop=\"'if(gt(ih,iw),iw,ih)':'if(gt(iw,ih),ih,iw)'\",scale=250:250" \
23 --yes-playlist \
24 "https://www.youtube.com/playlist?list=${PLAYLIST}" \
25 > playlist-dl.log
26 popd
27}