Update settings handling, improve qBittorrent API integration, and enhance logging - #18
Open
Tailslide wants to merge 16 commits into
Open
Update settings handling, improve qBittorrent API integration, and enhance logging#18Tailslide wants to merge 16 commits into
Tailslide wants to merge 16 commits into
Conversation
…ple settings file and rename to Settings.sample.json
…ple settings file and rename to Settings.sample.json
…ings Fix API call to set limits broken in new QBT
- Changed project to target .NET 8.0 and updated package references for RestSharp, MailKit, System.ServiceModel.Syndication, and Serilog. - Refactored `qbtService` constructor to directly instantiate `RestClient` without `RestClientOptions`. - Standardized HTTP method constants to use uppercase (e.g., `Method.POST`). - Enhanced `MakeRestRequest` method signatures for consistency. - Added logging for null responses in `MakeRestRequest` to improve error handling.
This commit modifies the `dotnet-version` parameter in the `Setup .NET` step of the `ci.yml` file, upgrading the version from 7.0.x to 8.0.x to ensure compatibility with the latest features and improvements.
Implemented `IsPruneExemptTag` method to check for tags that exempt torrents from pruning. Updated `ProcessTorrents` to utilize this method and log reasons for keeping torrents. Enhanced `Settings` class with a new `pruneExemptTags` property and updated `Settings.sample.json` with default values for exempt tags.
qBittorrent renamed the WebUI session cookie from "SID" to "QBT_SID_<port>" in newer versions. SignIn() looked for a cookie named exactly "SID", so it never found the session cookie and reported "Login failed." even though authentication succeeded. Match both the legacy "SID" name and the "QBT_SID" prefix so login works across qBittorrent versions and regardless of the WebUI port. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EgL7a13MvXA8ZwZ95seSMs
…cf2lpe Support qBittorrent's new QBT_SID session cookie format
qBittorrent 5.1 made shareLimitAction a required parameter of
/torrents/setShareLimits, so every call 400'd with
"Missing required parameters: shareLimitAction" and limits were never
applied. Send shareLimitAction="Default" (use the global action when a
limit is reached), preserving the previous behaviour.
Also:
- Log the HTTP status code and response body on command/request failure
instead of RestSharp's transport status ("Completed"), which hid the
real reason.
- Format ratioLimit/seedingTimeLimit with InvariantCulture so a
comma-decimal locale can't send "1,2" and trigger a 400.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EgL7a13MvXA8ZwZ95seSMs
…cf2lpe Fix setShareLimits 400 by sending required shareLimitAction param
Owner
|
Yikes. I presume this MR was done with Claude or similar? Questions: Why the restsharp download? |
Author
The last couple commits and the readme was done by claude code (opus 4.8)
.NET 7 was EOL so I just went to 8 because it was marked as long term support. The one after 8 at the time (9? 10?) actually had a shorter support window. I believe there was a reason for the restsharp downgrade but sadly that was a year ago and it's been lost to time. It's possible the latest is fine now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sorry about the giant PR.. feel free to reject it or use part of if. It fixes some breaking changes in QBT.
Cross-seed aware pruning, qBittorrent compatibility fixes, and .NET 8 upgrade
Summary
Adds the ability to delete a torrent's task without deleting its files (protecting cross-seeded data), a tag-based prune exemption, fixes for newer qBittorrent WebUI versions, removal of committed credentials, and an upgrade to .NET 8.
Changes
Delete task without files
Each torrent is now assigned a delete method (
DeleteFile/DeleteTask/DeleteFileAndTask/PauseTask). Files are preserved (task only removed) when:delete_task_not_file_if_other_tasks— another torrent shares the same content (matched by info-hash or a SHA-256 of sorted file name + size)delete_task_not_file_tags— torrent has a listed tag (e.g.cross-seed)delete_task_not_file_categories— torrent is in a listed categoryPrune-exempt tags
New
pruneExemptTagsunderqbtsettings — torrents with any of these tags are skipped entirely during pruning.qBittorrent compatibility
SIDand the newerQBT_SID_<port>session cookie on logininactiveSeedingTimeLimitandshareLimitAction(required by qBittorrent 5.1+) insetShareLimitsInvariantCultureTooling & dependencies
8.0.x; version 1.1.0Repo hygiene
Settings.json(contained real credentials) and added it to.gitignoreSettings.sample.jsontemplateNotes for reviewers
GenerateTorrentFileHashstill has debug leftovers (a hardcoded hash comparison +Debug.WriteLine), plus a few commented-out blocks worth cleaning up before merge.