当前位置: 首页>>代码示例>>PHP>>正文


PHP rXMLRPCRequest::success方法代码示例

本文整理汇总了PHP中rXMLRPCRequest::success方法的典型用法代码示例。如果您正苦于以下问题:PHP rXMLRPCRequest::success方法的具体用法?PHP rXMLRPCRequest::success怎么用?PHP rXMLRPCRequest::success使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rXMLRPCRequest的用法示例。


在下文中一共展示了rXMLRPCRequest::success方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createTorrent

 public static function createTorrent($torrent, $hash)
 {
     global $saveUploadedTorrents;
     $torrent = new Torrent($torrent);
     if ($torrent->errors()) {
         return self::STE_DELETED;
     }
     if ($torrent->hash_info() == $hash) {
         return self::STE_UPTODATE;
     }
     $req = new rXMLRPCRequest(array(new rXMLRPCCommand("d.get_directory_base", $hash), new rXMLRPCCommand("d.get_custom1", $hash), new rXMLRPCCommand("d.get_throttle_name", $hash), new rXMLRPCCommand("d.get_connection_seed", $hash), new rXMLRPCCommand("d.is_open", $hash), new rXMLRPCCommand("d.is_active", $hash), new rXMLRPCCommand("d.get_state", $hash), new rXMLRPCCommand("d.stop", $hash), new rXMLRPCCommand("d.close", $hash)));
     if ($req->success()) {
         $addition = array(getCmd("d.set_connection_seed=") . $req->val[3], getCmd("d.set_custom") . "=chk-state," . self::STE_UPDATED, getCmd("d.set_custom") . "=chk-time," . time(), getCmd("d.set_custom") . "=chk-stime," . time());
         $isStart = $req->val[4] != 0 && $req->val[5] != 0 && $req->val[6] != 0;
         if (!empty($req->val[2])) {
             $addition[] = getCmd("d.set_throttle_name=") . $req->val[2];
         }
         if (preg_match('/rat_(\\d+)/', $req->val[3], $ratio)) {
             $addition[] = getCmd("view.set_visible=") . "rat_" . $ratio;
         }
         $label = rawurldecode($req->val[1]);
         if (rTorrent::sendTorrent($torrent, $isStart, false, $req->val[0], $label, $saveUploadedTorrents, false, true, $addition)) {
             $req = new rXMLRPCRequest(new rXMLRPCCommand("d.erase", $hash));
             if ($req->success()) {
                 return null;
             }
         }
     }
     return self::STE_ERROR;
 }
开发者ID:limerainne,项目名称:ruTorrent,代码行数:30,代码来源:check.php

示例2: makeSimpleCall

function makeSimpleCall($cmds, $hash)
{
    $req = new rXMLRPCRequest();
    foreach ($hash as $h) {
        foreach ($cmds as $cmd) {
            $req->addCommand(new rXMLRPCCommand($cmd, $h));
        }
    }
    return $req->success() ? $req->val : false;
}
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:10,代码来源:action.php

示例3: getNFO

function getNFO()
{
    if ($_GET['id']) {
        $hash = $_GET['id'];
        $req = new rXMLRPCRequest(array(new rXMLRPCCommand("d.get_base_path", $hash), new rXMLRPCCommand("d.get_name", $hash)));
        if ($req->success()) {
            $dir = $req->val[0];
            if ($h = opendir($dir)) {
                while (false !== ($file = readdir($h))) {
                    if (preg_match("/\\.nfo\$/", $file)) {
                        return file_get_contents($dir . "/" . $file);
                    }
                }
            }
        }
    }
    return false;
}
开发者ID:ravenstar,项目名称:rutorrent-essential,代码行数:18,代码来源:view.php

