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

WebAPI: optionally include trackers list in torrent info response #22128

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zze0s
Copy link

@zze0s zze0s commented Jan 8, 2025

This PR adds an optional parameter includeTrackers to the Torrent info endpoint /torrents/info to include the trackers list of each torrent in the response under the key trackers.

Why?

Me and a lot of other users runs anything between 1-40k torrents in a single instance and we rely on various tools to do things like tag by different tracker states.

To get the trackers we have to first get the list of torrents and then loop through that to get the trackers per torrent. With 10k torrents that's 10000+1 requests towards qBitorrent. It does handle it fairly well but it feels a bit wrong to spam it like that.

With this change we'll be able to get all that info in a single call (or few calls with pagination). It will most likely reduce the overall load quite a bit.

About the code

This is my first time touching c++ and making any changes to this codebase but I read the contributing guidelines etc so it should be to spec.

Not sure if KEY_PROP_TRACKERS is the correct one to set or if it should be TORRENT_ something instead.

I just copied the private bool param so it behaves the same but it could potentially be changed to includes=trackers,other which takes a comma separated string of other things that could be of interest to include.

The trackers logic is just a copy paste from the getTrackers endpoint. Not sure if getStickyTrackers() should be included or not.

I tested it locally and it works as expected with and without the new includeTrackers query param.

@glassez glassez added the WebAPI WebAPI-related issues/changes label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebAPI WebAPI-related issues/changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants