# monitarr

A utility to remove and block stalled downloads in `lidarr`, `radarr` and `sonarr`.
`monitarr` will check for stalled downloads by keeping track of the bytes
transferred over a given time period (`timeout_minutes`). If no change in
transferred bytes is detected, it will remove and block the stalled download
and then initiate a search for a replacement.

## Usage

```bash
monitarr -b -i <index> -id <record id>
  # blocklist and search record id at configuration index

monitarr -c
  # display configuration

monitarr -h
  # display help

monitarr -l -i <index>
  # display server queue at configuration index

monitarr -r
  # run monitarr server

monitarr -s -i <index> -id <record id>
  # show record id details at configuration index

monitarr -t
  # test all server connectivity
```

## Initial setup

* Execute `monitarr -c` to create and display the initial configuration
* Modify the `config/monitarr.json` file to add your servers. The `id` field must
contain `lidarr`, `radarr` or `sonarr` but may include other characters to
uniquely identify the server instance for multi-server setups. Example:

```json
{
  "check_interval_minutes": 5,
  "server_list": [
    {
      "api_key": "<my api key>",
      "api_version": "v1",
      "id": "lidarr 1",
      "timeout_minutes": 1440,
      "url": "http://localhost:8686"
    },
    {
      "api_key": "<my api key>",
      "api_version": "v1",
      "id": "lidarr 2",
      "timeout_minutes": 1440,
      "url": "http://localhost:8687"
    },
    {
      "api_key": "<my api key>",
      "api_version": "v3",
      "id": "radarr",
      "timeout_minutes": 1440,
      "url": "http://localhost:7878"
    },
    {
      "api_key": "<my api key>",
      "api_version": "v3",
      "id": "sonarr",
      "timeout_minutes": 1440,
      "url": "http://localhost:8989"
    }
  ]
}
```

* Execute `monitarr -r` to continuously monitor the configured servers.

NOTE: All servers listed in the configuration file will be checked based on the
value of `check_interval_minutes`. If no change is detected in a queued item
within the `timeout_minutes` value, the download will be removed and blocked.

## Credits

Inspired by the work of the following project:
[ArrStalledHandler](https://github.com/tommyvange/ArrStalledHandler)

## Developer Public Key

```text
-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAqXedleDOugdk9sBpgFOA
0+MogIbBF7+iXIIHv8CRBbrrf8nxLSgQvbHQIP0EklebDgLZRgyGI3SSQYj7D957
uNf1//dpkELNzfuezgAyFer9+iH4Svq46HADp5k+ugaK0mMDZM7OLOgo7415/+z4
NIQopv8prMFdxkShr4e4dpR+S6LYMYMVjsi1gnYWaZJMWgzeZouXFSscS1/XDXSE
vr1Jfqme+RmB4Q2QqGcDrY2ijumCJYJzQqlwG6liJ4FNg0U3POTCQDhQmuUoEJe0
/dyiWlo48WQbBu6gUDHbTCCUSZPs2Lc9l65MqOCpX76+VXPYetZgqpMF4GVzb2y9
kETxFNpiMYBlOBZk0I1G33wqVmw46MI5IZMQ2z2F8Mzt1hByUNTgup2IQELCv1a5
a2ACs2TBRuAy1REeHhjLgiA/MpoGX7TpoHCGyo8jBChJVpP9ZHltKoChwDC+bIyx
rgYH3jYDkl2FFuAUJ8zAZl8U1kjqZb9HGq9ootMk34Dbo3IVkc2azB2orEP9F8QV
KxvZZDA9FAFEthSiNf5soJ6mZGLi0es5EWPoKMUEd9tG5bP980DySAWSSRK0AOfE
QShT/z7oG79Orxyomwrb8ZJCi7wEfcCuK1NWgqLVUgXhpi2J9WYS6DAbF3Oh3Hhl
DYSHlcfFBteqNDlR2uFInIECAwEAAQ==
-----END PUBLIC KEY-----
```
