add configuration option for default root folder

untested
This commit is contained in:
Luciano Laratelli
2022-03-23 19:48:52 -04:00
parent 1c78ab8ea6
commit cf6f7a41c2
5 changed files with 31 additions and 15 deletions

View File

@@ -125,7 +125,7 @@ doplarr:
- RADARR__API=radarr_api
- DISCORD__TOKEN=bot_token
container_name: doplarr
image: 'ghcr.io/kiranshila/doplarr:latest'
image: "ghcr.io/kiranshila/doplarr:latest"
```
## Building and Running Locally
@@ -143,16 +143,18 @@ To skip the build, just download `Doplarr.jar` and `config.edn` from the release
### Optional Settings
| Environment Variable (Docker) | Config File Keyword | Type | Default Value | Description |
| ------------------------------ | ------------------------------ | ------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `DISCORD__MAX_RESULTS` | `:discord/max-results` | Integer | `25` | Sets the maximum size of the search results selection |
| `DISCORD__ROLE_ID` | `:discord/role-id` | Long | N/A | The discord role id for users of the bot (omitting this lets everyone on the server use the bot) |
| `DISCORD__REQUESTED_MSG_STYLE` | `:discord/requested-msg-style` | Keyword | `:plain` | Sets the style of the request alert message. One of `:plain :embed :none` |
| `SONARR__QUALITY_PROFILE` | `:sonarr/quality-profile` | String | N/A | The name of the quality profile to use by default for Sonarr |
| `RADARR__QUALITY_PROFILE` | `:radarr/quality-profile` | String | N/A | The name of the quality profile to use by default for Radarr |
| `SONARR__LANGUAGE_PROFILE` | `:sonarr/language-profile` | String | N/A | The name of the language profile to use by default for Sonarr |
| `OVERSEERR__DEFAULT_ID` | `:overseerr/default-id` | Integer | N/A | The Overseerr user id to use by default if there is no associated discord account for the requester |
| `PARTIAL_SEASONS` | `:partial-seasons` | Boolean | `true` | Sets whether users can request partial seasons. |
| Environment Variable (Docker) | Config File Keyword | Type | Default Value | Description |
| ------------------------------ | ------------------------------ | ------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `DISCORD__MAX_RESULTS` | `:discord/max-results` | Integer | `25` | Sets the maximum size of the search results selection |
| `DISCORD__ROLE_ID` | `:discord/role-id` | Long | N/A | The discord role id for users of the bot (omitting this lets everyone on the server use the bot) |
| `DISCORD__REQUESTED_MSG_STYLE` | `:discord/requested-msg-style` | Keyword | `:plain` | Sets the style of the request alert message. One of `:plain :embed :none` |
| `SONARR__QUALITY_PROFILE` | `:sonarr/quality-profile` | String | N/A | The name of the quality profile to use by default for Sonarr |
| `RADARR__QUALITY_PROFILE` | `:radarr/quality-profile` | String | N/A | The name of the quality profile to use by default for Radarr |
| `SONARR__ROOT_FOLDER` | `:sonarr/root-folder` | String | N/A | The root folder to use by default for Sonarr |
| `RADARR__ROOT_FOLDER` | `:radarr/root-folder` | String | N/A | The root folder to use by default for Radarr |
| `SONARR__LANGUAGE_PROFILE` | `:sonarr/language-profile` | String | N/A | The name of the language profile to use by default for Sonarr |
| `OVERSEERR__DEFAULT_ID` | `:overseerr/default-id` | Integer | N/A | The Overseerr user id to use by default if there is no associated discord account for the requester |
| `PARTIAL_SEASONS` | `:partial-seasons` | Boolean | `true` | Sets whether users can request partial seasons. |
| `LOG_LEVEL` | `:log-level` | Keyword | `:info` | The log level for the logging backend. This can be changed for debugging purposes. One of `:trace :debug :info :warn :error :fatal :report` |
### Setting up on Windows

View File

@@ -19,9 +19,12 @@
(let [quality-profiles (a/<! (impl/quality-profiles))
rootfolders (a/<! (impl/rootfolders))
{:keys [radarr/quality-profile]} @state/config
default-profile-id (utils/id-from-name quality-profiles quality-profile)]
default-profile-id (utils/id-from-name quality-profiles quality-profile)
default-root-folder (utils/id-from-name rootfolders rootfolders)]
(when (and quality-profile (nil? default-profile-id))
(warn "Default quality profile in config doesn't exist in backend, check spelling"))
(when (and rootfolders (nil? default-root-folder))
(warn "Default root folder in config doesn't exist in backend, check spelling"))
{:quality-profile-id
(cond
default-profile-id default-profile-id
@@ -29,6 +32,7 @@
:else quality-profiles)
:rootfolder-id
(cond
default-root-folder default-root-folder
(= 1 (count rootfolders)) (:id (first rootfolders))
:else rootfolders)})))

View File

@@ -28,11 +28,14 @@
sonarr/quality-profile
partial-seasons]} @state/config
default-profile-id (utils/id-from-name quality-profiles quality-profile)
default-language-id (utils/id-from-name language-profiles language-profile)]
default-language-id (utils/id-from-name language-profiles language-profile)
default-root-folder (utils/id-from-name rootfolders rootfolders)]
(when (and quality-profile (nil? default-profile-id))
(warn "Default quality profile in config doesn't exist in backend, check spelling"))
(when (and language-profile (nil? default-language-id))
(warn "Default language profile in config doesn't exist in backend, check spelling"))
(when (and rootfolders (nil? default-root-folder))
(warn "Default root folder in config doesn't exist in backend, check spelling"))
{:season (cond
(= 1 (count seasons)) (:id (first seasons))
(false? partial-seasons) -1
@@ -46,6 +49,7 @@
(= 1 (count language-profiles)) (:id (first language-profiles))
:else language-profiles)
:rootfolder-id (cond
default-root-folder default-root-folder
(= 1 (count rootfolders)) (:id (first rootfolders))
:else rootfolders)})))

View File

@@ -13,10 +13,12 @@
:sonarr/api
:sonarr/quality-profile
:sonarr/language-profile
:sonarr/root-folder
; Radarr
:radarr/url
:radarr/api
:radarr/quality-profile
:radarr/root-folder
; Overseerr
:overseerr/url
:overseerr/api

View File

@@ -23,10 +23,12 @@
; Radarr optionals
(spec/def :radarr/quality-profile string?)
(spec/def :sonarr/quality-profile string?)
(spec/def :radarr/root-folder string?)
; Sonarr optionals
(spec/def :sonarr/quality-profile string?)
(spec/def :sonarr/language-profile string?)
(spec/def :sonarr/root-folder string?)
; Overseerr optionals
(spec/def :overseerr/default-id pos-int?)
@@ -56,7 +58,9 @@ If you have configured one, make sure to check spelling. A valid configuration c
:radarr/quality-profile
:sonarr/quality-profile
:sonarr/language-profile
:overseerr/default-id]
:overseerr/default-id
:sonarr/root-folder
:radarr/root-folder]
:opt-un [::partial-seasons
::log-level])
::has-backend