Skip to content

Commit

Permalink
Made max-results an optional setting
Browse files Browse the repository at this point in the history
  • Loading branch information
kiranshila committed Aug 14, 2021
1 parent 0d23ebc commit 615dedd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ docker run \
-e RADARR_URL='http://localhost:7878' \
-e SONARR_API='sonarr_api' \
-e RADARR_API='radarr_api' \
-e MAX_RESULTS=10 \
-e BOT_TOKEN='bot_token' \
-e ROLE_ID='role_id' \
--name doplarr ghcr.io/kiranshila/doplarr:main
Expand All @@ -83,9 +82,18 @@ To skip the build, just download `Doplarr.jar` and `config.edn` from the release

1. Fill out `config.edn` with the requisite things

You can optionally provide `:radarr-profile-id` and `:sonarr-profile-id` to
specify which profile movies/series will be requested with - otherwise the
lowest-valued profile ID is used.
### Optional Settings

By default, the profile for which requests will be made will be the
lowest-indexed (first) in your list of profiles. For me, this is the default
Any. You can change this by adding the config option `:radarr-profile-id` (or
`RADARR_PROFILE_ID` if you are using environment variables (docker) instead of
the config file) to the integer of the profile. This is however not exposed in the GUI for some reason,
so you'll have to use the Radarr API tool to find it. I plan on making this
nicer as this is creating some bugs.

Also, I'm limiting the size of the results in the drop down to 10, this can be
set with `:max-results` in the config file of `MAX_RESULTS` as an environment variable.

### Setting up on Windows

Expand Down
1 change: 0 additions & 1 deletion config.edn
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
:sonarr-api "sonarr_api_kei"
:radarr-url "http://localhost:7878"
:radarr-api "radarr_api_kei"
:max-results 10
:bot-token "bot_token"
:role-id "role_id"}
6 changes: 5 additions & 1 deletion src/doplarr/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@
:options (conj (map #(hash-map :label (str "Season: " %) :value %) (sonarr/missing-seasons series))
{:label "All Seasons" :value "-1"})}]}]})

(defn max-results []
(or (:max-results env)
10))

(defn start-request [interaction]
(let [uuid (str (java.util.UUID/randomUUID))
id (:id interaction)
Expand All @@ -192,7 +196,7 @@
:movie :monitored)
results (->> (perform-search request-term)
(filter (complement filter-aquired))
(take (:max-results env))
(take (max-results))
(into []))]
; Update the cache with these results
(swap! cache assoc-in [uuid :results] results)
Expand Down

0 comments on commit 615dedd

Please sign in to comment.