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


PHP rTorrentSettings类代码示例

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


在下文中一共展示了rTorrentSettings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: correct

 public function correct($deltaUp, $deltaDown)
 {
     $tm = getdate();
     $ndx = $tm["hours"];
     $was = getdate($this->hourHitTimes[$ndx]);
     if ($tm[0] - $this->hourHitTimes[$ndx] > 3600 + 3600 || $ndx != $was["hours"]) {
         $this->hourHitTimes[$ndx] = $tm[0];
         $this->hourUp[$ndx] = 0;
         $this->hourDown[$ndx] = 0;
     }
     $this->hourUp[$ndx] += $deltaUp;
     $this->hourDown[$ndx] += $deltaDown;
     $ndx = $tm["mday"] - 1;
     $was = getdate($this->monthHitTimes[$ndx]);
     if ($tm[0] - $this->monthHitTimes[$ndx] > 3600 * 24 + 3600 || $ndx != $was["mday"] - 1) {
         $this->monthHitTimes[$ndx] = $tm[0];
         $this->monthUp[$ndx] = 0;
         $this->monthDown[$ndx] = 0;
     }
     $this->monthUp[$ndx] += $deltaUp;
     $this->monthDown[$ndx] += $deltaDown;
     $ndx = $tm["mon"] - 1;
     $was = getdate($this->yearHitTimes[$ndx]);
     if ($tm[0] - $this->yearHitTimes[$ndx] > 3600 * 24 * 31 + 3600 || $ndx != $was["mon"] - 1) {
         $this->yearHitTimes[$ndx] = $tm[0];
         $this->yearUp[$ndx] = 0;
         $this->yearDown[$ndx] = 0;
     }
     $this->yearUp[$ndx] += $deltaUp;
     $this->yearDown[$ndx] += $deltaDown;
     rTorrentSettings::get()->pushEvent("TraficUpdated", array("stat" => &$this));
 }
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:32,代码来源:stat.php

示例3: __construct

 public function __construct($user, $cmd, $args = null)
 {
     //\trigger_error("ddd");
     //throw new \Exception("ddd");
     $this->user = $user;
     $this->command = rTorrentSettings::getCmd($this->user, $cmd);
     $this->params = array();
     if ($args !== null) {
         if (is_array($args)) {
             foreach ($args as $prm) {
                 $this->addParameter($prm);
             }
         } else {
             $this->addParameter($args);
         }
     }
 }
开发者ID:CamTosh,项目名称:Mediastorrent,代码行数:17,代码来源:rXMLRPCCommand.php

示例4: init

 public function init()
 {
     $req = new rXMLRPCRequest();
     for ($i = 0; $i < MAX_THROTTLE; $i++) {
         if ($this->isCorrect($i)) {
             $up = $this->thr[$i]["up"];
             $down = $this->thr[$i]["down"];
         } else {
             $up = 0;
             $down = 0;
         }
         $req->addCommand(new rXMLRPCCommand("throttle_up", array("thr_" . $i, $up . "")));
         $req->addCommand(new rXMLRPCCommand("throttle_down", array("thr_" . $i, $down . "")));
     }
     if ($this->isCorrect($this->default - 1)) {
         $req->addCommand(rTorrentSettings::get()->getOnInsertCommand(array('_throttle' . getUser(), getCmd('branch') . '=$' . getCmd('not') . '=$' . getCmd("d.get_throttle_name") . '=,' . getCmd('d.set_throttle_name') . '=thr_' . ($this->default - 1))));
     } else {
         $req->addCommand(rTorrentSettings::get()->getOnInsertCommand(array('_throttle' . getUser(), getCmd('cat='))));
     }
     return $req->run() && !$req->fault;
 }
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:21,代码来源:throttle.php

示例5: load

 public static function load($mngr = null)
 {
     $cache = new rCache();
     $ar = new rURLRewriteRulesList();
     $cache->get($ar);
     if (rTorrentSettings::get()->isPluginRegistered("rss")) {
         $changed = false;
         if (is_null($mngr)) {
             require_once dirname(__FILE__) . '/../rss/rss.php';
             $mngr = new rRSSManager();
         }
         foreach ($ar->lst as $rule) {
             if (!empty($rule->rssHash) && !$mngr->rssList->isExist($rule->rssHash) && !$mngr->groups->get($rule->rssHash)) {
                 $rule->rssHash = '';
                 $changed = true;
             }
         }
         if ($changed) {
             $ar->store();
         }
     }
     return $ar;
 }
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:23,代码来源:rules.php

示例6: Debug

    Debug("enabled          : " . $at->enable_watch);
    Debug("autostart        : " . $at->watch_start);
    if ($at->enable_watch) {
        $auto_start = $at->watch_start;
        $path_to_watch = rtAddTailSlash(trim($at->path_to_watch));
        Debug("path_to_watch    : " . $path_to_watch);
        if ($path_to_watch == '' || $path_to_watch == '/') {
            $is_ok = false;
        }
    } else {
        $is_ok = false;
    }
}
// Ask info from rTorrent
if ($is_ok) {
    $directory = rtAddTailSlash(rTorrentSettings::get()->directory);
    Debug("get_directory    : " . $directory);
    if ($directory == '' || $directory == '/') {
        $is_ok = false;
    }
}
// Scan for *.torrent files at $path_to_watch
if ($is_ok) {
    $files = rtScanFiles($path_to_watch, "/.*\\.torrent\$/i");
    // ignore case
    foreach ($files as $file) {
        $torrent_file = $path_to_watch . $file;
        // don't use realpath() here !!!
        $dest_path = rtAddTailSlash(dirname($directory . $file));
        Debug("torrent file     : " . $torrent_file);
        Debug("save data to     : " . $dest_path);
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:31,代码来源:watch.php

示例7: run

 public static function run($hash, $state = null, $time = null, $successful_time = null)
 {
     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)) {
             $state = self::run_ex($hash, $fname);
         }
         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:limerainne,项目名称:ruTorrent,代码行数:26,代码来源:check.php

示例8: rXMLRPCRequest

     }
     break;
 case "add_peer":
     $req = new rXMLRPCRequest(new rXMLRPCCommand("add_peer", array($hash[0], $vs[0])));
     if ($req->success()) {
         $result = $req->val;
     }
     break;
 case "getchunks":
     $req = new rXMLRPCRequest(array(new rXMLRPCCommand("d.get_bitfield", $hash[0]), new rXMLRPCCommand("d.get_chunk_size", $hash[0]), new rXMLRPCCommand("d.get_size_chunks", $hash[0])));
     if (rTorrentSettings::get()->apiVersion >= 4) {
         $req->addCommand(new rXMLRPCCommand("d.chunks_seen", $hash[0]));
     }
     if ($req->success()) {
         $result = array("chunks" => $req->val[0], "size" => $req->val[1], "tsize" => $req->val[2]);
         if (rTorrentSettings::get()->apiVersion >= 4) {
             $result["seen"] = $req->val[3];
         }
     }
     break;
 default:
     if (isset($HTTP_RAW_POST_DATA)) {
         $result = rXMLRPCRequest::send($HTTP_RAW_POST_DATA);
         if (!empty($result)) {
             $pos = strpos($result, "\r\n\r\n");
             if ($pos !== false) {
                 $result = substr($result, $pos + 4);
             }
             cachedEcho($result, "text/xml");
         }
     }
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:31,代码来源:action.php

示例9: rXMLRPCRequest

<?php

$req = new rXMLRPCRequest(rTorrentSettings::get()->getRemoveScheduleCommand('rutracker_check'));
$req->run();
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:4,代码来源:done.php

示例10: trim

        if (isset($request['comment'])) {
            $comment = trim($request['comment']);
            if (strlen($comment)) {
                $torrent->comment($comment);
            }
        }
        if ($request['private']) {
            $torrent->is_private(true);
        }
        $fname = rTask::formatPath($taskNo) . '/result.torrent';
        $torrent->save($fname);
        if ($request['start_seeding']) {
            $fname = getUniqueUploadedFilename($torrent->info['name'] . '.torrent');
            $path_edit = trim($request['path_edit']);
            if (is_dir($path_edit)) {
                $path_edit = addslash($path_edit);
            }
            if (rTorrentSettings::get()->correctDirectory($path_edit)) {
                $path_edit = dirname($path_edit);
                if ($resumed = rTorrent::fastResume($torrent, $path_edit)) {
                    $torrent = $resumed;
                }
                $torrent->save($fname);
                rTorrent::sendTorrent($torrent, true, true, $path_edit, null, true, isLocalMode());
                @chmod($fname, $profileMask & 0666);
            }
        }
        exit(0);
    }
    exit(1);
}
开发者ID:NetOverflow,项目名称:ruTorrent,代码行数:31,代码来源:createtorrent.php

示例11: rtRemoveTailSlash

