Select Page

Raspberry Pi – Install Lidarr

Overview

  • Install Lidarr.
  • Automatically manage your music.
  • Find new and missing albums.

Lidarr automates the finding, downloading, naming and organisation of Music libraries. It is designed to work in conjunction with a torrent client and media server. E.g. qBittorrent to download files and your choice of distribution software e.g. Plex Media Server to distribute the music to clients.

If you haven’t already, check out the guide to setup a secure torrent client before continuing with the install of Lidarr.

I do not in any way, shape or form condone or support the downloading of illegal or copyrighted material.

I use Lidarr to organise all of my legally purchased music, its tags, names etc and track which albums I’m missing. The Calendar view is great for seeing release dates of new albums from my favourite artists.

Technical Jargon

SSH

SSH stands for secure shell. SSH is an encrypted connection established between two computer programs. On the server side (the computer being connected to) a service is running that listens for another computer trying to contact it via SSH.

Click here for a full detailed description of SSH.

Assumptions

This guide assumes you have a fresh install of Raspbian on a headless server.

This guide assumes you either have a folder on the Raspberry Pi for your Music, or have setup a connection to your network share that contains all of your current Music.

If it is legal to download copyrighted music where you are and you wish to use Lidarr’s ability to tap into torrent RSS feeds, it’s assumed you have setup a secure torrent client.

Install Lidarr

Before we start we’re going to ensure the Raspberry Pi is up to date. Run the following commands to grab and install the latest packages:

sudo apt-get update

sudo apt-get upgrade -y

We want Lidarr to sit in the /opt directory so let’s cd into it:

cd: /opt

Now let’s grab the latest Lidar.tar.gz file. For me that is version 0.6.0.815, check https://github.com/lidarr/Lidarr/releases to find out which is the latest for you:

sudo wget https://github.com/lidarr/Lidarr/releases/download/v0.6.0.815/Lidarr.develop.0.6.0.815.linux.tar.gz

Once it’s downloaded extract the package:

sudo tar -xzvf Lidarr.develop.0.6.0.815.linux.tar.gz

Create a Service

It is recommended to run Lidarr as its own user for security purposes. We’re going to use qbtuser to own the Lidarr install and run the service. This is to tie in with the user setup in the secure torrent client guide. Feel free to use any user you like. E.g. pi:

sudo chown -R qbtuser:qbtuser /opt/Lidarr

sudo chmod -R a=,a+X,u+rw,g+r /opt/Lidarr

We’re going to create a file under /etc/systemd/system that will tell the Raspberry Pi how to handle Lidarr and ensure it runs as a service:

sudo nano /lib/systemd/system/lidarr.service

Now that we’ve created the file, paste the following into it:

[Unit]
Description=Lidarr Daemon
After=syslog.target network.target

[Service]
User=qbtuser
Group=media
Type=simple
ExecStart=/usr/bin/mono /opt/Lidarr/Lidarr.exe -nobrowser
TimeoutStopSec=20
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target

Press Ctrl+x to exit and you’ll be prompted to Save modified. Type Y and then return to save the file.

Start the Sonarr Service

If everything has gone to plan we can start the service.

Start the service for the first time with:

sudo systemctl start lidarr

Check it all Works

Now we’ve finished installing Lidarr and the service is running, lets check it all works by going to http://*Rasbperry Pi Ip Address*:8686 and we should see the default page.

Auto Start Lidarr – No Torrenting

If Lidarr is used to check the status of your collections we want to start Lidarr with the Raspberry Pi:

sudo systemctl enable lidarr

Now ensure everything works, reboot your Raspberry Pi:

sudo reboot

If you intend to use Sonarr to find torrents enable it by following the below section. Note I do not condone this.

Auto Start Lidarr – Linked to Torrent Client

If Lidarr is used to find torrents, we only want the Lidarr service to be active when there is a VPN connection available.

To do this we’re going to update some files in the OpenVPN directory so cd into /etc/openvpn:

cd /etc/openvpn

To auto start Lidarr when the VPN connection is established we need to edit route-up.sh.

sudo nano route-up.sh

And paste the following at the bottom of the file:

systemctl start lidarr

The file should look like:

#!/bin/sh
iptables -t nat -I POSTROUTING -o tun0 -j MASQUERADE
systemctl start qbittorrent

systemctl start lidarr

 Press Ctrl+x to exit and you’ll be prompted to Save modified. Type Y and then return to save the file.

Auto Stop Lidarr – Linked to Torrent Client

To make sure no peer 2 peer traffic is sent over your clear internet connection we’re going to ensure the Lidarr service is stopped before we lose our VPN connection.

To do this we’re going to add a line to down.sh:

sudo nano down.sh

Paste the following line above “iptables -t nat -D POSTROUTING -o tun0 -j MASQUERADE”:

systemctl stop lidarr

The file should look like:

#!/bin/sh
systemctl stop qbittorrent

systemctl stop lidarr
iptables -t nat -D POSTROUTING -o tun0 -j MASQUERADE

Press Ctrl+x to exit and you’ll be prompted to Save modified. Type Y and then return to save the file.

Reboot your Raspberry Pi to ensure all our changes are applied:

sudo reboot

Check Everything is Working

After the reboot lets check everything is working as we expect.

In your web browser navigate to the Lidarr Web UI as you did earlier and make sure it loads.

Import Your Current Library

Now that everything is working let’s import your current music library so Lidarr can start handling it – showing you what albums you are missing and the current track quality. This process can take a very long time, so once you’ve kicked it off it’s probably best to leave it over night. The time it takes will depend on your internet connection and device you’ve installed Lidarr on. The Raspberry Pi isn’t very powerful so will take a long time if you have a big library.

Before we start the import we want to update some settings to tell Lidarr how to handle file naming and imported track metadata.

Media Management

Click on “Settings and then “Media Management”:

I only include the track number and title in my naming scheme so as can be seen above I’ve updated the Standard Track Format. Click the “?” if you want to customise the naming convention.

Once you’re happy click “Save Changes” at the top.

Metadata

Now click on “Metadata” to update how Lidarr will handle track Metadata:

Lidarr will handle all of your music metadata and you’ve got a few options on how and when it does this. From the dropdown box next to “Tag Audio Files with Metadata” select the right options for you.

I’ve already got my music tagged so I only want Lidarr to handle new files.

If you are unsure click “More Info” to find out which option is right for you.

Once you’re happy click “Save Changes” at the top.

Import Music

To perform a bulk import of our existing library click “Artist”, “Import” and then the big green “Choose Folder” button.

Use the menu to navigate to your music folder and click “Ok”: 

Once the folder is selected Lidarr will scrape through all of the sub folders matching the artists. If any are miss matches or not found use the drop down to search for the correct artist.

It will only try to import artists that aren’t already imported:

After clicking “Import” Lidarr will take you to the Artist page and start downloading all of the album artwork, artist/album information and scrapping your folders to see which albums you currently have.

Don’t worry if the images don’t show up straight away, this process can take a long time:

Finished

The installation and basic setup of Lidarr is complete and it’s up to you to play around with the rest of the settings to get everything sorted. Jump in and have a go.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *