Ejemplo n.º 1
0
        rtDbg("SetDir", $str);
    }
}
Debug("");
Debug("--- begin ---");
$is_ok = true;
if (count($argv) < 6) {
    Debug("called without arguments (at least 5 params wanted)");
    $is_ok = false;
} else {
    $hash = trim($argv[1]);
    $datadir = trim($argv[2]);
    $move_addpath = trim($argv[3]);
    $move_datafiles = trim($argv[4]);
    $move_fastresume = trim($argv[5]);
}
if ($is_ok && $hash && strlen($datadir) > 0) {
    Debug("hash        : " . $hash);
    Debug("data dir    : " . $datadir);
    Debug("add path    : " . $move_addpath);
    Debug("move files  : " . $move_datafiles);
    Debug("fast resume : " . $move_fastresume);
    if (!rtMkDir($datadir, 0777)) {
        Debug("can't create " . $datadir);
    } elseif (!rtSetDataDir($hash, $datadir, $move_addpath == '1', $move_datafiles == '1', $move_fastresume == '1', $datadir_debug_enabled)) {
        Debug("rtSetDataDir() fail!");
    }
}
Debug("--- end ---");
rtSemUnlock($DataDir_Sem);
Ejemplo n.º 2
0
            break;
            // we need the first tracker only
        }
    } else {
        Debug("rXMLRPCRequest() fail (t.multicall)");
        $is_ok = false;
    }
}
// Get info about tracker
if ($is_ok && preg_match("/{NOW:?([^}]*)}/", $label, $match) > 0 && count($match) > 0) {
    // $matches[0] will contain the text that matched the full pattern,
    // $matches[1] will have the text that matched the first captured parenthesized subpattern, and so on
    Debug("count           : \"" . count($match) . "\"");
    Debug("match[1]        : \"" . $match[1] . "\"");
    if (count($match) > 1 && strlen($match[1]) > 0) {
        $lbl_now = strftime($match[1]);
    } else {
        $lbl_now = strftime('%Y-%m-%d');
    }
    $label = str_replace($match[0], $lbl_now, $label);
}
// Set a label
if ($is_ok) {
    Debug("label           : \"" . $label . "\"");
    if ($label != "" && rtExec("d.set_custom1", array($hash, rawurlencode($label)), $autodebug_enabled)) {
        rTorrentSettings::get()->pushEvent("LabelChanged", array("hash" => $hash, "label" => $label));
    }
}
Debug("--- end ---");
rtSemUnlock($AutoLabel_Sem);