A Python script that connects Lidarr with Soulseek!
Soularr reads all of your "wanted" albums/artists from Lidarr and downloads them using Slskd. It uses the libraries: pyarr and slskd-api to make this happen. View the demo below!
After the downloads are complete in Slskd the script will tell Lidarr to import the downloaded files, making it a truly hands off process.
python -m pip install -r requirements.txt
Lidarr https://lidarr.audio/
Make sure to mount your Slskd download directory in Lidarr and add it to your config (see "download_dir" under "Lidarr" in the example config).
Slskd https://github.com/slskd/slskd
The script requires an api key from Slskd. Take a look at their docs on how to set it up (all you have to do is add it to the yml file under web, authentication, api_keys, my_api_key
).
The config file has a bunch of different settings that affect how the script runs. Any lists in the config such as "accepted_countries" need to be comma separated with no spaces (e.g. ","
not " , "
or " ,"
).
Example config:
[Lidarr]
api_key = yourlidarrapikeygoeshere
host_url = http://localhost:8686
#This should be the path mounted in lidarr that points to your slskd download dir
download_dir = /lidarr/path/to/slskd/downloads
[Slskd]
#Api key from Slskd. Need to set this up manually. See link to Slskd docs above.
api_key = yourslskdapikeygoeshere
host_url = http://localhost:5030
#Slskd download directory. Should have set it up when installing Slskd.
download_dir = /path/to/your/Slskd/downloads
[Release Settings]
#If true script will select the release with the most common amount of tracks out of all the releases.
use_most_common_tracknum = True
allow_multi_disc = True
#See full list of countries below.
accepted_countries = Europe,Japan,United Kingdom,United States,[Worldwide],Australia,Canada
#See full list of formats below.
accepted_formats = CD,Digital Media,Vinyl
[Search Settings]
search_timeout = 5000
maximum_peer_queue = 50
#Min upload speed in bit/s
minimum_peer_upload_speed = 0
#Replace "flac,mp3" with "flac" if you just want flacs.
allowed_filetypes = flac,mp3
ignored_users = User1,User2,Fred,Bob
Full list of countries from Musicbrainz.
Full list of formats (also from Musicbrainz but for some reason they don't have a nice list)
I have included this example config in the repo.
You can simply run the script with:
python soularr.py
Note: the config.ini
file needs to be in the same directory as soularr.py
.
Scheduling the script is highly recommended since then all you have to do is add albums to the wanted list in Lidarr and the script will pick them up. I have included an example bash script that can be scheduled using a cron job.
Example cron job setup:
Edit crontab file with
crontab -e
Then enter in your schedule followed by the command. For example:
*/5 * * * * /path/to/run.sh
This would run the bash script every 5 minutes.
All of this is focused on Linux but the Python script runs fine on Windows as well. You can use things like the Windows Task Scheduler to perform similar scheduling operations.
For my personal setup I am running the script on my Unraid server where both Lidarr and Slskd run as well. I run it using the User Scripts plugin on a 5 minute schedule.