Jump to content

Download torrent completed


VoLT

Recommended Posts

The status of a torrent (as seen in the status column) is determined by a combination of two things. The bitwise STATUS value and the PERCENT PROGRESS.

If the first (started), second (checking), fifth (error) and seventh (queued) bit of the bitwise STATUS are all 0 and the PERCENT PROGRESS is 1000 the torrent is Finished.

I use this function:

if ( $status_bit1 == 1 ) {
if ( $status_bit6 == 1 ) {
return Paused
}
else {
if ( $status_bit7 == 1 ) {
if ( $progress == 1000 ) {
return Seeding
}
else {
return Downloading
}
}
else {
if ( $progress == 1000 ) {
return Seeding [F]
}
else {
return Downloading [F]
}
}
}
}
elseif ( $status_bit2 == 1 ) {
return Checking
}
elseif ( $status_bit5 == 1 ) {
return Error
}
elseif ( $status_bit7 == 1 ) {
if ( $progress == 1000 ) {
return Queued Seeding
}
else {
return Queued
}
}
if ( $progress == 1000 ) {
return Finished
}
else {
return Stopped
}

Link to comment
Share on other sites

my function ... Delphi

function ConvertStatus(Status: Integer; PercentProgress: Integer): string;
var
i: integer;
s: String;
begin
s := '';
for i := 0 to 7 do
if Status and (1 shl i) > 0 then
s := '1' + s
else
s := '0' + s;

if s[8] = '1' then
begin
if s[3] = '1' then
begin
Result:='Pause';
exit;
end
else
begin
if s[2] = '1' then
begin
if PercentProgress = 1000 then
begin
Result:='Seeding';
exit;
end
else
begin
Result:='Downloading';
exit;
end;
end
else
begin
if PercentProgress = 1000 then
begin
Result:='Seeding [F]';
exit;
end
else
begin
Result:='Downloading [F]';
exit;
end;
end;
end;
end
else
begin
if s[7] = '1' then
begin
Result:='Checking ...';
exit;
end;
if s[4] = '1' then
begin
Result:='Error!';
exit;
end;
if s[2] = '1' then
begin
if PercentProgress = 1000 then
begin
Result:='Queued Seeding';
exit;
end
else
begin
Result:='Queued ...';
exit;
end;
end;
if PercentProgress = 1000 then
begin
Result:='Finished';
exit;
end
else
begin
Result:='Stopped';
exit;
end;
end;
end;

thanks I'll try to understand)

Link to comment
Share on other sites

  • 1 month later...

For example, would it be possible to make a script to have popup notifications for completed downloads as soon as a torrent download completes?

OR...Am I just limited to having a script display the completed torrents after a certain time interval or after a command is executed?

Link to comment
Share on other sites

The WebUI (and really, websites in general) is pull-based, not push-based. That means events (like download completion) don't cause events to bubble up, eventually causing some notification to be pushed to some client using the WebUI backend. Instead, the client using the backend needs to constantly/periodically poll the backend by pulling data off of it.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...