Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow configuration for choosing to delete files #154

Merged
merged 2 commits into from
Jun 2, 2024
Merged

Conversation

nylonee
Copy link
Owner

@nylonee nylonee commented Jun 2, 2024

Description

Configuration to allow choosing whether files should be deleted off the system, or just the content from the Sonarr/Radarr database

Checklist

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

Copy link

coderabbitai bot commented Jun 2, 2024

Warning

Review failed

The pull request is closed.

Walkthrough

The changes introduce a deleteFiles boolean parameter to the functions responsible for deleting movies and series from Radarr and Sonarr in the PlexTokenDeleteSync project. This parameter is propagated through various configuration files and utility functions, allowing users to specify whether the associated files should be deleted when a movie or series is removed.

Changes

File(s) Change Summary
src/main/scala/PlexTokenDeleteSync.scala Added deleteFiles parameter to deleteMovie and deleteSeries functions.
src/main/scala/configuration/Configuration.scala Added deleteFiles field to DeleteConfiguration case class.
src/main/scala/configuration/ConfigurationRedactor.scala Included deleteFiles in the redaction logic.
src/main/scala/configuration/ConfigurationUtils.scala Introduced deleteFiles configuration option with a default value of true.
src/main/scala/configuration/Keys.scala Added deleteFiles constant to Keys object.
src/main/scala/radarr/RadarrUtils.scala Updated deleteFromRadarr and deleteToArr methods to include deleteFiles parameter.
src/main/scala/sonarr/SonarrUtils.scala Updated deleteFromSonarr and deleteToArr methods to include deleteFiles parameter.
src/test/scala/PlexTokenSyncSpec.scala Added deleteFiles parameter to configuration setup in tests.
src/test/scala/configuration/ConfigurationUtilsSpec.scala Included deleteFiles in the mock configuration reader.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant PlexTokenDeleteSync
    participant RadarrUtils
    participant SonarrUtils
    participant Configuration

    User->>PlexTokenDeleteSync: Request to delete movie/series
    PlexTokenDeleteSync->>Configuration: Retrieve deleteFiles setting
    Configuration-->>PlexTokenDeleteSync: Return deleteFiles value
    PlexTokenDeleteSync->>RadarrUtils: deleteFromRadarr(client, config, deleteFiles)
    RadarrUtils->>SonarrUtils: deleteFromSonarr(client, config, deleteFiles)
    SonarrUtils-->>PlexTokenDeleteSync: Confirm deletion
    PlexTokenDeleteSync-->>User: Acknowledge deletion
Loading

Poem

In the code where movies dwell,
A change has come, a tale to tell.
With deleteFiles, a boolean true,
To clean up files, or let them stew.
Radarr, Sonarr, now they know,
To keep or let the data go.
A rabbit's work, so neat and clear,
To make your Plex house full of cheer. 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

@nylonee nylonee mentioned this pull request Jun 2, 2024
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: 1

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c3ed7b0 and 313a89d.

Files ignored due to path filters (1)
  • src/main/resources/config-template.yaml is excluded by !**/*.yaml
Files selected for processing (9)
  • src/main/scala/PlexTokenDeleteSync.scala (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/RadarrUtils.scala (2 hunks)
  • src/main/scala/sonarr/SonarrUtils.scala (1 hunks)
  • src/test/scala/PlexTokenSyncSpec.scala (1 hunks)
  • src/test/scala/configuration/ConfigurationUtilsSpec.scala (1 hunks)
Additional comments not posted (8)
src/main/scala/configuration/Keys.scala (1)

30-30: The addition of the deleteFiles key is consistent with existing naming conventions and supports the new feature well.

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

46-47: The addition of the deleteFiles field to the DeleteConfiguration case class is implemented correctly and aligns with the new feature requirements.

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

37-37: The inclusion of the deleteFiles configuration in the redactToString method is appropriate and ensures that all relevant configuration details are visible for debugging and logging purposes.

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

53-61: The updates to the deleteFromRadarr and deleteToArr methods correctly incorporate the deleteFiles parameter, allowing for conditional file deletion based on the new configuration setting.

Also applies to: 88-90

src/main/scala/sonarr/SonarrUtils.scala (1)

56-64: The updates to the deleteFromSonarr and deleteToArr methods correctly incorporate the deleteFiles parameter, allowing for conditional file deletion based on the new configuration setting.

Also applies to: 71-73

src/main/scala/PlexTokenDeleteSync.scala (1)

72-72: The updates to the deleteMovie and deleteSeries methods in PlexTokenDeleteSync correctly use the deleteFiles parameter from the configuration to control file deletion, aligning with the new feature's requirements.

Also applies to: 80-82

src/test/scala/PlexTokenSyncSpec.scala (1)

63-64: The addition of deleteFiles parameter with a default value of true aligns with the new feature. Ensure this default behavior is documented in the user guide or API docs.

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

Line range hint 49-82: The addition of deleteFiles parameter with a default value of true in the create method is consistent with the new feature. Ensure this default behavior is documented in the user guide or API docs.

@nylonee nylonee merged commit d83d235 into main Jun 2, 2024
1 check passed
@nylonee nylonee deleted the config-delete-files branch June 2, 2024 19:00
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.

1 participant