BiglySoftware / BiglyBT-plugin-xmwebui

This plugin supports the BiglyBT Web Remote interface.
8 stars 7 forks source link

How do I get recently active torrents from the 'torrent-get' method #6

Closed Macie73 closed 4 years ago

Macie73 commented 4 years ago

hi there, really just started with this - trying to build my own UI for this already amazing torrent client, but I believe i have read the rpc-spec file now a few times already. Whatever I try i always get the full list of torrents in my result set (3000+ at this time).

So this is the body of the POST call: { "method": "torrent-get", "arguments": { "fields": [ "id","sizeWhenDone","name","hashString","dateCreated","status","activityDate","uploadedEver","peers","comment","downloadDir","isPrivate","peersConnected","creator" ], "ids": "recently-active" }, "tag": "fake-tag" }

so the question is about the "ids":"recently-active" part. How do i get a short-list of those torrents that are currently connected to peers AND getting or sending any data. is this really supported, same is in Transmission? thanks

TuxPaper commented 4 years ago

BiglyBT's implementation of recently-active is a bit different than Transmission.

  1. "recently active" is based on any changes to the values of any fields you request.

  2. We assume each "torrent-get" with a "recently-active" has the same field list. This is just lazy programming, as we only cache the last sent "recently-active" list, compare it when a new request comes in, and return the diff. We could fix this to support multiple field lists, but so far we've found no need.

  3. If you like to read code, the recently-added stuff is at https://github.com/BiglySoftware/BiglyBT-plugin-xmwebui/blob/master/com/aelitis/azureus/plugins/xmwebui/XMWebUIPlugin.java#L5022

If you are running into issue in point 2, see if you can always use the same field list when calling with "recently-active". If there's a convincing use case for using multiple sets of fields with "recently-active", let me know and I could work on adding support.

But usually the problem is one of the fields you are requesting is constantly changing, thus causing you to get the full list of torrents back each time. If you call "torrent-get" with "recently-active" twice, you only need to compare one torrent from the second result with the same torrent in the first result, and find out which field is different. Hopefully it's one you don't need in the result (you can grab the field value later with a specific call)

Hope that helps!

Macie73 commented 4 years ago

thanks for the response @TuxPaper so basically what you're saying is to find out those torrents that have changed since the last "torrent-get" call with "recently-active" ids scope, i need to make sure the fields i have selected for this call, need to only include those that only reflect a change that i'm interested in? and then once that subset is identified run a more specific "torrent-get" call to the the real full details.

thanks for the pointer to the java code, i will sure have a look at it later over the weekend.

I'm primarily seeding torrents that i had downloaded before. So my usecase for the UI revolves around finding those torrents that are actively seeding. So perhaps i should drop the "peersConnected", "activeDate" and "peers" and add perhaps "uploadedEver" instead.

will try that for sure. thx

Macie73 commented 4 years ago

Closing this ticket as i finally managed to figure this out in Postman. a POST request against /transmission/rpc with a body of the JSON formatted request in raw format is doing the trick for me.

parg commented 4 years ago

nice ;)