Skip to content

Comments

Add radarr config option for setting minimum availability#212

Closed
Jno21 wants to merge 3 commits intonylonee:mainfrom
Jno21:add-config-for-minimum-availability-for-movies
Closed

Add radarr config option for setting minimum availability#212
Jno21 wants to merge 3 commits intonylonee:mainfrom
Jno21:add-config-for-minimum-availability-for-movies

Conversation

@Jno21
Copy link

@Jno21 Jno21 commented Apr 13, 2025

Description

I was noticing that some movies that my family added to the Plex Watchlist weren't being downloaded automatically. Upon further investigation, this was because they had not been fully released, and instead were just released in cinemas. Currently Overseerr offers a configuration option for setting a minimum availability for media requests in Radarr, so I thought it'd be appropriate to have an option for this in Watchlistarr as well.

Contributor:

Took the PR of AhmedNSidd - #149. To update test.

Checklist

  • Documentation Updated
  • sbt scalafmtAll Run (and optionally sbt scalafmtSbt)
  • At least one approval from a codeowner

Summary by CodeRabbit

  • New Features
    • Introduced a new Radarr configuration option, "minimumAvailability," which lets users specify the media availability status for processing.
    • The option supports multiple statuses (e.g., TBA, announced, in cinemas, released, deleted) with a default of "released," providing greater flexibility in media management.

@coderabbitai
Copy link

coderabbitai bot commented Apr 13, 2025

Walkthrough

The changes introduce a new configuration option for Radarr by adding a minimumAvailability parameter. This update spans multiple components: the YAML configuration template now includes a commented option with a default value of "released", while various Scala files have been updated. A new field is added to both the configuration case classes and the Radarr data model. Additionally, the configuration retrieval, redaction, and API call in Radarr have been modified to incorporate the new parameter.

Changes

File(s) Change Summary
src/main/resources/config-template.yaml Added a commented configuration option minimumAvailability (default "released") with possible values: "tba", "announced", "inCinemas", "released", and "deleted".
src/main/scala/configuration/Configuration.scala
src/main/scala/configuration/ConfigurationRedactor.scala
src/main/scala/configuration/ConfigurationUtils.scala
src/main/scala/configuration/Keys.scala
Introduced a new configuration field/variable radarrMinimumAvailability in the Radarr configuration: new field in the case class, inclusion in the redaction output, retrieval from configuration with default "released", and a new constant key defined.
src/main/scala/radarr/RadarrPost.scala
src/main/scala/radarr/RadarrUtils.scala
Added a new field minimumAvailability to RadarrPost and integrated the radarrMinimumAvailability value into the API call through modifications in addToRadarr.
src/test/scala/PlexTokenSyncSpec.scala Added radarrMinimumAvailability configuration parameter in createConfiguration method and included it in movie JSON representations for testing.
src/test/scala/configuration/ConfigurationUtilsSpec.scala Introduced radarrMinimumAvailability as an optional parameter in createMockConfigReader method with a default value of Some("released").

Sequence Diagram(s)

sequenceDiagram
    participant User as User/Application
    participant CU as ConfigUtils
    participant RC as RadarrConfiguration
    participant RP as RadarrPost
    participant API as Radarr API

    User->>CU: Load configuration
    CU->>RC: Populate fields (including radarrMinimumAvailability)
    RC->>RP: Create RadarrPost object with minimumAvailability
    User->>RP: Trigger API call via addToRadarr
    RP->>API: Send Radarr request with minimumAvailability included
    API-->>RP: Return response
Loading

Poem

I'm a rabbit, hopping with glee,
A brand new config now sets us free.
With "released" as the default crown,
New fields and keys all spread around.
Code carrots crunch — let bugs flee! 🐰🌟

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bdaa76a and eb5d31b.

