public function setInfoFromDescription($description)
  {
    // 1 seeder(s), 20 leecher(s), 63 download(s) - 793.9 MiB
    if (!preg_match('~([0-9]+) seeder\(s\), ([0-9]+) leecher\(s\), ([0-9]+) download\(s\)(?: - ([0-9]+(\.[0-9]+)))?~i', $description, $match)) {
      return;
    }

    $this->seeds = intval($match[1]);
    $this->leechers = intval($match[2]);
    $this->downloads = intval($match[3]);
    if (isset($match[4])) {
      // MB -> B
      $this->size = floatval($match[4]) * 1000000;
    }
  }
public function setInfoFromDescription($description)
  {
    // 1 seeder(s), 20 leecher(s), 63 download(s) - 793.9 MiB
    if (!preg_match('~([0-9]+) seeder\(s\), ([0-9]+) leecher\(s\), ([0-9]+) download\(s\)(?: - ([0-9]+(\.[0-9]+)))?~i', $description, $match)) {
      return;
    }

    $this->seeds = intval($match[1]);
    $this->leechers = intval($match[2]);
    $this->downloads = intval($match[3]);
    if (isset($match[4])) {
      // MB -> B
      $this->size = floatval($match[4]) * 1000000;
    }
  }
public function setInfoFromDescription ( $ description ) { // 1 seeder(s), 20 leecher(s), 63 download(s) - 793.9 MiB if ( ! preg_match ( '~([0-9]+) seeder\(s\), ([0-9]+) leecher\(s\), ([0-9]+) download\(s\)(?: - ([0-9]+(\.[0-9]+)))?~i' , $ description , $ match ) ) { return ; } $ this -> seeds = intval ( $ match [ 1 ] ) ; $ this -> leechers = intval ( $ match [ 2 ] ) ; $ this -> downloads = intval ( $ match [ 3 ] ) ; if ( isset ( $ match [ 4 ] ) ) { // MB -> B $ this -> size = floatval ( $ match [ 4 ] ) * 1000000 ; } }
Sets the torrent info from the description string
@param string $description The description to parse info from
Sets the torrent info from the description string