33# Copyright (c) 2021-2026 community-scripts ORG
44# Author: vhsdream
55# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6- # Source: https://github.com/slskd/slskd/, https://soularr.net
6+ # Source: https://github.com/slskd/slskd/, https://github.com/mrusse/soularr
77
88source /dev/stdin <<< " $FUNCTIONS_FILE_PATH"
99color
@@ -13,87 +13,87 @@ setting_up_container
1313network_check
1414update_os
1515
16- msg_info " Installing Dependencies"
17- $STD apt install -y \
18- python3-pip
19- msg_ok " Installed Dependencies"
20-
21- msg_info " Setup ${APPLICATION} "
22- tmp_file=$( mktemp)
23- RELEASE=$( curl -s https://api.github.com/repos/slskd/slskd/releases/latest | grep " tag_name" | awk ' {print substr($2, 2, length($2)-3) }' )
24- curl -fsSL " https://github.com/slskd/slskd/releases/download/${RELEASE} /slskd-${RELEASE} -linux-x64.zip" -o $tmp_file
25- $STD unzip $tmp_file -d /opt/${APPLICATION}
26- echo " ${RELEASE} " > /opt/${APPLICATION} _version.txt
16+ fetch_and_deploy_gh_release " Slskd" " slskd/slskd" " prebuild" " latest" " /opt/slskd" " slskd-*-linux-x64.zip"
17+
18+ msg_info " Configuring Slskd"
2719JWT_KEY=$( openssl rand -base64 44)
2820SLSKD_API_KEY=$( openssl rand -base64 44)
29- cp /opt/${APPLICATION} /config/slskd.example.yml /opt/${APPLICATION} /config/slskd.yml
21+ cp /opt/slskd /config/slskd.example.yml /opt/slskd /config/slskd.yml
3022sed -i \
31- -e " \|web:|,\|cidr|s|^#||" \
32- -e " \|https:|,\|5031|s|false|true|" \
23+ -e ' /web:/,/cidr/s/^# //' \
24+ -e ' /https:/,/port: 5031/s/false/true/' \
25+ -e ' /port: 5030/,/socket/s/,.*$//' \
26+ -e ' /content_path:/,/authentication/s/false/true/' \
3327 -e " \|api_keys|,\|cidr|s|<some.*$|$SLSKD_API_KEY |; \
3428 s|role: readonly|role: readwrite|; \
3529 s|0.0.0.0/0,::/0|& # Replace this with your subnet|" \
36- -e " \|soulseek|,\|write_queue|s|^#||" \
3730 -e " \|jwt:|,\|ttl|s|key: ~|key: $JWT_KEY |" \
38- -e " s|^ picture|# picture|" \
39- /opt/${APPLICATION} /config/slskd.yml
40- msg_ok " Setup ${APPLICATION} "
41-
42- msg_info " Installing Soularr"
43- rm -rf /usr/lib/python3.* /EXTERNALLY-MANAGED
44- cd /tmp
45- curl -fsSL -o main.zip https://github.com/mrusse/soularr/archive/refs/heads/main.zip
46- $STD unzip main.zip
47- mv soularr-main /opt/soularr
48- cd /opt/soularr
49- $STD pip install -r requirements.txt
50- sed -i \
51- -e " \|[Slskd]|,\|host_url|s|yourslskdapikeygoeshere|$SLSKD_API_KEY |" \
52- -e " /host_url/s/slskd/localhost/" \
53- /opt/soularr/config.ini
54- sed -i \
55- -e " /#This\|#Default\|INTERVAL/{N;d;}" \
56- -e " /while\|#Pass/d" \
57- -e " \|python|s|app|opt/soularr|; s|python|python3|" \
58- -e " /dt/,+2d" \
59- /opt/soularr/run.sh
60- sed -i -E " /(soularr.py)/s/.{5}$//; /if/,/fi/s/.{4}//" /opt/soularr/run.sh
61- chmod +x /opt/soularr/run.sh
62- msg_ok " Installed Soularr"
63-
64- msg_info " Creating Services"
65- cat << EOF >/etc/systemd/system/${APPLICATION} .service
31+ -e ' /soulseek/,/write_queue/s/^# //' \
32+ -e ' s/^.*picture/#&/' /opt/slskd/config/slskd.yml
33+ msg_ok " Configured Slskd"
34+
35+ read -rp " ${TAB3} Do you want to install Soularr? y/N " soularr
36+ if [[ ${soularr,,} =~ ^(y| yes)$ ]]; then
37+ PYTHON_VERSION=" 3.11" setup_uv
38+ fetch_and_deploy_gh_release " Soularr" " mrusse/soularr" " tarball" " latest" " /opt/soularr"
39+ cd /opt/soularr
40+ $STD uv venv venv
41+ $STD source venv/bin/activate
42+ $STD uv pip install -r requirements.txt
43+ sed -i \
44+ -e " \|[Slskd]|,\|host_url|s|yourslskdapikeygoeshere|$SLSKD_API_KEY |" \
45+ -e " /host_url/s/slskd/localhost/" \
46+ /opt/soularr/config.ini
47+ cat << EOF >/opt/soularr/run.sh
48+ #!/usr/bin/env bash
49+
50+ if ps aux | grep "[s]oularr.py" >/dev/null; then
51+ echo "Soularr is already running. Exiting..."
52+ exit 1
53+ else
54+ source /opt/soularr/venv/bin/activate
55+ uv run python3 -u /opt/soularr/soularr.py --config-dir /opt/soularr
56+ fi
57+ EOF
58+ chmod +x /opt/soularr/run.sh
59+ deactivate
60+ msg_ok " Installed Soularr"
61+ fi
62+
63+ msg_info " Creating Service"
64+ cat << EOF >/etc/systemd/system/slskd.service
6665[Unit]
67- Description=${APPLICATION} Service
66+ Description=Slskd Service
6867After=network.target
6968Wants=network.target
7069
7170[Service]
72- WorkingDirectory=/opt/${APPLICATION}
73- ExecStart=/opt/${APPLICATION} /slskd --config /opt/${APPLICATION} /config/slskd.yml
71+ WorkingDirectory=/opt/slskd
72+ ExecStart=/opt/slskd /slskd --config /opt/slskd /config/slskd.yml
7473Restart=always
7574
7675[Install]
7776WantedBy=multi-user.target
7877EOF
7978
80- cat << EOF >/etc/systemd/system/soularr.timer
79+ if [[ -d /opt/soularr ]]; then
80+ cat << EOF >/etc/systemd/system/soularr.timer
8181[Unit]
8282Description=Soularr service timer
8383RefuseManualStart=no
8484RefuseManualStop=no
8585
8686[Timer]
8787Persistent=true
88- # run every 5 minutes
89- OnCalendar=*-*-* *:0/5 :00
88+ # run every 10 minutes
89+ OnCalendar=*-*-* *:0/10 :00
9090Unit=soularr.service
9191
9292[Install]
9393WantedBy=timers.target
9494EOF
9595
96- cat << EOF >/etc/systemd/system/soularr.service
96+ cat << EOF >/etc/systemd/system/soularr.service
9797[Unit]
9898Description=Soularr service
9999After=network.target slskd.service
@@ -106,10 +106,9 @@ ExecStart=/bin/bash -c /opt/soularr/run.sh
106106[Install]
107107WantedBy=multi-user.target
108108EOF
109- systemctl enable -q --now ${APPLICATION}
110- systemctl enable -q soularr.timer
111- rm -rf $tmp_file
112- rm -rf /tmp/main.zip
109+ msg_warn " Add your Lidarr API key to Soularr in '/opt/soularr/config.ini', then run 'systemctl enable --now soularr.timer'"
110+ fi
111+ systemctl enable -q --now slskd
113112msg_ok " Created Services"
114113
115114motd_ssh
0 commit comments