diff --git a/.config/systemd/user/downloadSpotify.service b/.config/systemd/user/downloadSpotify.service new file mode 100644 index 00000000..078867d1 --- /dev/null +++ b/.config/systemd/user/downloadSpotify.service @@ -0,0 +1,10 @@ +[Unit] +Description=Download Spotify Lists using spotdl +After=network.target + +[Service] +Type=simple +ExecStart=/home/matt/.local/bin/downloadSpotify + +[Install] +WantedBy=default.target diff --git a/.config/systemd/user/spotdl_sync.timer b/.config/systemd/user/downloadSpotify.timer similarity index 81% rename from .config/systemd/user/spotdl_sync.timer rename to .config/systemd/user/downloadSpotify.timer index 55592048..b206ca3f 100644 --- a/.config/systemd/user/spotdl_sync.timer +++ b/.config/systemd/user/downloadSpotify.timer @@ -4,7 +4,7 @@ Description=Run Spotdl Sync Weekly [Timer] OnCalendar=Sun 18:00:00 Persistent=true -Unit=spotdl_sync.service +Unit=downloadSpotify.service [Install] WantedBy=timers.target diff --git a/.config/systemd/user/spotdl_sync.service b/.config/systemd/user/spotdl_sync.service deleted file mode 100644 index 3500ab43..00000000 --- a/.config/systemd/user/spotdl_sync.service +++ /dev/null @@ -1,10 +0,0 @@ -[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/.local/bin/downloadMusic b/.local/bin/downloadSpotify similarity index 66% rename from .local/bin/downloadMusic rename to .local/bin/downloadSpotify index 308dce06..8d42ca21 100755 --- a/.local/bin/downloadMusic +++ b/.local/bin/downloadSpotify @@ -16,8 +16,12 @@ FOLDERS=( notify-send "Spotdl Sync" "Started syncing..." -for folder in "${FOLDERS[@]}"; do - /home/matt/.local/bin/spotdlSync "$folder" # TODO: Change the path to relative without breaking the systemd service +for FOLDER in "${FOLDERS[@]}"; do + cd "$HOME/Musica/Listen-To/$FOLDER" || continue + + spotdl sync "${FOLDER,,}.sync.spotdl" + + notify-send "Spotdl Sync" "$FOLDER synced" done notify-send "Spotdl Sync Complete" diff --git a/.local/bin/spotdlSync b/.local/bin/spotdlSync deleted file mode 100755 index 75b9f227..00000000 --- a/.local/bin/spotdlSync +++ /dev/null @@ -1,14 +0,0 @@ -#!/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"