示例4: fastResume

 public static function fastResume($torrent, $base, $add_path = true)
 {
     $files = array();
     $info = $torrent->info;
     $psize = intval($info['piece length']);
     $base = trim($base);
     if ($base == '') {
         $req = new rXMLRPCRequest(new \model\xmlrpc\rXMLRPCCommand(\config\Conf::$userscgi, 'get_directory'));
         if ($req->success()) {
             $base = $req->val[0];
         }
     }
     if ($psize && \model\xmlrpc\rTorrentSettings::get(\config\Conf::$userscgi)->correctDirectory($base)) {
         $base = addslash($base);
         $tsize = 0.0;
         if (isset($info['files'])) {
             foreach ($info['files'] as $key => $file) {
                 $tsize += floatval($file['length']);
                 $files[] = $add_path ? $info['name'] . "/" . implode('/', $file['path']) : implode('/', $file['path']);
             }
         } else {
             $tsize = floatval($info['length']);
             $files[] = $info['name'];
         }
         $chunks = intval(($tsize + $psize - 1) / $psize);
         $torrent->{'libtorrent_resume'}['bitfield'] = intval($chunks);
         if (!isset($torrent->{'libtorrent_resume'}['files'])) {
             $torrent->{'libtorrent_resume'}['files'] = array();
         }
         foreach ($files as $key => $file) {
             $ss = LFS::stat($base . $file);
             if ($ss === false) {
                 return false;
             }
             if (count($torrent->{'libtorrent_resume'}['files']) < $key) {
                 $torrent->{'libtorrent_resume'}['files'][$key]['mtime'] = $ss["mtime"];
             } else {
                 $torrent->{'libtorrent_resume'}['files'][$key] = array("priority" => 2, "mtime" => $ss["mtime"]);
             }
         }
         return $torrent;
     }
     return false;
 }
开发者ID:CamTosh,项目名称:Mediastorrent,代码行数:44,代码来源:rTorrent.php

示例5: setHandlers

 public function setHandlers()
 {
     $theSettings = rTorrentSettings::get();
     $pathToXmpp = dirname(__FILE__);
     $req = new rXMLRPCRequest();
     if ($this->message !== '' && isset($this->jabberServer) && isset($this->jabberLogin) && isset($this->jabberPasswd) && isset($this->jabberFor)) {
         $cmd = $theSettings->getOnFinishedCommand(array('xmpp' . getUser(), getCmd('execute.nothrow.bg') . '={' . getPHP() . ',' . $pathToXmpp . '/notify.php,"$' . getCmd('d.name') . '=","' . getUser() . '"}'));
     } else {
         $cmd = $theSettings->getOnFinishedCommand(array('xmpp' . getUser(), getCmd('cat=')));
     }
     $req->addCommand($cmd);
     return $req->success();
 }
开发者ID:nilimahona,项目名称:quick-box,代码行数:13,代码来源:xmpp.php

示例6: deleteTrackers

                        } else {
                            $needToProcessed = false;
                        }
                    }
                    $lst = $torrent->announce_list();
                    if ($lst && count($trks->todelete)) {
                        $needToProcessed = deleteTrackers($lst, $trks->todelete);
                        if ($needToProcessed) {
                            $torrent->announce_list($lst);
                        }
                    }
                    if ($needToProcessed) {
                        if (isset($torrent->{'rtorrent'})) {
                            unset($torrent->{'rtorrent'});
                        }
                        $eReq = new rXMLRPCRequest(new rXMLRPCCommand("d.erase", $hash));
                        if ($eReq->success()) {
                            $label = rawurldecode($req->val[3]);
                            rTorrent::sendTorrent($torrent, $isStart, false, $req->val[4], $label, false, false, false, array(getCmd("d.set_custom3") . "=1"));
                            $processed = true;
                        }
                    }
                }
            }
        }
        if (!$processed && $isStart) {
            $req = new rXMLRPCRequest(new rXMLRPCCommand("d.start", $hash));
            $req->run();
        }
    }
}
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:31,代码来源:update.php

示例7: setHandlers

 public function setHandlers()
 {
     global $rootPath;
     if ($this->enabled) {
         $cmd = rTorrentSettings::get()->getOnFinishedCommand(array('unpack' . getUser(), getCmd('execute') . '={' . getPHP() . ',' . $rootPath . '/plugins/unpack/update.php,$' . getCmd('d.get_directory') . '=,$' . getCmd('d.get_base_filename') . '=,$' . getCmd('d.is_multi_file') . '=,$' . getCmd('d.get_custom1') . '=,$' . getCmd('d.get_name') . '=,' . getCmd('d.get_hash') . '=,' . getUser() . '}'));
     } else {
         $cmd = rTorrentSettings::get()->getOnFinishedCommand(array('unpack' . getUser(), getCmd('cat=')));
     }
     $req = new rXMLRPCRequest($cmd);
     return $req->success();
 }
