Skip to content

Commit

Permalink
Add getUploadRatio() function to retrieve share ratio on current torr…
Browse files Browse the repository at this point in the history
…ent object

Usage example:

// Getting a specific torrent from the download queue
$torrent = $transmission->get(1);

// Getting share ratio of the selected torrent
$torrent->getUploadRatio();  // Will return 0.5033 for example; If the return value is 1, it will say that the torrent is seeded 1 time
  • Loading branch information
firesalp committed Sep 4, 2014
1 parent 97410c1 commit d5de348
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/Transmission/Model/Torrent.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ class Torrent extends AbstractModel
*/
protected $trackers = array();

/**
* @var double
*/
protected $uploadRatio;

/**
* @param integer $id
*/
Expand Down Expand Up @@ -287,6 +292,22 @@ public function getTrackers()
return $this->trackers;
}

/**
* @param double $ratio
*/
public function setUploadRatio($ratio)
{
$this->uploadRatio = (double) $ratio;
}

/**
* @return double
*/
public function getUploadRatio()
{
return $this->uploadRatio;
}

/**
* @return boolean
*/
Expand Down Expand Up @@ -337,6 +358,7 @@ public static function getMapping()
'files' => 'files',
'peers' => 'peers',
'trackers' => 'trackers',
'uploadRatio' => 'uploadRatio',
'hashString' => 'hash'
);
}
Expand Down

0 comments on commit d5de348

Please sign in to comment.