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

QBT remove false link to torrent folder. #8628

Merged
merged 13 commits into from
Nov 24, 2023
Merged

QBT remove false link to torrent folder. #8628

merged 13 commits into from
Nov 24, 2023

Conversation

BKSteve
Copy link
Collaborator

@BKSteve BKSteve commented Nov 19, 2023

Fixes a QBT folder error where BlackHole path passed to QBT rather than using QBT defined folders.
https://discord.com/channels/502612977271439372/1173806065427697775

Summary by CodeRabbit

  • New Features

    • Enhanced qBittorrent integration with new options for torrent path and incomplete path settings.
    • Improved file browser visibility for torrent path selection.
  • Refactor

    • Updated logging practices for better clarity and debugging, including a shift from info to debug level and adoption of f-string formatting.
  • Bug Fixes

    • Fixed issues with torrent path settings to align with user-configured directories.

Copy link
Contributor

coderabbitai bot commented Nov 19, 2023

Note

Reviews Paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Walkthrough

The recent updates to the SICKCHILL codebase focus on enhancing the integration with qBittorrent and refining the logging system. Changes include adjustments to torrent path settings, improved visibility of file browser options, and a shift from info to debug logging levels for better verbosity control. Additionally, the code now employs modern f-string formatting for clearer and more concise log messages.

Changes

File Path Change Summary
sickchill/gui/slick/js/core.js Updated to show torrent path options and file browser for qBittorrent.
sickchill/oldbeard/clients/.../qbittorrent.py Modified to use new settings for torrent paths and added debug logging.
sickchill/oldbeard/clients/.../download_station.py (multiple entries) Logging levels changed from info to debug and updated string formatting to f-strings.

🐇 In the code's gentle hop, a tweak, a fix, a flip, a flop,
As winter whispers, soft and slow, the logs now whisper, not for show.
With f-strings tight and paths aligned, SICKCHILL's code is now refined. 🍂🔧


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

Note: For conversation with the bot, please use the review comments on code diffs or files.

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

@miigotu
Copy link
Contributor

miigotu commented Nov 20, 2023

I don't agree with this. I think that the folder needs to be shown in the js, where we hide and show different settings depending on what client it is. If they don't want it in a folder either they should empty that field, or we need to add an option to set whether they want to use labeler or our path setting . This was a new feature, we weren't able to send a path in the past. I'm curious if there is an incomplete_path option for qBitTorrent API also, it would be nice to be able to pass that.

@miigotu
Copy link
Contributor

miigotu commented Nov 20, 2023

Need to change this line:

$('#torrent_path_option').hide();

--- $('#torrent_path_option').hide();
+++ $('#torrent_path_option').show();
+++ $('#torrent_path_option').find('.fileBrowser').show();

What I'm also curious about is if qBitTorrent xmlrpc can accept a $('#torrent_path_incomplete_option').show()

@miigotu
Copy link
Contributor

miigotu commented Nov 20, 2023

torrent_path_incomplete_option can be coded in for qBitTorrent:
Screenshot_20231120-000310

@BKSteve
Copy link
Collaborator Author

BKSteve commented Nov 20, 2023

Yes. That's a more complete solution giving the options. The new other torrent items can probably do this too.
Will do a more detailed push after review

@BKSteve
Copy link
Collaborator Author

BKSteve commented Nov 20, 2023

save_path can be set,
setting temp_path no success, if setting enable in qbt or not, still unable to get qbt to accept temp location. Looks to be a read only parameter or I'm doing something wrong.

Add: https://qbittorrent-api.readthedocs.io/en/latest/apidoc/torrents.html
download_path test soon.

@BKSteve
Copy link
Collaborator Author

BKSteve commented Nov 20, 2023

clean up too many info logs for DownloadStation, converted to debug.

Copy link
Collaborator Author

@BKSteve BKSteve Nov 20, 2023

Choose a reason for hiding this comment

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

add this debug logging to others?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, this was added though when their API changes between dsm5 and 6 I think though. Up to you.

Copy link
Collaborator Author

@BKSteve BKSteve Nov 22, 2023

Choose a reason for hiding this comment

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

I meant add logging.debug for uT and rT etc. so there is some data if any of them aren't working.

Copy link
Contributor

Choose a reason for hiding this comment

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

By all means, if you think it might be helpful at another time for debugging go for it.

@BKSteve
Copy link
Collaborator Author

BKSteve commented Nov 21, 2023

@coderabbitai review

Copy link
Contributor