require_once "./util_rt.php";
require_once "./autotools.php";
$base_path = $argv[1];
$base_name = $argv[2];
$is_multy = $argv[3];
$base_path = rtRemoveTailSlash($base_path);
$base_path = rtRemoveLastToken($base_path, '/');
// filename or dirname
$base_path = rtAddTailSlash($base_path);
$dest_path = $base_path;
$at = rAutoTools::load();
if ($at->enable_move) {
    $path_to_finished = trim($at->path_to_finished);
    if ($path_to_finished != '') {
        $path_to_finished = rtAddTailSlash($path_to_finished);
        $directory = rTorrentSettings::get()->directory;
        if (!empty($directory)) {
            $directory = rtAddTailSlash($directory);
            $rel_path = rtGetRelativePath($directory, $base_path);
            //------------------------------------------------------------------------------
            // !! this is a feature !!
            // ($rel_path == '') means, that $base_path is NOT a SUBDIR of $directory at all
            // so, we have to skip all automove actions
            // for example, if we don't want torrent to be automoved - we save it out of $directory subtree
            //------------------------------------------------------------------------------
            if ($rel_path != '') {
                if ($rel_path == './') {
                    $rel_path = '';
                }
                $dest_path = rtAddTailSlash($path_to_finished . $rel_path);
            }
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:31,代码来源:check.php

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

示例13: makeCall

 protected function makeCall()
 {
     rTorrentSettings::get()->patchDeprecatedRequest($this->commands);
     $this->fault = false;
     $this->content = "";
     $cnt = count($this->commands);
     if ($cnt > 0) {
         $this->content = '<?xml version="1.0" encoding="UTF-8"?><methodCall><methodName>';
         if ($cnt == 1) {
             $cmd = $this->commands[0];
             $this->content .= "{$cmd->command}</methodName><params>\r\n";
             foreach ($cmd->params as &$prm) {
                 $this->content .= "<param><value><{$prm->type}>{$prm->value}</{$prm->type}></value></param>\r\n";
             }
         } else {
             $this->content .= "system.multicall</methodName><params><param><value><array><data>";
             foreach ($this->commands as &$cmd) {
                 $this->content .= "\r\n<value><struct><member><name>methodName</name><value><string>" . "{$cmd->command}</string></value></member><member><name>params</name><value><array><data>";
                 foreach ($cmd->params as &$prm) {
                     $this->content .= "\r\n<value><{$prm->type}>{$prm->value}</{$prm->type}></value>";
                 }
                 $this->content .= "\r\n</data></array></value></member></struct></value>";
             }
             $this->content .= "\r\n</data></array></value></param>";
         }
         $this->content .= "</params></methodCall>";
     }
     return $cnt > 0;
 }
开发者ID:jcvfen,项目名称:rutorrent,代码行数:29,代码来源:xmlrpc.php

示例14: setHandlers

 public function setHandlers()
 {
     global $rootPath;
     $throttleRulesExist = false;
     $ratioRulesExist = false;
     foreach ($this->lst as $item) {
         if ($item->ratio != '') {
             $ratioRulesExist = true;
         }
         if ($item->channel != '') {
             $throttleRulesExist = true;
         }
     }
     if ($ratioRulesExist) {
         eval(getPluginConf('ratio'));
         $insCmd = '';
         for ($i = 0; $i < MAX_RATIO; $i++) {
             $insCmd .= getCmd('d.views.has=') . 'rat_' . $i . ',,';
         }
         $ratCmd = getCmd('d.set_custom') . '=x-extratio1,"$' . getCmd('execute_capture') . '={' . getPHP() . ',' . $rootPath . '/plugins/extratio/update.php,\\"$' . getCmd('t.multicall') . '=$' . getCmd('d.get_hash') . '=,' . getCmd('t.get_url') . '=,' . getCmd('cat') . '=#\\",$' . getCmd('d.get_custom1') . '=,ratio,' . getUser() . '}" ; ' . getCmd('branch') . '=$' . getCmd('not') . '=$' . getCmd('d.get_custom') . '=x-extratio1,,' . $insCmd . getCmd('view.set_visible') . '=$' . getCmd('d.get_custom') . '=x-extratio1';
     } else {
         $ratCmd = getCmd('cat=');
     }
     if ($throttleRulesExist) {
         $thrCmd = getCmd('d.set_custom') . '=x-extratio2,"$' . getCmd('execute_capture') . '={' . getPHP() . ',' . $rootPath . '/plugins/extratio/update.php,\\"$' . getCmd('t.multicall') . '=$' . getCmd('d.get_hash') . '=,' . getCmd('t.get_url') . '=,' . getCmd('cat') . '=#\\",$' . getCmd('d.get_custom1') . '=,channel,' . getUser() . '}" ; ' . getCmd('branch') . '=$' . getCmd('not') . '=$' . getCmd('d.get_custom') . '=x-extratio2,,' . getCmd('d.set_throttle_name') . '=$' . getCmd('d.get_custom') . '=x-extratio2';
     } else {
         $thrCmd = getCmd('cat=');
     }
     $req = new rXMLRPCRequest(array(rTorrentSettings::get()->getOnInsertCommand(array('_exratio1' . getUser(), $ratCmd)), rTorrentSettings::get()->getOnInsertCommand(array('_exratio2' . getUser(), $thrCmd))));
     return $req->success();
 }
开发者ID:byte916,项目名称:ruTorrent,代码行数:31,代码来源:rules.php

示例15: get

 public static function get($create = false)
 {
     if (is_null(self::$theSettings)) {
         self::$theSettings = new rTorrentSettings();
         if ($create) {
             self::$theSettings->obtain();
         } else {
             $cache = new rCache();
             $cache->get(self::$theSettings);
         }
     }
     return self::$theSettings;
 }
开发者ID:chaitanya11,项目名称:rtorrent,代码行数:13,代码来源:settings.php


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