diff --git a/.local/bin/getting-spotify b/.local/bin/getting-spotify new file mode 100755 index 0000000..5f492fc --- /dev/null +++ b/.local/bin/getting-spotify @@ -0,0 +1,47 @@ +#!/bin/bash + +FOLDER_FAV="/Volumes/Music/Jellyfin/Playlist-Fav" +FOLDER_DUB="/Volumes/Music/Jellyfin/Playlist-Dub" + +# Check if folder exists +[ ! -d $FOLDER_DUB ] && exit 1 +[ ! -d $FOLDER_FAV ] && exit 1 + +# Remove old files +rm -rfv $FOLDER_DUB/errors.txt +rm -rfv $FOLDER_FAV/errors.txt + +# Download new files for DUB +cd $FOLDER_DUB || exit 1 +spotdl --user-auth --keep-alive \ + --threads 8 \ + --output "{artist}/{album}/{track-number} - {title}.{output-ext}" \ + download "https://open.spotify.com/playlist/5Y6hRcNinZaoZGiadaXDEC?si=78d89f9a1a974fdf" \ + --print-errors \ + --save-errors $FOLDER_DUB/errors.txt \ + --yt-dlp-args no-check-certificates + +# Download new files for NEW +cd $FOLDER_FAV || exit 1 +spotdl --user-auth --keep-alive \ + --threads 8 \ + --output "{artist}/{album}/{track-number} - {title}.{output-ext}" \ + download "https://open.spotify.com/playlist/2P063NZZOPC9gvZrPAHZh9?si=33c34cdd981c4949" \ + --print-errors \ + --save-errors $FOLDER_FAV/errors.txt \ + --yt-dlp-args no-check-certificates + +# Sync to Jellyfin +rsync -h --progress --recursive \ + $FOLDER_DUB/* docker-de:/mnt/HC_Volume_34966154/jellifin/media/music/Dub + +rsync -h --progress --recursive \ + $FOLDER_FAV/* docker-de:/mnt/HC_Volume_34966154/jellifin/media/music/Fav + +# Generate playlist +ssh docker-de -t "cd /mnt/HC_Volume_34966154/jellifin/media/music/Dub; find . -type f \( -name '*.mp3' -o -name '*.flac' -o -name '*.loss' -o -name '*.aiff' -o -name '*.aif' \) -printf './%P\n' | sort > playlist.m3u" + +ssh docker-de -t "cd /mnt/HC_Volume_34966154/jellifin/media/music/Fav; find . -type f \( -name '*.mp3' -o -name '*.flac' -o -name '*.loss' -o -name '*.aiff' -o -name '*.aif' \) -printf './%P\n' | sort > playlist.m3u" + +# Fix permissions +ssh docker-de -t 'chown docker-user: /mnt/HC_Volume_34966154/jellifin -R'