@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: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between f646f34 and fa7b8f4.
Files selected for processing (3)
  • sickchill/gui/slick/js/core.js (1 hunks)
  • sickchill/oldbeard/clients/download_station.py (3 hunks)
  • sickchill/oldbeard/clients/qbittorrent.py (2 hunks)
Files skipped from review due to trivial changes (1)
  • sickchill/oldbeard/clients/download_station.py
Additional comments: 3
sickchill/gui/slick/js/core.js (1)
  • 1952-1954: The changes correctly implement the visibility of the torrent path options and file browser for the qBittorrent client in the SickChill UI. This should improve user experience by allowing users to set paths directly through the interface. Ensure that the corresponding elements are properly defined in the HTML and that any necessary event handlers are attached to make the file browser functional.
sickchill/oldbeard/clients/qbittorrent.py (2)
  • 6-6: The import statement has been updated to include logger from the sickchill settings. This is a necessary change for the new logging statements added in this file. Ensure that the logger is being used appropriately in all the places where logging is required.

  • 52-58: New logging statements have been added to the _add_torrent_uri and _add_torrent_file methods using the logger.debug level. This is a good practice for providing more detailed information during the torrent addition process, which can be useful for troubleshooting. Ensure that the log messages are clear and provide enough context to be useful when debugging.

Comment on lines 43 to 50
@staticmethod
def __torrent_args(result: "TorrentSearchResult"):
return dict(
save_path=settings.TORRENT_DIR or None,
save_path=settings.TORRENT_PATH or None,
download_path=settings.TORRENT_PATH_INCOMPLETE or None,
category=(settings.TORRENT_LABEL, settings.TORRENT_LABEL_ANIME)[result.show.is_anime] or settings.TORRENT_LABEL,
is_paused=settings.TORRENT_PAUSED,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

The __torrent_args method has been updated to use settings.TORRENT_PATH and settings.TORRENT_PATH_INCOMPLETE for the save_path and download_path parameters, respectively. This change is crucial for ensuring that the correct paths are used when adding torrents via qBittorrent. However, the use of a tuple to determine the category (settings.TORRENT_LABEL, settings.TORRENT_LABEL_ANIME)[result.show.is_anime] assumes that result.show.is_anime is a boolean that can be used as an index. This could lead to an IndexError if is_anime is not strictly a boolean. It would be safer to use a conditional expression instead.

- category=(settings.TORRENT_LABEL, settings.TORRENT_LABEL_ANIME)[result.show.is_anime] or settings.TORRENT_LABEL,
+ category=settings.TORRENT_LABEL_ANIME if result.show.is_anime else settings.TORRENT_LABEL,

Commitable suggestion

[!IMPORTANT]
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
@staticmethod
def __torrent_args(result: "TorrentSearchResult"):
return dict(
save_path=settings.TORRENT_DIR or None,
save_path=settings.TORRENT_PATH or None,
download_path=settings.TORRENT_PATH_INCOMPLETE or None,
category=(settings.TORRENT_LABEL, settings.TORRENT_LABEL_ANIME)[result.show.is_anime] or settings.TORRENT_LABEL,
is_paused=settings.TORRENT_PAUSED,
)
@staticmethod
def __torrent_args(result: "TorrentSearchResult"):
return dict(
save_path=settings.TORRENT_PATH or None,
download_path=settings.TORRENT_PATH_INCOMPLETE or None,
category=settings.TORRENT_LABEL_ANIME if result.show.is_anime else settings.TORRENT_LABEL,
is_paused=settings.TORRENT_PAUSED,
)

Copy link
Contributor

@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 fa7b8f4 and ac230fb.
Files selected for processing (1)
  • sickchill/oldbeard/clients/download_station.py (3 hunks)
Files skipped from review due to trivial changes (1)
  • sickchill/oldbeard/clients/download_station.py

@BKSteve
Copy link
Collaborator Author

BKSteve commented Nov 21, 2023

@coderabbitai pause


def _set_torrent_priority(self, result: "TorrentSearchResult"):
if not self.api.app_preferences().get("queueing_enabled"):
return True
return (self.api.torrents_decrease_priority, self.api.torrents_increase_priority)[result.priority == 1](result.hash.lower)
return (self.api.torrents_decrease_priority, self.api.torrents_increase_priority)[result.priority == 1](result.hash.lower())
Copy link
Contributor

Choose a reason for hiding this comment

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

These missing parenthesis are a really old bug o can't believe I missed this all those years.

@miigotu miigotu merged commit 50d590b into develop Nov 24, 2023
11 checks passed
@miigotu miigotu deleted the qbtX1 branch November 24, 2023 04:57
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.

2 participants