コード例 #1
0
 /**
  * Remove a torrent from the download queue
  *
  * @param Torrent $torrent
  */
 public function remove(Torrent $torrent, $localData = false)
 {
     $arguments = array('ids' => array($torrent->getId()));
     if ($localData) {
         $arguments['delete-local-data'] = true;
     }
     $this->getClient()->call('torrent-remove', $arguments);
 }
コード例 #2
0
 /**
  * @test
  */
 public function shouldRemoveDownloadWithRemovingLocalData()
 {
     $client = $this->getMock('Transmission\\Client');
     $client->expects($this->once())->method('call')->with('torrent-remove', array('ids' => array(1), 'delete-local-data' => true))->will($this->returnCallback(function () {
         return (object) array('result' => 'success');
     }));
     $torrent = new Torrent();
     $torrent->setId(1);
     $transmission = new Transmission();
     $transmission->setClient($client);
     $transmission->remove($torrent, true);
 }
コード例 #3
0
ファイル: Downloader.php プロジェクト: afk11/magnetdl
 private function generateUploadCmd(Torrent $torrent)
 {
     $command = sprintf("sftp -oIdentityFile=%s %s@%s <<EOF\nlcd '%s/" . $torrent->getName() . "'\ncd '%s'\nmkdir '" . $torrent->getName() . "'\nput -r . '" . $torrent->getName() . "'\nEOF", $this->params->getSftpIdentityfile(), $this->params->getSftpUser(), $this->params->getSftpHost(), $this->params->getDirLocal(), $this->params->getDirRemote());
     return $command;
 }