-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
WebAPI: add new method setTags to upsert tags on torrents #22156
base: master
Are you sure you want to change the base?
Conversation
src/base/bittorrent/torrentimpl.cpp
Outdated
@@ -937,6 +938,21 @@ bool TorrentImpl::addTag(const Tag &tag) | |||
return true; | |||
} | |||
|
|||
bool TorrentImpl::setTags(const TagSet &newTags) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest you move this code to TorrentsController::setTagsAction()
instead.
And revert all changes to base/bittorrent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for reviewing! If that's desired over this solution sure! Is the reasoning to not add additional functions to the core that can be done in the caller with existing methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the reasoning to not add additional functions to the core that can be done in the caller with existing methods?
Yes. And it seems this operation is exclusive to webapi.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it! This made it a much smaller and simpler change 👍
Should API_VERSION
in
qBittorrent/src/webui/webapplication.h
Line 57 in 76e1040
inline const Utils::Version<3, 2> API_VERSION {2, 11, 3}; |
Be bumped in this PR to 2.12.0 or is that done separately? Should probably have incremented that with my previous pr, unless it's done just once before a new version is tagged.
This is another optimization for torrent management on large scale instances with the goal to minimize the amount of required API calls. Ref #22128
This new function and endpoint
torrents/setTags
does an upsert to replace the torrent tags and handles the removal and add internally, instead of doing multiple calls to add and remove tags on torrents from the client.I experimented with adding handling for HTTP PUT since that would be more correct than a POST for this, but did not include those changes.
Should the API version be updated in this PR as well or is that done before a new version is released?