♻️ refactor(systemd): convert spotdl scripts into 1 and change the name to the services

This commit is contained in:
Sergio Laín 2023-12-26 18:31:15 +01:00
parent e13944b5bd
commit 4fd51caee0
No known key found for this signature in database
GPG key ID: 14C9B8080681777B
5 changed files with 17 additions and 27 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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"