system-scripts/downloads/ytdl-music.ps1

19 lines
502 B
PowerShell

# Requires yt-dlp; install with winget
param (
[string]$PLAYLISTURL,
[string]$LIBRARY_NAME = "Soundtracks",
[string]$TARGETPATH = "/mnt/data/media/"
)
$DEFAULT_TARGET_PATH = "/mnt/data/media/"
# Check if $PLAYLISTURL is empty
if (-not $PLAYLISTURL) {
Write-Output "Need to specify a playlist URL"
exit 1
}
# Use double quotes for variables within the yt-dlp command
yt-dlp -f 'ba' -x --audio-format mp3 $PLAYLISTURL -o "$TARGETPATH/$LIBRARY_NAME/%(playlist)s/%(title)s.%(ext)s"