====== Bazarr: subtitles downloader & finder ======
[[https://www.bazarr.media/|Bazarr]] is a tool which can search for, download and organize subtitles for all your media. By interfacing with one or more subtitles providers, Bazarr will scan your media libraries and update the subtitles for the languages you want.
===== Installation =====
There are a couple of Bazarr docker images but they don't play well with users and permissions, and i got fed up trying to fix the issue, so let's install Bazarr on bare-metal. It's not that difficult and afterall, it's the officially supported way to do it from the devs, so...
As usual, you need to create a specific user and set it's home folder to **/data/daemons/bazarr** and set //media// as it's main group, then download the latest release and unpack it:
useradd -d /data/daemons/bazarr -g media -m bazarr
su - bazarr
mkdir bazarr
cd bazarr
wget https://github.com/morpheus65535/bazarr/releases/latest/download/bazarr.zip
unzip bazarr.zip
Since the zip is a bit messy (all files on root zip folder) i prefer to put it into a subfolder.
Now you need to enable PIP user support (see [[gentoo:pip|PIP]] for user bazarr, then continue reading.
Now install the requirements:
su - bazarr
cd bazarr
pip install -r requirements.txt
That's it, Bazarr is installed, but you will need to configure it before starting.
Edit the default **/data/daemons/bazarr/bazarr/data/config/config.yaml**, set the following lines:
...
base_url: /bazarr
chmod: '0664'
ip: 127.0.0.1
...
If the file is missing, start bazar once then stop it.
You need to set the base_url to match the reverse proxy setting and you want to ensure new files by Bazarr are created as readable and writable by the media group (so, 0664) for them to be accessible in your media collection. You also want to bind to IP 127.0.0.1 for security reasons.
===== Reverse-Proxy configuration =====
Before you proceed, you should make Bazarr accessible via the reverse-proxy, so that access, configuration and usage will be simplified from the beginning. Add this file to **/etc/nginx/folders**:
location /bazarr/ {
proxy_pass http://127.0.0.1:6767/bazarr/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_redirect off;
# Allow the Bazarr API through if you enable Auth on the block above
location /bazarr/api {
auth_pam off;
proxy_pass http://127.0.0.1:6767/bazarr/api;
}
}
As usual the [[selfhost:nginx|The Reverse Proxy concept]] will help you activate and reload the Reverse Proxy.
===== Automatic Startup =====
Drop the following init script in **/etc/init.d/bazarr**:
#!/sbin/openrc-run
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
description="Subtitle downloader"
pidfile="/run/bazarr.pid"
command_background=true
command="/usr/bin/python3"
command_args="/data/daemons/bazarr/bazarr/bazarr.py"
command_user="bazarr:media"
depend() {
need net localmount
}
Make it executable, add to default runlevel and start it now:
chmod +x /etc/init.d/bazarr
rc-update add bazarr default
/etc/init.d/bazarr start
and you are all set.
===== Usage =====
Now you can head to the Bazarr URL (https://10.0.0.1/bazarr) with your browser and access the Bazarr web GUI, from you which you need to fill up the //Sonarr// and //Radarr// sections. Put in your Sonarr and Radarr base URL's (/sonarr and /radarr if you configured everything correctly before) and put also in the respective API keys, that you will find in the Sonarr and Radarr web GUI configuration pages. You will also need to go to the languages section and setup at least one language you want your subtitles.
Then it's time to setup some providers: you can do so from the Providers configuration page. You will need at least one.
Go ahead and continue configuring anything else you might want to setup.
All set! Bazarr is running.