Skip to content

Commit

Permalink
(yt-dlp): Add auto download script
Browse files Browse the repository at this point in the history
  • Loading branch information
thibmaek committed May 26, 2024
1 parent 76d960a commit 16be7da
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions files/scripts/yt-dlp/auto-playlist-yt-dlp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -e

DEFAULT_PLAYLIST_URL=""
DOWNLOAD_DIR=""
ARCHIVE_FILE="$DOWNLOAD_DIR/archive.txt"
PLAYLIST_URL="${1:-$DEFAULT_PLAYLIST_URL}"

if [ -z "$DOWNLOAD_DIR" ]; then
echo "No download dir set."
exit 1
fi

if [ ! -d "$DOWNLOAD_DIR" ]; then
mkdir -p "$DOWNLOAD_DIR"
fi

if command -v ffmpeg > /dev/null; then
yt-dlp --extract-audio \
--audio-format m4a \
--audio-quality 0 \
--download-archive "$ARCHIVE_FILE" \
-o "$DOWNLOAD_DIR/%(title)s.%(ext)s" \
"$PLAYLIST_URL"
else
echo "You need ffmpeg first"
exit 1
fi

0 comments on commit 16be7da

Please sign in to comment.