コード例 #1
0
ファイル: check.php プロジェクト: chaitanya11/rtorrent
$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);
            }
        }
    }
}
コード例 #2
0
ファイル: label.php プロジェクト: NetOverflow/ruTorrent
        $custom3 = trim($req->val[1]);
        Debug("get_directory   : " . $default_dir);
        Debug("d.get_directory : " . $torrent_dir);
        Debug("d.get_custom3   : " . $custom3);
        Debug("d.is_multy_file : " . $is_multy_file);
        if ($default_dir == '' || $torrent_dir == '') {
            Debug("base paths are not set");
            $is_ok = false;
        } elseif ($custom3 == '1') {
            Debug("torrent is NOT NEW (modified by another plugin)");
            $is_ok = false;
        } else {
            if ($is_multy_file) {
                $torrent_dir = rtRemoveLastToken($torrent_dir, '/');
            }
            $lbl_dir = rtGetRelativePath($default_dir, $torrent_dir);
            if ($lbl_dir == "./") {
                $lbl_dir = "";
            }
            $label = str_replace("{DIR}", $lbl_dir, $label);
        }
    } else {
        Debug("rXMLRPCRequest() fail");
        $is_ok = false;
    }
}
// Get info about tracker
if ($is_ok && strpos($label, "{TRACKER}") !== false) {
    $req = new rXMLRPCRequest(array(new rXMLRPCCommand("t.multicall", array($hash, "", getCmd("t.is_enabled="), getCmd("t.get_type="), getCmd("t.get_group="), getCmd("t.get_url=")))));
    $req->setParseByTypes();
    if ($req->run() && !$req->fault) {