开发者ID:jcvfen,项目名称:rutorrent,代码行数:11,代码来源:unpack.php

示例8: obtain

 public function obtain()
 {
     $req = new rXMLRPCRequest(new rXMLRPCCommand("system.client_version"));
     if ($req->run() && count($req->val)) {
         $this->linkExist = true;
         $this->version = $req->val[0];
         $parts = explode('.', $this->version);
         $this->iVersion = 0;
         for ($i = 0; $i < count($parts); $i++) {
             $this->iVersion = ($this->iVersion << 8) + $parts[$i];
         }
         if ($this->iVersion > 0x806) {
             $this->mostOfMethodsRenamed = true;
             $this->aliases = array("d.set_peer_exchange" => "d.peer_exchange.set", "d.set_connection_seed" => "d.connection_seed.set");
         }
         if ($this->iVersion == 0x808) {
             $req = new rXMLRPCRequest(new rXMLRPCCommand("file.prioritize_toc"));
             $req->important = false;
             if ($req->success()) {
                 $this->iVersion = 0x809;
             }
         }
         $this->apiVersion = 0;
         if ($this->iVersion >= 0x901) {
             $req = new rXMLRPCRequest(new rXMLRPCCommand("system.api_version"));
             $req->important = false;
             if ($req->success()) {
                 $this->apiVersion = $req->val[0];
             }
         }
         $req = new rXMLRPCRequest(new rXMLRPCCommand("to_kb", floatval(1024)));
         if ($req->run()) {
             if (!$req->fault) {
                 $this->badXMLRPCVersion = false;
             }
             $req = new rXMLRPCRequest(array(new rXMLRPCCommand("get_directory"), new rXMLRPCCommand("get_session"), new rXMLRPCCommand("system.library_version"), new rXMLRPCCommand("set_xmlrpc_size_limit", 67108863), new rXMLRPCCommand("get_name"), new rXMLRPCCommand("get_port_range")));
             if ($req->run() && !$req->fault) {
                 $this->directory = $req->val[0];
                 $this->session = $req->val[1];
                 $this->libVersion = $req->val[2];
                 $this->server = $req->val[4];
                 $this->portRange = $req->val[5];
                 $this->port = intval($this->portRange);
                 if ($this->iVersion >= 0x809) {
                     $req = new rXMLRPCRequest(new rXMLRPCCommand("network.listen.port"));
                     $req->important = false;
                     if ($req->success()) {
                         $this->port = intval($req->val[0]);
                     }
                 }
                 if (isLocalMode()) {
                     if (!empty($this->session)) {
                         $this->started = @filemtime($this->session . '/rtorrent.lock');
                         if ($this->started === false) {
                             $this->started = 0;
                         }
                     }
                     $id = getExternal('id');
                     $req = new rXMLRPCRequest(new rXMLRPCCommand("execute_capture", array("sh", "-c", $id . " -u ; " . $id . " -G ; echo ~ ")));
                     if ($req->run() && !$req->fault && ($line = explode("\n", $req->val[0])) !== false && count($line) > 2) {
                         $this->uid = intval(trim($line[0]));
                         $this->gid = explode(' ', trim($line[1]));
                         $this->home = trim($line[2]);
                         if (!empty($this->directory) && $this->directory[0] == '~') {
                             $this->directory = $this->home . substr($this->directory, 1);
                         }
                     } else {
                         $this->idNotFound = true;
                     }
                 }
                 $this->store();
             }
         }
     }
 }
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:75,代码来源:settings.php

示例9: setHandlers

 public function setHandlers()
 {
     global $rootPath;
     if ($this->log["addition"] || $this->log["pushbullet_enabled"] && $this->log["pushbullet_addition"]) {
         $addCmd = getCmd('execute') . '={' . getPHP() . ',' . $rootPath . '/plugins/history/update.php' . ',1,$' . getCmd('d.get_name') . '=,$' . getCmd('d.get_size_bytes') . '=,$' . getCmd('d.get_bytes_done') . '=,$' . getCmd('d.get_up_total') . '=,$' . getCmd('d.get_ratio') . '=,$' . getCmd('d.get_creation_date') . '=,$' . getCmd('d.get_custom') . '=addtime,$' . getCmd('d.get_custom') . '=seedingtime' . ',"$' . getCmd('t.multicall') . '=$' . getCmd('d.get_hash') . '=,' . getCmd('t.get_url') . '=,' . getCmd('cat') . '=#",$' . getCmd('d.get_custom1') . "=,\$" . getCmd('d.get_custom') . "=x-pushbullet," . getUser() . '}';
     } else {
         $addCmd = getCmd('cat=');
     }
     if ($this->log["finish"] || $this->log["pushbullet_enabled"] && $this->log["pushbullet_finish"]) {
         $finCmd = getCmd('execute') . '={' . getPHP() . ',' . $rootPath . '/plugins/history/update.php' . ',2,$' . getCmd('d.get_name') . '=,$' . getCmd('d.get_size_bytes') . '=,$' . getCmd('d.get_bytes_done') . '=,$' . getCmd('d.get_up_total') . '=,$' . getCmd('d.get_ratio') . '=,$' . getCmd('d.get_creation_date') . '=,$' . getCmd('d.get_custom') . '=addtime,$' . getCmd('d.get_custom') . '=seedingtime' . ',"$' . getCmd('t.multicall') . '=$' . getCmd('d.get_hash') . '=,' . getCmd('t.get_url') . '=,' . getCmd('cat') . '=#",$' . getCmd('d.get_custom1') . "=,\$" . getCmd('d.get_custom') . "=x-pushbullet," . getUser() . '}';
     } else {
         $finCmd = getCmd('cat=');
     }
     if ($this->log["deletion"] || $this->log["pushbullet_enabled"] && $this->log["pushbullet_deletion"]) {
         $delCmd = getCmd('execute') . '={' . getPHP() . ',' . $rootPath . '/plugins/history/update.php' . ',3,$' . getCmd('d.get_name') . '=,$' . getCmd('d.get_size_bytes') . '=,$' . getCmd('d.get_bytes_done') . '=,$' . getCmd('d.get_up_total') . '=,$' . getCmd('d.get_ratio') . '=,$' . getCmd('d.get_creation_date') . '=,$' . getCmd('d.get_custom') . '=addtime,$' . getCmd('d.get_custom') . '=seedingtime' . ',"$' . getCmd('t.multicall') . '=$' . getCmd('d.get_hash') . '=,' . getCmd('t.get_url') . '=,' . getCmd('cat') . '=#",$' . getCmd('d.get_custom1') . "=,\$" . getCmd('d.get_custom') . "=x-pushbullet," . getUser() . '}';
     } else {
         $delCmd = getCmd('cat=');
     }
     $req = new rXMLRPCRequest(array(rTorrentSettings::get()->getOnInsertCommand(array('thistory' . getUser(), $addCmd)), rTorrentSettings::get()->getOnFinishedCommand(array('thistory' . getUser(), $finCmd)), rTorrentSettings::get()->getOnEraseCommand(array('thistory' . getUser(), $delCmd))));
     return $req->success();
 }
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:21,代码来源:history.php

示例10: setHandlers

 public function setHandlers()
 {
     if (rTorrentSettings::get()->linkExist) {
         $req = new rXMLRPCRequest($this->hasAuto() ? rTorrentSettings::get()->getScheduleCommand("loginmgr", 1440, getCmd('execute') . '={sh,-c,' . escapeshellarg(getPHP()) . ' ' . escapeshellarg(dirname(__FILE__) . '/update.php') . ' ' . escapeshellarg(getUser()) . ' & exit 0}') : rTorrentSettings::get()->getRemoveScheduleCommand("loginmgr"));
         $req->success();
     }
 }
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:7,代码来源:accounts.php

示例11: setHandlers

 public function setHandlers()
 {
     $startAt = 0;
     $req = new rXMLRPCRequest(rTorrentSettings::get()->getScheduleCommand("rss", $this->data->interval, getCmd('execute') . '={sh,-c,' . escapeshellarg(getPHP()) . ' ' . escapeshellarg(dirname(__FILE__) . '/update.php') . ' ' . escapeshellarg(getUser()) . ' & exit 0}', $startAt));
     if ($req->success()) {
         $this->setStartTime($startAt);
         return true;
     }
     return false;
 }
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:10,代码来源:rss.php

示例12: correct

 public function correct()
 {
     $cmd = new rXMLRPCCommand("d.multicall", array("default", getCmd("d.get_hash=")));
     for ($i = 0; $i < MAX_RATIO; $i++) {
         $cmd->addParameters(array(getCmd("d.views.has") . "=rat_" . $i, getCmd("view.set_not_visible") . "=rat_" . $i));
     }
     $req = new rXMLRPCRequest($cmd);
     $req->setParseByTypes();
     if ($req->success()) {
         $req1 = new rXMLRPCRequest();
         foreach ($req->strings as $no => $hash) {
             for ($i = 0; $i < MAX_RATIO; $i++) {
                 if ($req->i8s[$no * MAX_RATIO * 2 + $i * 2] == 1) {
                     $req1->addCommand(new rXMLRPCCommand("view.set_visible", array($hash, "rat_" . $i)));
                 }
             }
         }
         return $req1->getCommandsCount() == 0 || $req1->success();
     }
     return false;
 }
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:21,代码来源:ratio.php

示例13: setHandlers

 public function setHandlers()
 {
     global $autowatch_interval;
     $theSettings = rTorrentSettings::get();
     $req = new rXMLRPCRequest($theSettings->getOnInsertCommand(array('autolabel' . getUser(), getCmd('cat='))));
     $pathToAutoTools = dirname(__FILE__);
     if ($this->enable_label) {
         $cmd = $theSettings->getOnInsertCommand(array('_autolabel' . getUser(), getCmd('branch') . '=$' . getCmd('not') . '=$' . getCmd("d.get_custom1") . '=,"' . getCmd('execute') . '={' . getPHP() . ',' . $pathToAutoTools . '/label.php,$' . getCmd("d.get_hash") . '=,' . getUser() . '}"'));
     } else {
         $cmd = $theSettings->getOnInsertCommand(array('_autolabel' . getUser(), getCmd('cat=')));
     }
     $req->addCommand($cmd);
     if ($this->enable_move && trim($this->path_to_finished) != '') {
         if ($theSettings->iVersion < 0x808) {
             $cmd = $theSettings->getOnFinishedCommand(array('automove' . getUser(), getCmd('d.set_custom') . '=x-dest,"$' . getCmd('execute_capture') . '={' . getPHP() . ',' . $pathToAutoTools . '/move.php,$' . getCmd('d.get_hash') . '=,$' . getCmd('d.get_base_path') . '=,$' . getCmd('d.get_base_filename') . '=,$' . getCmd('d.is_multi_file') . '=,' . getUser() . '}" ; ' . getCmd('branch') . '=$' . getCmd('not') . '=$' . getCmd('d.get_custom') . '=x-dest,,' . getCmd('d.set_directory_base') . '=$' . getCmd('d.get_custom') . '=x-dest'));
         } else {
             if ($this->fileop_type == "Move") {
                 $cmd = $theSettings->getOnFinishedCommand(array('automove' . getUser(), getCmd('d.set_directory_base') . '="$' . getCmd('execute_capture') . '={' . getPHP() . ',' . $pathToAutoTools . '/check.php,$' . getCmd('d.get_base_path') . '=,$' . getCmd('d.get_base_filename') . '=,$' . getCmd('d.is_multi_file') . '=,' . getUser() . '}" ; ' . getCmd('execute') . '={' . getPHP() . ',' . $pathToAutoTools . '/move.php,$' . getCmd('d.get_hash') . '=,$' . getCmd('d.get_base_path') . '=,$' . getCmd('d.get_base_filename') . '=,$' . getCmd('d.is_multi_file') . '=,' . getUser() . '}'));
             } else {
                 $cmd = $theSettings->getOnFinishedCommand(array('automove' . getUser(), getCmd('execute') . '={' . getPHP() . ',' . $pathToAutoTools . '/move.php,$' . getCmd('d.get_hash') . '=,$' . getCmd('d.get_base_path') . '=,$' . getCmd('d.get_base_filename') . '=,$' . getCmd('d.is_multi_file') . '=,' . getUser() . '}'));
             }
         }
     } else {
         $cmd = $theSettings->getOnFinishedCommand(array('automove' . getUser(), getCmd('cat=')));
     }
     $req->addCommand($cmd);
     if ($this->enable_watch && trim($this->path_to_watch) != '') {
         $cmd = $theSettings->getAbsScheduleCommand('autowatch', $autowatch_interval, getCmd('execute') . '={sh,-c,' . escapeshellarg(getPHP()) . ' ' . escapeshellarg($pathToAutoTools . '/watch.php') . ' ' . escapeshellarg(getUser()) . ' &}');
     } else {
         $cmd = $theSettings->getRemoveScheduleCommand('autowatch');
     }
     $req->addCommand($cmd);
     return $req->success();
 }
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:34,代码来源:autotools.php

示例14: run

 public static function run($hash, $state = null, $time = null, $successful_time = null)
 {
     global $saveUploadedTorrents;
     if (is_null($state)) {
         self::getState($hash, $state, $time, $successful_time);
     }
     if ($state == self::STE_INPROGRESS && time() - $time > self::MAX_LOCK_TIME) {
         $state = 0;
     }
     if ($state != self::STE_INPROGRESS) {
         $state = self::STE_INPROGRESS;
         if (!self::setState($hash, $state)) {
             return false;
         }
         $fname = rTorrentSettings::get()->session . $hash . ".torrent";
         if (is_readable($fname)) {
             $torrent = new Torrent($fname);
             if (!$torrent->errors()) {
                 if (preg_match('`^http://(?P<tracker>rutracker)\\.org/forum/viewtopic\\.php\\?t=(?P<id>\\d+)$`', $torrent->comment(), $matches) || preg_match('`^http://(?P<tracker>kinozal)\\.tv/details\\.php\\?id=(?P<id>\\d+)$`', $torrent->comment(), $matches)) {
                     if ($matches["tracker"] == "rutracker") {
                         $client = self::makeClient($torrent->comment());
                         if ($client->status == 200 && preg_match("`ajax.form_token\\s*=\\s*'(?P<form_token>[^']+)';.*topic_id\\s*:\\s*(?P<topic_id>\\d+),\\s*t_hash\\s*:\\s*'(?P<t_hash>[^']+)'`s", $client->results, $matches1)) {
                             $client->setcookies();
                             $client->fetch("http://rutracker.org/forum/ajax.php", "POST", "application/x-www-form-urlencoded; charset=UTF-8", "action=get_info_hash" . "&topic_id=" . $matches1["topic_id"] . "&t_hash=" . $matches1["t_hash"] . "&form_token=" . $matches1["form_token"]);
                             if ($client->status == 200) {
                                 $ret = json_decode($client->results, true);
                                 if ($ret && array_key_exists("ih_hex", $ret) && strtoupper($ret["ih_hex"]) == $hash) {
                                     self::setState($hash, self::STE_UPTODATE);
                                     return true;
                                 }
                             }
                         }
                         $client->setcookies();
                         $client->fetchComplex("http://dl.rutracker.org/forum/dl.php?t=" . $matches["id"]);
                     } else {
                         if ($matches["tracker"] == "kinozal") {
                             $client = self::makeClient("http://kinozal.tv/get_srv_details.php?action=2&id=" . $matches["id"]);
                             if ($client->status == 200 && preg_match('`<li>.*(?P<hash>[0-9A-Fa-f]{40})</li>`', $client->results, $matches1)) {
                                 if (strtoupper($matches1["hash"]) == $hash) {
                                     self::setState($hash, self::STE_UPTODATE);
                                     return true;
                                 }
                             }
                             $client->setcookies();
                             $client->fetchComplex("http://dl.kinozal.tv/download.php?id=" . $matches["id"]);
                         } else {
                             self::setState($hash, self::STE_NOT_NEED);
                             return true;
                         }
                     }
                     if ($client->status == 200) {
                         $torrent = new Torrent($client->results);
                         if (!$torrent->errors()) {
                             if ($torrent->hash_info() != $hash) {
                                 $req = new rXMLRPCRequest(array(new rXMLRPCCommand("d.get_directory_base", $hash), new rXMLRPCCommand("d.get_custom1", $hash), new rXMLRPCCommand("d.get_throttle_name", $hash), new rXMLRPCCommand("d.get_connection_seed", $hash), new rXMLRPCCommand("d.is_open", $hash), new rXMLRPCCommand("d.is_active", $hash), new rXMLRPCCommand("d.get_state", $hash), new rXMLRPCCommand("d.stop", $hash), new rXMLRPCCommand("d.close", $hash)));
                                 if ($req->success()) {
                                     $addition = array(getCmd("d.set_connection_seed=") . $req->val[3], getCmd("d.set_custom") . "=chk-state," . self::STE_UPDATED, getCmd("d.set_custom") . "=chk-time," . time(), getCmd("d.set_custom") . "=chk-stime," . time());
                                     $isStart = $req->val[4] != 0 && $req->val[5] != 0 && $req->val[6] != 0;
                                     if (!empty($req->val[2])) {
                                         $addition[] = getCmd("d.set_throttle_name=") . $req->val[2];
                                     }
                                     if (preg_match('/rat_(\\d+)/', $req->val[3], $ratio)) {
                                         $addition[] = getCmd("view.set_visible=") . "rat_" . $ratio;
                                     }
                                     $label = rawurldecode($req->val[1]);
                                     if (rTorrent::sendTorrent($torrent, $isStart, false, $req->val[0], $label, $saveUploadedTorrents, false, true, $addition)) {
                                         $req = new rXMLRPCRequest(new rXMLRPCCommand("d.erase", $hash));
                                         if ($req->success()) {
                                             $state = null;
                                         }
                                     }
                                 }
                             } else {
                                 $state = self::STE_UPTODATE;
                             }
                         } else {
                             $state = self::STE_DELETED;
                         }
                     } else {
                         $state = $client->status < 0 ? self::STE_CANT_REACH_TRACKER : self::STE_DELETED;
                     }
                 } else {
                     $state = self::STE_NOT_NEED;
                 }
             }
         }
         if ($state == self::STE_INPROGRESS) {
             $state == self::STE_ERROR;
         }
         if (!is_null($state)) {
             self::setState($hash, $state);
         }
     }
     return $state != self::STE_CANT_REACH_TRACKER;
 }
开发者ID:anthonyryan1,项目名称:ruTorrent,代码行数:95,代码来源:check.php

示例15: run

 public static function run($cmd, $flags = 0)
 {
     $ret = -1;
     $params = " >/dev/null 2>&1";
     if (!($flags & self::FLG_WAIT)) {
         $params .= " &";
     }
     if ($flags & self::FLG_RUN_AS_WEB) {
         if (self::FLG_RUN_AS_CMD) {
             $cmd = '-c "' . $cmd . '"';
         }
         exec('sh ' . $cmd . $params, $output, $ret);
     } else {
         $req = new rXMLRPCRequest(rTorrentSettings::get()->iVersion >= 0x900 && !($flags & self::FLG_WAIT) ? new rXMLRPCCommand("execute.nothrow.bg", array("", "sh", $cmd)) : new rXMLRPCCommand("execute_nothrow", array("sh", "-c", $cmd . $params)));
         if ($req->success() && count($req->val)) {
             $ret = intval($req->val[0]);
         }
     }
     return $ret;
 }
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:20,代码来源:task.php


注:本文中的rXMLRPCRequest::success方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。