From cccd548ee109b60a5c3e3452a06a0d9c3e651891 Mon Sep 17 00:00:00 2001 From: thoralmighty Date: Thu, 30 Nov 2023 14:53:53 +0100 Subject: [PATCH] Added ytdl-music.sh --- ytdl-music.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 ytdl-music.sh diff --git a/ytdl-music.sh b/ytdl-music.sh new file mode 100755 index 0000000..9f97265 --- /dev/null +++ b/ytdl-music.sh @@ -0,0 +1,14 @@ +#!/bin/bash +PLAYLISTURL="$1" +DEFAULT_TARGET_PATH="/mnt/data/media/" +LIBRARY_NAME="${2:-Soundtracks}" +TARGETPATH="${3:-$DEFAULT_TARGET_PATH}" + +# Check if $PLAYLISTURL is empty +if [ -z "$PLAYLISTURL" ]; then + echo "Need to specify a playlist URL" + exit 1 +fi + +# 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"