Jump to content

Bitwise Status


Lord Alderaan

Recommended Posts

While working with Bitwise Statuses from the API I found the results might need some more explanation.

1 = Started

2 = Checking

4 = Start after check

8 = Checked

16 = Error

32 = Paused

64 = Queued (as 'in the queue')

128 = Loaded

The Queued bit (64) means "in the queue" and does not directly imply the Queued or Queued seed status µTorrent uses. Instead a torrent with this bit on can, depending on other bits and info, have any of these statuses: Queued, Queued Seed, Downloading, Seeding or Paused. Please also note that a Force Started torrent circumvents the queue and thus is not "in the queue". So torrents with status [F] Downloading or [F] Seeding will have the Queued bit (64) off.

If a torrent has the error status in µtorrent the torrent seems to always have 152 for status regardless of circumstances. That means it always has the checked bit set regardless of whether the torrent is actually checked. Please also note that the red icon with an arrow down in it in µtorrent does NOT signify the error status but a tracker error and has no effect on the actual status of the torrent.

List of statuses:

128 = Stopped (file is also not fully hash checked) Loaded

130 = Checking Loaded, Checking

152 = Error Loaded, Error, Checked

169 = Paused (torrent is forced) Loaded, Paused, Checked, Started

233 = Paused (torrent is not forced) Loaded, Queued, Paused, Checked, Started

If PERCENT PROGRESS = 1000:

136 = Finished Loaded, Checked

137 = [F] Seeding Loaded, Checked, Started

200 = Queued Seed Loaded, Queued, Checked

201 = Seeding Loaded, Queued, Checked, Started

If PERCENT PROGRESS < 1000:

136 = Stopped (file is fully hash checked) Loaded, Checked

137 = [F] Downloading Loaded, Checked, Started

200 = Queued Loaded, Queued, Checked

201 = Downloading Loaded, Queued, Checked, Started

Link to comment
Share on other sites

I wouldn't go as far as to say that Queued has nothing to do with queued download or queued seed. It sorta matters in what order you test the bitfield. Here's an adaptation of the code I use to parse the status bitfield:

var Enum = {

/**

* Bitwise values for interpreting the status field in the torrents list

* returned by "/gui/?list=1"

*/

"Status": {

"STARTED" : 1,

"CHECKING" : 2,

"CHECK-START" : 4,

"CHECKED" : 8,

"ERROR" : 16,

"PAUSED" : 32,

"QUEUED" : 64,

"LOADED" : 128

}

};

/**

* Converts a bitwise torrent status value into a string.

*

* @param iStatus The bitwise torrent status value

* @param bFinished A boolean value indicating the torrent finished state

*

* @return The string representation of the torrent status.

*/

function parseStatus(iStatus, bFinished) {

if (iStatus & Enum.Status["STARTED"]) {

var sForced = ((!(iStatus & Enum.Status["QUEUED"])) ? ' [F]' : '');

if (iStatus & Enum.Status["PAUSED"]) return 'Paused';

else if (bFinished) return 'Seeding' + sForced;

return 'Downloading' + sForced;

}

if (iStatus & Enum.Status["CHECKING"])

return 'Checking';

if (iStatus & Enum.Status["ERROR"])

return 'Error';

if (iStatus & Enum.Status["QUEUED"]) {

if (bFinished) return 'Queued Seed';

return 'Queued Download';

}

if (bFinished) return 'Finished';

return 'Stopped';

}

Do note the fact that Enum.Status["QUEUED"] does end up getting mapped to "Queued Seed" and "Queued Download" when the status bitfield doesn't have Enum.Status["STARTED"]. So I guess a better way to word it would be to say that having Enum.Status["QUEUED"] in the bitfield doesn't necessarily imply that it is actually waiting in the queue. It simply means that it is in the torrent queue.

Link to comment
Share on other sites

Exactly. It means "in the queue". isn't that what I said?

The Queued (64) status has nothing to do with whether the torrent is a queued seed/download or not. The difference between a Downloading/Seeding file and a Queued Download/Seed is the STARTED bit.

At that point in your code you already eliminated all statuses except for Queued Seed/Download and Finished/Stopped. And the only different between a torrent that is Finished/Stopped and a torrent that is Queued Seed/Download is that a stopped torrent is not "in the queue".

[edit]

Another fun thing to note is that a torrent with an Error always seems to display as 152 which means it is Loaded, Error and Checked. Even if the torrent hasn't been checked (for example if it didn't start because there was not enough space) it shows as 152.

Link to comment
Share on other sites

Yeah, it is what you said, but I guess the part after that completely threw it out the window for me. The queued bit doesn't have absolutely nothing to do with the queued download/seed state is what I was trying to say. As long as the queued bit is set, the torrent is in the queue, and that's enough to mean that it is associated with queued download/seed state, and becomes a case of "waiting or not waiting to go." I suppose this is just a glass-half-full vs glass-half-empty debate at this point.

And indeed, other possibilities were eliminated by the time I used it to determine queued download/seed state, but that's also what I said as well (that the order in which the bits are tested is somewhat important) :)

Link to comment
Share on other sites

  • 1 year later...

Hi lord and ultima- appreciate your fine work,and great documentation!

Have these statuses changed since 2.0 came out - or are there other better posts I should be aware of?

(I've reviewed a ton already, but just want to make sure I"m not missing your favs...

Cheers!

Link to comment
Share on other sites

Thanks for the quick reply!

If I can bounce this off of you:

If status = 136 (webui) AND percent 1000, then uTorrent has reached the state of finished as defined within uTorrent?

And if someone has 'Force Started' a torrent, it will never reach the 136/1000 status,correct? (Because the 64bit is not set per the discussion below.)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...