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

Delete series from Sonarr #77

Merged
merged 3 commits into from
Jan 5, 2024
Merged

Delete series from Sonarr #77

merged 3 commits into from
Jan 5, 2024

Conversation

nylonee
Copy link
Owner

@nylonee nylonee commented Jan 5, 2024

Closes #17

Summary by CodeRabbit

  • New Features

    • Implemented full delete sync with the watchlist, controllable via new environment variables.
  • Enhancements

    • Updated Item class to include an optional 'ended' field and improved ID retrieval method.
    • Improved handling of TV show deletions in the sync process.
  • Documentation

    • Updated README with information about the new delete sync feature and environment variables.
  • Refactor

    • Adjusted control flow to accommodate new 'ended' field in item creation across various utilities and conversions.
  • Bug Fixes

    • Fixed logic to correctly delete series from the watchlist when conditions are met.

Copy link

coderabbitai bot commented Jan 5, 2024

Warning

Rate Limit Exceeded

@nylonee has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 3 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between 728e012 and d16cbee.

Walkthrough

The recent updates to Watchlistarr introduce the capability to fully sync with a user's watchlist, including the deletion of items that are no longer present. This feature, which is off by default, can be controlled with new environment variables. The codebase now includes adjustments across various Scala files to support this functionality, with changes to item deletion logic, case class fields, and method enhancements to enable the tracking and removal of content accordingly.

Changes

File Path Change Summary
README.md Added details about full delete sync support and new environment variables.
src/main/scala/PlexTokenDeleteSync.scala
src/main/scala/sonarr/SonarrUtils.scala
Updated control flow to handle deletion of shows and added new methods for deletion.
src/main/scala/model/Item.scala
src/main/scala/sonarr/SonarrSeries.scala
Included new optional ended field and updated methods to accommodate this field.
src/main/scala/plex/PlexUtils.scala
src/main/scala/radarr/RadarrConversions.scala
src/main/scala/sonarr/SonarrConversions.scala
Adjusted item construction logic to incorporate the ended parameter.
src/main/scala/sonarr/SonarrUtils.scala Modified to include new private and protected methods and an added import for MalformedMessageBodyFailure from org.http4s.

Assessment against linked issues

Objective Addressed Explanation
Delete movies/tv shows that have been removed from watchlist (#17) The code changes implement the functionality to delete items from the watchlist when they are removed, as described in the issue.

Poem

In the digital garden where watchlists grow,
A clever little rabbit hopped to and fro.
Pruning the shows that we no longer see,
Syncing our screens in delightful glee. 🐇💻✨

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's AI:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • 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 tests 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 from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid.
    • @coderabbitai read the files in the src/scheduler package and generate README in the markdown format.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 0d645fd and e4eca7a.
Files selected for processing (8)
  • README.md (2 hunks)
  • src/main/scala/PlexTokenDeleteSync.scala (2 hunks)
  • src/main/scala/model/Item.scala (2 hunks)
  • src/main/scala/plex/PlexUtils.scala (1 hunks)
  • src/main/scala/radarr/RadarrConversions.scala (1 hunks)
  • src/main/scala/sonarr/SonarrConversions.scala (1 hunks)
  • src/main/scala/sonarr/SonarrSeries.scala (1 hunks)
  • src/main/scala/sonarr/SonarrUtils.scala (2 hunks)
Additional comments: 13
src/main/scala/sonarr/SonarrConversions.scala (1)
  • 5-10: The inclusion of the ended property from SonarrSeries to Item creation in the toItem function is correctly implemented.
src/main/scala/sonarr/SonarrSeries.scala (1)
  • 3-9: The addition of id and ended fields to the SonarrSeries case class is correctly implemented.
src/main/scala/radarr/RadarrConversions.scala (1)
  • 6-10: The addition of the None parameter to the toItem function call in RadarrConversions.scala is correctly implemented to align with the new ended field in the Item class.
src/main/scala/model/Item.scala (3)
  • 3-3: The addition of the ended field to the Item case class with a default value of None is correctly implemented.

  • 13-14: The new getSonarrId method in the Item case class is correctly implemented to retrieve the Sonarr ID.

  • 16-20: The update to the matches method to include the new ended field in the pattern matching is correctly implemented.

src/main/scala/PlexTokenDeleteSync.scala (2)
  • 39-45: The modification in the control flow to call the deleteSeries method for "show" items instead of logging and returning a unit is correctly implemented.

  • 60-69: The addition of the new private method deleteSeries to handle the deletion of TV shows based on specific conditions is correctly implemented.

src/main/scala/sonarr/SonarrUtils.scala (2)
  • 52-63: The addition of the protected method deleteFromSonarr and its implementation using the new deleteToArr method is correctly implemented.

  • 65-73: The new private method deleteToArr in SonarrUtils.scala is correctly implemented to perform the deletion of items from Sonarr.

src/main/scala/plex/PlexUtils.scala (1)
  • 162-162: The modification to include an additional parameter ended in the construction of Item instances within the map function call is correctly implemented.
README.md (2)
  • 23-29: The documentation update in the README.md file to reflect the new full delete sync feature and how to enable it is correctly implemented.

  • 83-102: The addition of new environment variables ALLOW_ENDED_SHOW_DELETING and ALLOW_CONTINUING_SHOW_DELETING to control the behavior of the sync process is correctly documented.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 0d645fd and 728e012.
Files selected for processing (8)
  • README.md (2 hunks)
  • src/main/scala/PlexTokenDeleteSync.scala (2 hunks)
  • src/main/scala/model/Item.scala (2 hunks)
  • src/main/scala/plex/PlexUtils.scala (1 hunks)
  • src/main/scala/radarr/RadarrConversions.scala (1 hunks)
  • src/main/scala/sonarr/SonarrConversions.scala (1 hunks)
  • src/main/scala/sonarr/SonarrSeries.scala (1 hunks)
  • src/main/scala/sonarr/SonarrUtils.scala (2 hunks)
Files skipped from review as they are similar to previous changes (8)
  • README.md
  • src/main/scala/PlexTokenDeleteSync.scala
  • src/main/scala/model/Item.scala
  • src/main/scala/plex/PlexUtils.scala
  • src/main/scala/radarr/RadarrConversions.scala
  • src/main/scala/sonarr/SonarrConversions.scala
  • src/main/scala/sonarr/SonarrSeries.scala
  • src/main/scala/sonarr/SonarrUtils.scala

@nylonee nylonee merged commit 32101ae into main Jan 5, 2024
2 checks passed
@nylonee nylonee deleted the delete-series branch January 5, 2024 23:02
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.

Delete movies/tv shows that have been removed from watchlist
1 participant