Example #1
0
 function parse_torrent($filename = '', $url = '')
 {
     $torrent = new Torrent($filename, $url);
     $torrent->parse();
     if (!$this->description) {
         $this->description = $torrent->comment;
     }
     $this->filename = $torrent->files[0][0];
     $this->size = $torrent->files[0][1];
     $this->hashes['btih'] = $torrent->infohash;
     $this->hashes->pieces = $torrent->pieces;
     $this->hashes->piecelength = $torrent->piecelength;
     $this->hashes->piecetype = 'sha1';
     if ($url && !$filename) {
         $this->add_url($url, "bittorrent", "", "100");
     }
     return $torrent->files;
 }