✨ feat(systemd): new services for downloading my spotify playlists with spotdl
This commit is contained in:
parent
f73837a4ff
commit
9a3b64e6fb
4 changed files with 57 additions and 0 deletions
10
.config/systemd/user/spotdl_sync.service
Normal file
10
.config/systemd/user/spotdl_sync.service
Normal file
|
@ -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
|
10
.config/systemd/user/spotdl_sync.timer
Normal file
10
.config/systemd/user/spotdl_sync.timer
Normal file
|
@ -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
|
23
.local/bin/downloadMusic
Executable file
23
.local/bin/downloadMusic
Executable file
|
@ -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"
|
14
.local/bin/spotdlSync
Executable file
14
.local/bin/spotdlSync
Executable file
|
@ -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"
|
Loading…
Add table
Reference in a new issue