Documentation on JSON data - specifically torrent status

Discussion of Transmission that doesn't fit in the other categories
Post Reply
abeeson
Posts: 8
Joined: Sun Jul 26, 2009 8:36 am

Documentation on JSON data - specifically torrent status

Post by abeeson »

Hey guys,

I'm looking for some documentation on the JSON API and what codes I can expect + what they mean. I'm in the process of converting my web interface over from using transmission-remote calls and scraping / regex'ing the return to actuallly making direct calls via JSON to the RPC (in reality ive finished phase 1 of it, but thats another story) and I'm running into some weird things.

I'm trying to understand what the torrent status codes relate to, so far i have used a combination of transmission-remote, the transmission web interface plus my own to figure out some of them, but i've run into another tonight that has me stumped.

Is there a formal document somewhere that explains these, if so can i get a link, if not, can somebody post the answers here?

The torrent status is the one im most interested in, but if there are others can i get those too?

So far i have managed to figure out / guess at the following:
# 2 - validating
# 4 - downloading
# 6 - Seems to be seeding - Possibly idle with no connected peers?
# 8 - seems to be seeding as well
# 16 - Paused

Anybody know more? I'd really appreciate some help on this, most i got right enough, but the 6/8 thing has me stumped, my friends list is all throwing 6's for his seeding torrents and mine is all throwing 8's, cant find any reason for it.....

Cheers!
abeeson
Posts: 8
Joined: Sun Jul 26, 2009 8:36 am

Re: Documentation on JSON data - specifically torrent status

Post by abeeson »

Cheers for the link, but unfortunately the RPC spec has what methods and arguments etc, but not what data to expect within those.

I have been using it for the bulk of the actual calls and its been excellent for that.

As far i can tell, i could look at the source code (in C im guessing) for tr_stat to get the codes meanings, but that would rely on the code being commented and (more importantly) me being able to interpret C properly....
blacke4dawn
Posts: 552
Joined: Sun Dec 13, 2009 10:44 pm

Re: Documentation on JSON data - specifically torrent status

Post by blacke4dawn »

Personally I do not know where else to find info, though depending on your language of choice there may already be a library available that implements the RPC spec in a more user friendly way.
killemov
Posts: 573
Joined: Sat Jul 31, 2010 5:04 pm

Re: Documentation on JSON data - specifically torrent status

Post by killemov »

Actually, the JSON-rpc-spec is the most user friendly. All libraries are an abstraction in one way or another. The main issue of the spec is that you have to follow the references to the source of transmission itself. The spec of the status has changed in 1.42. https://github.com/killemov/Shift/blob/ ... ft.js#L676
abeeson
Posts: 8
Joined: Sun Jul 26, 2009 8:36 am

Re: Documentation on JSON data - specifically torrent status

Post by abeeson »

killemov wrote:Actually, the JSON-rpc-spec is the most user friendly. All libraries are an abstraction in one way or another. The main issue of the spec is that you have to follow the references to the source of transmission itself. The spec of the status has changed in 1.42. https://github.com/killemov/Shift/blob/ ... ft.js#L676
:D You sir are my hero.

That both explains the new / old codes and explains the difference between mine and my friends. (he has 2.42 and I have 2.33)

Cheers for the JS link too, thats perfect!

PS - I'm using perl, afaik there is no library written specifically for transmission, i'm using the JSON::RPC::Client libarry to handle the actual transactions, but its a generic libarry and doesnt have transmission specific codes in it.

PPS - If any dev for transmission itself sees this, is there a wiki / document somewhere for these? If not, do you have a place it can be made / community contributed? I would be happy to write up some brief explanations of data to and from teh RPC as i encounter them if i had somewhere to store it other than the forums....
blacke4dawn
Posts: 552
Joined: Sun Dec 13, 2009 10:44 pm

Re: Documentation on JSON data - specifically torrent status

Post by blacke4dawn »

abeeson wrote:PS - I'm using perl, afaik there is no library written specifically for transmission, i'm using the JSON::RPC::Client libarry to handle the actual transactions, but its a generic libarry and doesnt have transmission specific codes in it.
Nothing written specifically for transmission? Look here: http://search.cpan.org/search?mode=all& ... ansmission
abeeson
Posts: 8
Joined: Sun Jul 26, 2009 8:36 am

Re: Documentation on JSON data - specifically torrent status

Post by abeeson »

Well what do you know, there is some modules.

Either way, i would guess my stuff integrates too deeply to make use of those modules (at least not easily), plus i already have a LONG list of dependancies :)

Thanks for the link though, I will check them out and see how i go!
trondhindenes
Posts: 2
Joined: Thu May 31, 2012 1:21 pm

Re: Documentation on JSON data - specifically torrent status

Post by trondhindenes »

here's what I've found (some combinations as well, you'll have to look at status combined with other properties):

if ($torrent.status -eq 6){$torrent.status = "Seeding"}
if ($torrent.status -eq 4){$torrent.status = "Downloading"}
if ($torrent.status -eq 3){$torrent.status = "Queued"}
if ($torrent.status -eq 0){$torrent.status = "Paused"}

#Show eta in datetime format
if ($torrent.eta -gt 0) {$torrent.eta = (Get-Date).AddSeconds($torrent.eta)}

#Finished + paused = "seeding complete"
if (($torrent.isFinished -eq $true) -and ($torrent.status -eq "paused")) {$torrent.status = "Seeding Complete"}

#zero peers and status "downloading" = "Idle"
if (($torrent.peersconnected -eq 0 ) -and ($torrent.status -eq "Downloading")) {$torrent.status = "Idle"}

This is written in PowerShell, but I'm sure you can read the logic anyways.

-Trond
Post Reply