feat: improve Bazarr configuration

This commit is contained in:
Adrien Poupa 2024-03-09 15:35:24 -05:00
parent 298b53a81e
commit 5e8692abf2
5 changed files with 70 additions and 44 deletions

View File

@ -28,6 +28,7 @@ SONARR_API_KEY=
RADARR_API_KEY= RADARR_API_KEY=
LIDARR_API_KEY= LIDARR_API_KEY=
PROWLARR_API_KEY= PROWLARR_API_KEY=
BAZARR_API_KEY=
JELLYFIN_API_KEY= JELLYFIN_API_KEY=
JELLYSEERR_API_KEY= JELLYSEERR_API_KEY=
SABNZBD_API_KEY= SABNZBD_API_KEY=

1
.gitignore vendored
View File

@ -9,6 +9,7 @@ docker-compose.override.yml
/radarr /radarr
/prowlarr /prowlarr
/lidarr /lidarr
/bazarr
/qbittorrent /qbittorrent
/pia /pia
/pia-shared /pia-shared

View File

@ -56,7 +56,7 @@ I am running it in Ubuntu Server 22.04; I also tested this setup on a [Synology
## Applications ## Applications
| **Application** | **Description** | **Image** | **URL** | | **Application** | **Description** | **Image** | **URL** |
|-------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|--------------| |--------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|--------------|
| [Sonarr](https://sonarr.tv) | PVR for newsgroup and bittorrent users | [linuxserver/sonarr](https://hub.docker.com/r/linuxserver/sonarr) | /sonarr | | [Sonarr](https://sonarr.tv) | PVR for newsgroup and bittorrent users | [linuxserver/sonarr](https://hub.docker.com/r/linuxserver/sonarr) | /sonarr |
| [Radarr](https://radarr.video) | Movie collection manager for Usenet and BitTorrent users | [linuxserver/radarr](https://hub.docker.com/r/linuxserver/radarr) | /radarr | | [Radarr](https://radarr.video) | Movie collection manager for Usenet and BitTorrent users | [linuxserver/radarr](https://hub.docker.com/r/linuxserver/radarr) | /radarr |
| [Bazarr](https://www.bazarr.media/) | Companion application to Sonarr and Radarr that manages and downloads subtitles | [linuxserver/bazarr](https://hub.docker.com/r/linuxserver/bazarr) | /bazarr | | [Bazarr](https://www.bazarr.media/) | Companion application to Sonarr and Radarr that manages and downloads subtitles | [linuxserver/bazarr](https://hub.docker.com/r/linuxserver/bazarr) | /bazarr |
@ -90,7 +90,6 @@ For the first time, run `./update-config.sh` to update the applications base URL
Get your qBittorrent password from `docker compose logs qbittorrent` and change it in the UI and in `.env.` Get your qBittorrent password from `docker compose logs qbittorrent` and change it in the UI and in `.env.`
If you want to show Jellyfin information in the homepage, create it in Jellyfin settings and fill `JELLYFIN_API_KEY`. If you want to show Jellyfin information in the homepage, create it in Jellyfin settings and fill `JELLYFIN_API_KEY`.
If you want to show Bazarr information in the homepage, open `./bazarr/config/config.yml`, find the apikey line and copy it in your .env file in a new line: `BAZARR_API_KEY='your_bazar_api_key'`
## Environment Variables ## Environment Variables
@ -124,6 +123,7 @@ If you want to show Bazarr information in the homepage, open `./bazarr/config/co
| `RADARR_API_KEY` | Radarr API key to show information in the homepage | | | `RADARR_API_KEY` | Radarr API key to show information in the homepage | |
| `LIDARR_API_KEY` | Lidarr API key to show information in the homepage | | | `LIDARR_API_KEY` | Lidarr API key to show information in the homepage | |
| `PROWLARR_API_KEY` | Prowlarr API key to show information in the homepage | | | `PROWLARR_API_KEY` | Prowlarr API key to show information in the homepage | |
| `BAZARR_API_KEY` | Bazarr API key to show information in the homepage | |
| `JELLYFIN_API_KEY` | Jellyfin API key to show information in the homepage | | | `JELLYFIN_API_KEY` | Jellyfin API key to show information in the homepage | |
| `JELLYSEERR_API_KEY` | Jellyseer API key to show information in the homepage | | | `JELLYSEERR_API_KEY` | Jellyseer API key to show information in the homepage | |
| `SABNZBD_API_KEY` | Sabnzbd API key to show information in the homepage | | | `SABNZBD_API_KEY` | Sabnzbd API key to show information in the homepage | |
@ -152,7 +152,7 @@ The location of the server it will connect to is set by `LOC=ca`, defaulting to
You need to fill the credentials in the `PIA_*` environment variable, You need to fill the credentials in the `PIA_*` environment variable,
otherwise the VPN container will exit and qBittorrent will not start. otherwise the VPN container will exit and qBittorrent will not start.
## Sonarr, Radarr, Lidarr & Bazarr ## Sonarr, Radarr & Lidarr
### File Structure ### File Structure

View File

@ -30,7 +30,7 @@ services:
- traefik.http.middlewares.joplin-stripprefix.stripPrefix.prefixes=/joplin - traefik.http.middlewares.joplin-stripprefix.stripPrefix.prefixes=/joplin
- traefik.http.services.joplin.loadbalancer.server.port=22300 - traefik.http.services.joplin.loadbalancer.server.port=22300
- homepage.group=Apps - homepage.group=Apps
- homepage.name=joplin - homepage.name=Joplin
- homepage.icon=joplin.png - homepage.icon=joplin.png
- homepage.href=/joplin - homepage.href=/joplin
- homepage.description=Note-taking application - homepage.description=Note-taking application

View File

@ -2,30 +2,54 @@
# See https://stackoverflow.com/a/44864004 for the sed GNU/BSD compatible hack # See https://stackoverflow.com/a/44864004 for the sed GNU/BSD compatible hack
function update_config { function update_arr_config {
echo "Updating ${1^} configuration..." echo "Updating ${container^} configuration..."
until [ -f ./$1/config.xml ] until [ -f ./"$container"/config.xml ]
do do
sleep 5 sleep 1
done done
sed -i.bak "s/<UrlBase><\/UrlBase>/<UrlBase>\/$1<\/UrlBase>/" ./$1/config.xml && rm ./$1/config.xml.bak sed -i.bak "s/<UrlBase><\/UrlBase>/<UrlBase>\/$1<\/UrlBase>/" ./"$container"/config.xml && rm ./"$container"/config.xml.bak
sed -i.bak 's/^'"${1^^}"'_API_KEY=.*/'"${1^^}"'_API_KEY='"$(sed -n 's/.*<ApiKey>\(.*\)<\/ApiKey>.*/\1/p' ./$1/config.xml)"'/' .env && rm .env.bak sed -i.bak 's/^'"${container^^}"'_API_KEY=.*/'"${1^^}"'_API_KEY='"$(sed -n 's/.*<ApiKey>\(.*\)<\/ApiKey>.*/\1/p' ./"$container"/config.xml)"'/' .env && rm .env.bak
echo "Update of ${1^} configuration complete." echo "Update of ${container^} configuration complete."
echo "Restarting ${1^}..." echo "Restarting ${container^}..."
docker compose restart $1 docker compose restart "$container"
}
function update_jellyfin_config {
echo "Updating ${container^} configuration..."
until [ -f ./"$container"/network.xml ]; do
sleep 1
done
sed -i.bak "s/<BaseUrl \/>/<BaseUrl>\/$container<\/BaseUrl>/" ./"$container"/network.xml && rm ./"$container"/network.xml.bak
echo "Update of ${container^} configuration complete."
echo "Restarting ${container^}..."
docker compose restart "$container"
}
function update_bazarr_config {
echo "Updating ${container^} configuration..."
until [ -f ./"$container"/config/config/config.yaml ]; do
sleep 1
done
sed -i.bak "s/base_url: ''/base_url: '\/$container'/" ./"$container"/config/config/config.yaml && rm ./"$container"/config/config/config.yaml.bak
sed -i.bak "s/use_radarr: false/use_radarr: true/" ./"$container"/config/config/config.yaml && rm ./"$container"/config/config/config.yaml.bak
sed -i.bak "s/use_sonarr: false/use_sonarr: true/" ./"$container"/config/config/config.yaml && rm ./"$container"/config/config/config.yaml.bak
SONARR_API_KEY=$(sed -n 's/.*<ApiKey>\(.*\)<\/ApiKey>.*/\1/p' ./sonarr/config.xml)
sed -i.bak "/sonarr:/,/^radarr:/ { s/apikey: .*/apikey: $SONARR_API_KEY/; s/base_url: .*/base_url: \/sonarr/; s/ip: .*/ip: sonarr/ }" "$container"/config/config/config.yaml && rm ./"$container"/config/config/config.yaml.bak
RADARR_API_KEY=$(sed -n 's/.*<ApiKey>\(.*\)<\/ApiKey>.*/\1/p' ./radarr/config.xml)
sed -i.bak "/radarr:/,/^sonarr:/ { s/apikey: .*/apikey: $RADARR_API_KEY/; s/base_url: .*/base_url: \/radarr/; s/ip: .*/ip: radarr/ }" "$container"/config/config/config.yaml && rm ./"$container"/config/config/config.yaml.bak
sed -i.bak 's/^'"${container^^}"'_API_KEY=.*/'"${container^^}"'_API_KEY='"$(sed -n 's/.*apikey: \(.*\)*/\1/p' ./"$container"/config/config/config.yaml | head -n 1)"'/' .env && rm .env.bak
echo "Update of ${container^} configuration complete."
echo "Restarting ${container^}..."
docker compose restart "$container"
} }
for container in $(docker ps --format '{{.Names}}'); do for container in $(docker ps --format '{{.Names}}'); do
if [[ $container =~ ^(radarr|sonarr|lidarr|prowlarr)$ ]]; then if [[ "$container" =~ ^(radarr|sonarr|lidarr|prowlarr)$ ]]; then
update_config $container update_arr_config "$container"
elif [[ $container =~ ^(jellyfin)$ ]]; then elif [[ "$container" =~ ^(jellyfin)$ ]]; then
echo "Updating ${container^} configuration..." update_jellyfin_config "$container"
until [ -f ./$container/network.xml ]; do elif [[ "$container" =~ ^(bazarr)$ ]]; then
sleep 5 update_bazarr_config "$container"
done
sed -i.bak "s/<BaseUrl \/>/<BaseUrl>\/$container<\/BaseUrl>/" ./$container/network.xml && rm ./$container/network.xml.bak
echo "Update of ${container^} configuration complete."
echo "Restarting ${container^}..."
docker compose restart $container
fi fi
done done