diff --git a/.config/systemd/user/spotdl_sync.service b/.config/systemd/user/spotdl_sync.service new file mode 100644 index 00000000..3500ab43 --- /dev/null +++ b/.config/systemd/user/spotdl_sync.service @@ -0,0 +1,10 @@ +[Unit] +Description=Download music using spotdl +After=network.target + +[Service] +Type=simple +ExecStart=/home/matt/.local/bin/downloadMusic + +[Install] +WantedBy=default.target diff --git a/.config/systemd/user/spotdl_sync.timer b/.config/systemd/user/spotdl_sync.timer new file mode 100644 index 00000000..55592048 --- /dev/null +++ b/.config/systemd/user/spotdl_sync.timer @@ -0,0 +1,10 @@ +[Unit] +Description=Run Spotdl Sync Weekly + +[Timer] +OnCalendar=Sun 18:00:00 +Persistent=true +Unit=spotdl_sync.service + +[Install] +WantedBy=timers.target diff --git a/.local/bin/downloadMusic b/.local/bin/downloadMusic new file mode 100755 index 00000000..b4f5e2c5 --- /dev/null +++ b/.local/bin/downloadMusic @@ -0,0 +1,23 @@ +#!/usr/bin/bash + +if ! command -v spotdl &>/dev/null; then + notify-send "Spotdl Sync" "Error: spotdl is not installed" + exit 1 +fi + +FOLDERS=( + "EDM-House" + "Metal-Rock" + "Synth-Chill" + "Lofi-Sleppy" + "Space-Cyberpunk" + "Cyberpunk-Darksynth" +) + +notify-send "Spotdl Sync" "Started syncing..." + +for folder in "${FOLDERS[@]}"; do + spotdlSync "$folder" +done + +notify-send "Spotdl Sync Complete" diff --git a/.local/bin/spotdlSync b/.local/bin/spotdlSync new file mode 100755 index 00000000..75b9f227 --- /dev/null +++ b/.local/bin/spotdlSync @@ -0,0 +1,14 @@ +#!/usr/bin/bash + +FOLDER=$1 + +if [ ! -d "$HOME/Musica/Listen-To/$FOLDER" ]; then + notify-send "Spotdl Sync" "The folder $FOLDER doesnt exist" + exit 1 +fi + +cd "$HOME/Musica/Listen-To/$FOLDER" + +spotdl sync "${FOLDER,,}.sync.spotdl" + +notify-send "Spotdl Sync" "$FOLDER synced"