📒 Files selected for processing (2)
  • src/test/scala/PlexTokenSyncSpec.scala (4 hunks)
  • src/test/scala/configuration/ConfigurationUtilsSpec.scala (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/test/scala/configuration/ConfigurationUtilsSpec.scala (2)
src/main/scala/configuration/FileAndSystemPropertyReader.scala (1)
  • getConfigOption (52-58)
src/main/scala/configuration/SystemPropertyReader.scala (1)
  • getConfigOption (4-4)
🔇 Additional comments (6)
src/test/scala/PlexTokenSyncSpec.scala (4)

49-49: Configuration parameter addition looks good

The new parameter radarrMinimumAvailability = "released" has been properly added to the RadarrConfiguration object. This aligns with the PR objective of adding minimum availability settings for Radarr.


170-170: Movie JSON update is appropriate

The minimumAvailability parameter has been correctly included in the first movie JSON object, with a value consistent with the configuration parameter.


184-184: Movie JSON update is appropriate

The minimumAvailability parameter has been correctly included in the second movie JSON object, maintaining consistency with the configuration.


198-198: Movie JSON update is appropriate

The minimumAvailability parameter has been correctly included in the third movie JSON object, ensuring consistency across all movie entries.

src/test/scala/configuration/ConfigurationUtilsSpec.scala (2)

175-175: Parameter addition in mock reader is correct

The new parameter radarrMinimumAvailability has been properly added to the createMockConfigReader method with an appropriate default value of Some("released"), which aligns with the implementation in other parts of the codebase.


194-197: Configuration expectation is correctly implemented

The expectation for Keys.radarrMinimumAvailability is properly set up in the mock configuration reader. The implementation follows the pattern used for other configuration parameters in this class.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Jno21 Jno21 changed the title Add config for minimum availability for movies Add radarr config option for setting minimum availability Apr 13, 2025
@Jno21 Jno21 marked this pull request as ready for review April 13, 2025 12:16
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/main/resources/config-template.yaml (1)

57-59: Looks good, but please remove trailing whitespace.

The new configuration option is well-documented with clear explanations of its purpose and possible values. However, there are trailing spaces on lines 57 and 58 that should be removed.

-## Defines when your Radarr should look for this particular item. DEFAULT: "released". POSSIBLE VALUES: "tba", "announced", "inCinemas", "released", "deleted" 
-#  minimumAvailability: "released" 
+## Defines when your Radarr should look for this particular item. DEFAULT: "released". POSSIBLE VALUES: "tba", "announced", "inCinemas", "released", "deleted"
+#  minimumAvailability: "released"
🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 57-57: trailing spaces

(trailing-spaces)


[error] 58-58: trailing spaces

(trailing-spaces)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dc9ef85 and bdaa76a.

📒 Files selected for processing (7)
  • src/main/resources/config-template.yaml (1 hunks)
  • src/main/scala/configuration/Configuration.scala (1 hunks)
  • src/main/scala/configuration/ConfigurationRedactor.scala (1 hunks)
  • src/main/scala/configuration/ConfigurationUtils.scala (2 hunks)
  • src/main/scala/configuration/Keys.scala (1 hunks)
  • src/main/scala/radarr/RadarrPost.scala (1 hunks)
  • src/main/scala/radarr/RadarrUtils.scala (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/main/scala/configuration/ConfigurationUtils.scala (2)
src/main/scala/configuration/FileAndSystemPropertyReader.scala (1)
  • getConfigOption (52-58)
src/main/scala/configuration/SystemPropertyReader.scala (1)
  • getConfigOption (4-4)
🪛 YAMLlint (1.35.1)
src/main/resources/config-template.yaml

[error] 57-57: trailing spaces

(trailing-spaces)


[error] 58-58: trailing spaces

(trailing-spaces)

🔇 Additional comments (7)
src/main/scala/configuration/Configuration.scala (1)

31-31: Looks good: New configuration field correctly added.

Adding the radarrMinimumAvailability field to the RadarrConfiguration case class follows the existing naming convention and is well-integrated with the existing structure.

src/main/scala/radarr/RadarrPost.scala (1)

8-8: Looks good: New Radarr API field added.

The minimumAvailability field has been properly added to the RadarrPost case class and will be included in the API request to Radarr.

src/main/scala/configuration/ConfigurationRedactor.scala (1)

23-23: Looks good: Configuration redactor updated to include new field.

The new field is correctly added to the string representation of the configuration, maintaining consistent formatting with other fields.

src/main/scala/configuration/Keys.scala (1)

14-20: LGTM! The addition of the radarrMinimumAvailability key is clean and follows the existing pattern.

The new constant has been properly added to the Radarr-related keys section with consistent naming and formatting, maintaining the established pattern of the codebase.

src/main/scala/configuration/ConfigurationUtils.scala (2)

38-40: LGTM! The radarrMinimumAvailability configuration retrieval looks good.

The new variable is properly initialized with a sensible default value of "released" and follows the same pattern as other configuration options. The code formatting for the surrounding variables has been adjusted to maintain consistent alignment.


69-69: LGTM! The RadarrConfiguration constructor parameter has been properly added.

The new parameter is correctly passed to the RadarrConfiguration constructor, ensuring the configuration value is available throughout the application.

src/main/scala/radarr/RadarrUtils.scala (1)

38-38: LGTM! The minimumAvailability parameter is correctly passed to the RadarrPost constructor.

This change completes the implementation by passing the new configuration value to the RadarrPost object, which will be used in the API call to Radarr.

@Jno21
Copy link
Author

Jno21 commented Apr 13, 2025

This should fix the test from the PR #149. @nylonee tell me if that seems correct to you (I never did scala). This feature is a must so it would be good to see it :)

Copy link

@AhmedNSidd AhmedNSidd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the tests! I looked over the changes and they look good to me. If we can get this merged in, we can close the original PR without merging.

@Jno21
Copy link
Author

Jno21 commented May 4, 2025

Up @nylonee

@Jno21 Jno21 closed this by deleting the head repository Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants