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


PHP rXMLRPCRequest::addCommand方法代码示例

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


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

示例1: sendTorrent

 public static function sendTorrent($fname, $isStart, $directory = null)
 {
     $hash = false;
     $torrent = is_object($fname) ? $fname : new \model\simple\Torrent($fname);
     if (!$torrent->errors()) {
         $raw_value = base64_encode($torrent->__toString());
         $filename = is_object($fname) ? $torrent->getFileName() : $fname;
         if (strlen($raw_value) < self::RTORRENT_PACKET_LIMIT || is_null($filename)) {
             $cmd = new rXMLRPCCommand(\config\Conf::$userscgi, $isStart ? 'load.raw_start' : 'load.raw');
             $cmd->addParameter("");
             $cmd->addParameter($raw_value, "base64");
             if (!is_null($filename) && !true) {
                 @unlink($filename);
             }
         } else {
             $cmd = new rXMLRPCCommand(\config\Conf::$userscgi, $isStart ? 'load.start' : 'load.normal');
             $cmd->addParameter("");
             $cmd->addParameter($filename);
         }
         if (!is_null($filename) && rTorrentSettings::get(\config\Conf::$userscgi)->iVersion >= 0x805) {
             $cmd->addParameter(rTorrentSettings::getCmd(\config\Conf::$userscgi, "d.custom.set") . "=x-filename," . rawurlencode(basename($filename)));
         }
         $req = new rXMLRPCRequest(\config\Conf::$userscgi);
         $req->addCommand($cmd);
         if (!is_null($directory)) {
             $cmd->addParameter(rTorrentSettings::getCmd(\config\Conf::$userscgi, "d.directory.set=") . "\"" . $directory . "\"");
         }
         if ($req->run() && !$req->fault) {
             $hash = $req->val;
         }
     }
     return $hash;
 }
开发者ID:CamTosh,项目名称:Mediastorrent,代码行数:33,代码来源:rTorrent.php

示例2: setState

 protected static function setState($hash, $state)
 {
     $req = new rXMLRPCRequest(array(new rXMLRPCCommand(getCmd("d.set_custom"), array($hash, "chk-state", $state . "")), new rXMLRPCCommand(getCmd("d.set_custom"), array($hash, "chk-time", time() . ""))));
     if ($state == self::STE_UPTODATE) {
         $req->addCommand(new rXMLRPCCommand(getCmd("d.set_custom"), array($hash, "chk-stime", time() . "")));
     }
     return $req->success();
 }
开发者ID:limerainne,项目名称:ruTorrent,代码行数:8,代码来源:check.php

示例3: 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

示例4: 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

示例5: checkLabels

 public function checkLabels($hashes)
 {
     $req = new rXMLRPCRequest();
     foreach ($hashes as $hash) {
         $req->addCommand(new rXMLRPCCommand("d.get_custom1", $hash));
         $req->addCommand(new rXMLRPCCommand("d.get_state", $hash));
         $req->addCommand(new rXMLRPCCommand("d.views", $hash));
         $req->addCommand(new rXMLRPCCommand("d.get_throttle_name", $hash));
     }
     if ($req->getCommandsCount() && $req->success()) {
         $out = new rXMLRPCRequest();
         foreach ($hashes as $ndx => $hash) {
             $label = rawurldecode($req->val[$ndx * 4]);
             $state = !empty($req->val[$ndx * 4 + 1]);
             $ratio = null;
             if (preg_match('`rat_(\\d+)`', $req->val[$ndx * 4 + 2], $matches)) {
                 $ratio = 'rat_' . $matches[1];
             }
             $throttle = $req->val[$ndx * 4 + 3];
             $trackers = '';
             $req1 = new rXMLRPCRequest(array(new rXMLRPCCommand("t.multicall", array($hash, "", getCmd("t.get_url=")))));
             if ($req1->success()) {
                 $trackers = implode('#', $req1->val);
             }
             $rule = $this->getRule($label, $trackers);
             if ($rule) {
                 if (!empty($rule->channel) && $rule->channel != $throttle) {
                     if ($state) {
                         $out->addCommand(new rXMLRPCCommand('d.stop', $hash));
                     }
                     $out->addCommand(new rXMLRPCCommand('d.set_throttle_name', array($hash, $rule->channel)));
                     if ($state) {
                         $out->addCommand(new rXMLRPCCommand('d.start', $hash));
                     }
                 }
                 if (!empty($rule->ratio) && $rule->ratio != $ratio) {
                     if (!is_null($ratio)) {
                         $out->addCommand(new rXMLRPCCommand('view.set_not_visible', array($hash, $ratio)));
                         $out->addCommand(new rXMLRPCCommand('d.views.remove', array($hash, $ratio)));
                     }
                     $out->addCommand(new rXMLRPCCommand('d.views.push_back_unique', array($hash, $rule->ratio)));
                     $out->addCommand(new rXMLRPCCommand('view.set_visible', array($hash, $rule->ratio)));
                 }
             }
         }
         if ($out->getCommandsCount()) {
             $out->run();
         }
     }
 }
开发者ID:byte916,项目名称:ruTorrent,代码行数:50,代码来源:rules.php

示例6: rtExec

function rtExec($cmds, $hash, $dbg)
{
    $req = new rXMLRPCRequest();
    if (!is_array($cmds)) {
        $req->addCommand(new rXMLRPCCommand($cmds, $hash));
        if ($dbg) {
            rtDbg(__FUNCTION__, $cmds);
        }
    } else {
        $s = '';
        foreach ($cmds as $cmd) {
            $s .= $cmd . ", ";
            $req->addCommand(new rXMLRPCCommand($cmd, $hash));
        }
        if ($dbg) {
            rtDbg(__FUNCTION__, substr($s, 0, -2));
        }
    }
    if (!$req->run()) {
        if ($dbg) {
            rtDbg(__FUNCTION__, "rXMLRPCRequest() run fail");
        }
        return null;
    } elseif ($req->fault) {
        if ($dbg) {
            rtDbg(__FUNCTION__, "rXMLRPCRequest() fault");
        }
        return null;
    } else {
        return $req;
    }
}
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:32,代码来源:util_rt.php

示例7: foreach

                         }
                     }
                 }
             }
         }
     }
 }
 if (count($trackers) > 0) {
     $announce_list[] = $trackers;
 }
 if ($setComment || $setTrackers || $setPrivate) {
     foreach ($hashes as $hash) {
         $req = new rXMLRPCRequest(array(new rXMLRPCCommand("get_session"), new rXMLRPCCommand("d.is_open", $hash), new rXMLRPCCommand("d.is_active", $hash), new rXMLRPCCommand("d.get_state", $hash), new rXMLRPCCommand("d.get_tied_to_file", $hash), new rXMLRPCCommand("d.get_custom1", $hash), new rXMLRPCCommand("d.get_directory_base", $hash), new rXMLRPCCommand("d.get_connection_seed", $hash), new rXMLRPCCommand("d.get_complete", $hash)));
         $throttle = null;
         if (rTorrentSettings::get()->isPluginRegistered("throttle")) {
             $req->addCommand(new rXMLRPCCommand("d.get_throttle_name", $hash));
         }
         if ($req->run() && !$req->fault) {
             $isStart = $req->val[1] != 0 && $req->val[2] != 0 && $req->val[3] != 0;
             $fname = $req->val[0] . $hash . ".torrent";
             if (empty($req->val[0]) || !is_readable($fname)) {
                 if (strlen($req->val[4]) && is_readable($req->val[4])) {
                     $fname = $req->val[4];
                 } else {
                     $fname = null;
                 }
             }
             if ($fname) {
                 $torrent = new Torrent($fname);
                 if (!$torrent->errors()) {
                     if ($setPrivate) {
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:31,代码来源:action.php

示例8: flush

 public function flush()
 {
     $req1 = new rXMLRPCRequest(new rXMLRPCCommand("view_list"));
     if ($req1->run() && !$req1->fault) {
         $insCmd = getCmd('branch=');
         $req = new rXMLRPCRequest();
         for ($i = 0; $i < MAX_RATIO; $i++) {
             $insCmd .= getCmd('d.views.has=') . 'rat_' . $i . ',,';
             $rat = $this->rat[$i];
             if (!in_array("rat_" . $i, $req1->val)) {
                 $req->addCommand(new rXMLRPCCommand("group.insert_persistent_view", array("", "rat_" . $i)));
             }
             if ($this->isCorrect($i)) {
                 $req->addCommand(new rXMLRPCCommand("group.rat_" . $i . ".ratio.enable", array("")));
                 $req->addCommand(new rXMLRPCCommand("group.rat_" . $i . ".ratio.min.set", $rat["min"]));
                 $req->addCommand(new rXMLRPCCommand("group.rat_" . $i . ".ratio.max.set", $rat["max"]));
                 $req->addCommand(new rXMLRPCCommand("group.rat_" . $i . ".ratio.upload.set", floatval($rat["upload"] * 1024 * 1024)));
                 switch ($rat["action"]) {
                     case RAT_STOP:
                         $req->addCommand(new rXMLRPCCommand("system.method.set", array("group.rat_" . $i . ".ratio.command", getCmd("d.stop=") . "; " . getCmd("d.close="))));
                         break;
                     case RAT_STOP_AND_REMOVE:
                         $req->addCommand(new rXMLRPCCommand("system.method.set", array("group.rat_" . $i . ".ratio.command", getCmd("d.stop=") . "; " . getCmd("d.close=") . "; " . getCmd("view.set_not_visible") . "=rat_" . $i . "; " . getCmd("d.views.remove") . "=rat_" . $i)));
                         break;
                     case RAT_ERASE:
                         $req->addCommand(new rXMLRPCCommand("system.method.set", array("group.rat_" . $i . ".ratio.command", getCmd("d.stop=") . "; " . getCmd("d.close=") . "; " . getCmd("d.erase="))));
                         break;
                     case RAT_ERASEDATA:
                         $req->addCommand(new rXMLRPCCommand("system.method.set", array("group.rat_" . $i . ".ratio.command", getCmd("d.stop=") . "; " . getCmd("d.close=") . "; " . getCmd("d.set_custom5=") . "1; " . getCmd("d.erase="))));
                         break;
                     default:
                         $thr = "thr_" . ($rat["action"] - RAT_FIRSTTHROTTLE);
                         $req->addCommand(new rXMLRPCCommand("system.method.set", array("group.rat_" . $i . ".ratio.command", getCmd('cat') . '=$' . getCmd("d.stop") . '=,$' . getCmd("d.set_throttle_name=") . $thr . ',$' . getCmd('d.start='))));
                         break;
                 }
             }
         }
         if ($this->isCorrect($this->default - 1)) {
             $req->addCommand(rTorrentSettings::get()->getOnInsertCommand(array('_ratio' . getUser(), $insCmd . getCmd('view.set_visible=') . 'rat_' . ($this->default - 1))));
         } else {
             $req->addCommand(rTorrentSettings::get()->getOnInsertCommand(array('_ratio' . getUser(), getCmd('cat='))));
         }
         return $req->run() && !$req->fault;
     }
     return false;
 }
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:46,代码来源:ratio.php

示例9: 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

示例10: sendMagnet

 public static function sendMagnet($magnet, $isStart, $isAddPath, $directory, $label, $addition = null)
 {
     $hpos = stripos($magnet, 'xt=urn:btih:');
     if ($hpos !== false) {
         $hpos += 12;
         $fpos = stripos($magnet, '&', $hpos);
         if ($fpos === false) {
             $fpos = strlen($magnet);
         }
         $hash = strtoupper(substr($magnet, $hpos, $fpos - $hpos));
         if (strlen($hash) == 32) {
             $hash = base32decode($hash);
         }
         if (strlen($hash) == 40) {
             $req = new rXMLRPCRequest();
             $cmd = new rXMLRPCCommand($isStart ? 'load_start' : 'load');
             $cmd->addParameter($magnet);
             if ($directory && strlen($directory) > 0) {
                 if (!rTorrentSettings::get()->correctDirectory($directory)) {
                     return false;
                 }
                 $cmd->addParameter(($isAddPath ? getCmd("d.set_directory=") . "\"" : getCmd("d.set_directory_base=") . "\"") . $directory . "\"");
                 $req->addCommand(new rXMLRPCCommand('execute', array('mkdir', '-p', $directory)));
             }
             if ($label && strlen($label) > 0) {
                 $label = rawurlencode($label);
                 if (strlen($label) <= 4096) {
                     $cmd->addParameter(getCmd("d.set_custom1=") . $label);
                 }
             }
             if (is_array($addition)) {
                 foreach ($addition as $key => $prm) {
                     $cmd->addParameter($prm, 'string');
                 }
             }
             $req->addCommand($cmd);
             if ($req->success()) {
                 return $hash;
             }
         }
     }
     return false;
 }
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:43,代码来源:rtorrent.php

示例11: obtain

 public function obtain()
 {
     $req = new rXMLRPCRequest(array(new rXMLRPCCommand("get_upload_rate"), new rXMLRPCCommand("get_download_rate")));
     if ($req->run() && !$req->fault) {
         $req1 = new rXMLRPCRequest();
         if ($req->val[0] == 0) {
             $req1->addCommand(new rXMLRPCCommand("set_upload_rate", MAX_SPEED));
         }
         if ($req->val[1] == 0) {
             $req1->addCommand(new rXMLRPCCommand("set_download_rate", MAX_SPEED));
         }
         if (($req->val[0] == 0 || $req->val[1] == 0) && (!$req1->run() || $req1->fault)) {
             return false;
         }
         return $this->correct();
     }
     return false;
 }
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:18,代码来源:throttle.php

示例12: processArray

 public static function processArray($hashes, $cmd1, $cmd2)
 {
     $req = new rXMLRPCRequest();
     foreach ($hashes as $hash => $val) {
         $req->addCommand(new rXMLRPCCommand($cmd1, $hash));
         $req->addCommand(new rXMLRPCCommand($cmd2, $hash));
     }
     return $req->run() && !$req->fault;
 }
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:9,代码来源:scheduler.php


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