Skip to content

Commit 0f9027e

Browse files
authored
Merge pull request #86 from kiranshila/develop
Merge in develop
2 parents 96bc1f7 + bd7587e commit 0f9027e

File tree

8 files changed

+17
-11
lines changed

8 files changed

+17
-11
lines changed

config.edn

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
; :radarr/rootfolder ""
1313
; :sonarrr/language-profile ""
1414
; :sonarr/rootfolder ""
15+
; :sonarr/season-folders true
1516
; :discord/max-results 10
1617
; :overseerr/default-id 1
1718
; :log-level :trace

docs/configuration.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,14 @@ web interface to Overseerr if you need more features.
3838
## Optional Settings
3939

4040
| Environment Variable (Docker) | Config File Keyword | Type | Default Value | Description |
41-
| ------------------------------ | ------------------------------ | ------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
41+
|--------------------------------|--------------------------------|---------|---------------|---------------------------------------------------------------------------------------------------------------------------------------------|
4242
| `DISCORD__MAX_RESULTS` | `:discord/max-results` | Integer | `25` | Sets the maximum size of the search results selection |
4343
| `DISCORD__REQUESTED_MSG_STYLE` | `:discord/requested-msg-style` | Keyword | `:plain` | Sets the style of the request alert message. One of `:plain :embed :none` |
4444
| `SONARR__QUALITY_PROFILE` | `:sonarr/quality-profile` | String | N/A | The name of the quality profile to use by default for Sonarr |
4545
| `RADARR__QUALITY_PROFILE` | `:radarr/quality-profile` | String | N/A | The name of the quality profile to use by default for Radarr |
4646
| `SONARR__ROOTFOLDER` | `:sonarr/rootfolder` | String | N/A | The root folder to use by default for Sonarr |
4747
| `RADARR__ROOTFOLDER` | `:radarr/rootfolder` | String | N/A | The root folder to use by default for Radarr |
48+
| `SONARR__SEASON_FOLDERS` | `:sonarr/season-folders` | Boolean | `false` | Sets whether you're using season folders in Sonarr |
4849
| `SONARR__LANGUAGE_PROFILE` | `:sonarr/language-profile` | String | N/A | The name of the language profile to use by default for Sonarr |
4950
| `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 |
5051
| `PARTIAL_SEASONS` | `:partial-seasons` | Boolean | `true` | Sets whether users can request partial seasons. |

src/doplarr/backends/sonarr.clj

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@
2626
(hash-map :id ssn :name (str ssn)))))
2727
{:keys [sonarr/language-profile
2828
sonarr/quality-profile
29+
sonarr/season-folders
2930
partial-seasons
30-
sonarr/rootfolder
31-
]} @state/config
32-
31+
sonarr/rootfolder]} @state/config
3332
default-profile-id (utils/id-from-name quality-profiles quality-profile)
3433
default-language-id (utils/id-from-name language-profiles language-profile)
3534
default-root-folder (utils/id-from-name rootfolders rootfolder)]
@@ -39,7 +38,8 @@
3938
(warn "Default language profile in config doesn't exist in backend, check spelling"))
4039
(when (and rootfolder (nil? default-root-folder))
4140
(warn "Default root folder in config doesn't exist in backend, check spelling"))
42-
{:season (cond
41+
{:season-folder (if (nil? season-folders) false season-folders)
42+
:season (cond
4343
(= 1 (count seasons)) (:id (first seasons))
4444
(false? partial-seasons) -1
4545
:else (conj seasons {:name "All Seasons" :id -1}))

src/doplarr/config.clj

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
:sonarr/quality-profile
1515
:sonarr/language-profile
1616
:sonarr/rootfolder
17+
:sonarr/season-folders
1718
; Radarr
1819
:radarr/url
1920
:radarr/api

src/doplarr/config/specs.clj

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
(spec/def :sonarr/quality-profile string?)
2929
(spec/def :sonarr/language-profile string?)
3030
(spec/def :sonarr/rootfolder string?)
31+
(spec/def :sonarr/season-folders boolean?)
3132

3233
; Overseerr optionals
3334
(spec/def :overseerr/default-id pos-int?)
@@ -56,6 +57,7 @@ If you have configured one, make sure to check spelling. A valid configuration c
5657
:radarr/quality-profile
5758
:sonarr/quality-profile
5859
:sonarr/language-profile
60+
:sonarr/season-folders
5961
:overseerr/default-id
6062
:sonarr/rootfolder
6163
:radarr/rootfolder]

src/doplarr/core.clj

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767

6868
(defn setup-config! []
6969
(reset! state/config (config/valid-config (load-env)))
70-
(timbre/merge-config! {:min-level [[#{"*"} (:log-level @state/config :info)]]}))
70+
(timbre/merge-config! {:min-level [[#{"*"} (:log-level @state/config :info)]]
71+
:output-fn (partial timbre/default-output-fn {:stacktrace-fonts {}})}))
7172

7273
(defn startup! []
7374
(setup-config!)

src/doplarr/discord.clj

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
[clojure.string :as str]
55
[com.rpl.specter :as s]
66
[discljord.messaging :as m]
7-
[doplarr.state :as state]
87
[doplarr.utils :as utils]
98
[fmnoise.flow :as flow :refer [else]]
109
[taoensso.timbre :refer [fatal]]))
@@ -72,7 +71,7 @@
7271
:style 1
7372
:custom_id (str "option-page:" uuid ":" option "-" page)
7473
:disabled false
75-
:label label})
74+
:label (apply str (take MAX-CHARACTERS label))})
7675

7776
(defn select-menu-option [index result]
7877
{:label (apply str (take MAX-CHARACTERS (or (:title result) (:name result))))
@@ -112,7 +111,7 @@
112111
(defn dropdown-result [interaction]
113112
(Integer/parseInt (s/select-one [:payload :values 0] interaction)))
114113

115-
(defn request-embed [{:keys [media-type title overview poster season quality-profile language-profile rootfolder tag]}]
114+
(defn request-embed [{:keys [media-type title overview poster season quality-profile language-profile rootfolder]}]
116115
{:title title
117116
:description overview
118117
:image {:url poster}

src/doplarr/utils.clj

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818

1919
(defn http-request [method url key & [params]]
2020
(let [chan (a/promise-chan)
21-
put (partial a/put! chan)]
21+
put (fn [v]
22+
(trace "HTTP Response " v)
23+
(a/put! chan v))]
2224
(trace "Performing HTTP request" method url params)
2325
(hc/request
2426
(deep-merge
@@ -27,7 +29,6 @@
2729
:as :json-string-keys
2830
:coerce :always
2931
:async? true
30-
:http-client {:redirect-policy :normal}
3132
:headers {"X-API-Key" key}}
3233
params)
3334
put

0 commit comments

Comments
 (0)