Пример #1
0
 /**
  * Attempts to get the releasename from a par2 file
  *
  * @param string $guid
  * @param int    $relID
  * @param int    $groupID
  * @param int    $nameStatus
  * @param int    $show
  *
  * @return bool
  *
  * @access public
  */
 public function checkPAR2($guid, $relID, $groupID, $nameStatus, $show)
 {
     $nzbFile = $this->LoadNZB($guid);
     if ($nzbFile !== false) {
         foreach ($nzbFile->file as $nzbContents) {
             if (preg_match('/\\.(par[2" ]|\\d{2,3}").+\\(1\\/1\\)$/i', (string) $nzbContents->attributes()->subject)) {
                 if ($this->pp->parsePAR2((string) $nzbContents->segments->segment, $relID, $groupID, $this->nntp, $show) === true && $nameStatus === 1) {
                     $this->pdo->queryExec(sprintf('UPDATE releases SET proc_par2 = 1 WHERE id = %d', $relID));
                     return true;
                 }
             }
         }
     }
     if ($nameStatus === 1) {
         $this->pdo->queryExec(sprintf('UPDATE releases SET proc_par2 = 1 WHERE id = %d', $relID));
     }
     return false;
 }
Пример #2
0
Array with possible arguments for run and
whether or not those methods of operation require NNTP
 **/
$args = array('additional' => true, 'all' => true, 'allinf' => true, 'amazon' => false, 'anime' => false, 'book' => false, 'console' => false, 'games' => false, 'movies' => false, 'music' => false, 'nfo' => true, 'pre' => true, 'sharing' => true, 'spotnab' => true, 'tv' => false, 'tvdb' => false, 'xxx' => false);
$bool = array('true', 'false');
if (!isset($argv[1]) || !in_array($argv[1], $args) || !isset($argv[2]) || !in_array($argv[2], $bool)) {
    exit($pdo->log->error("\nIncorrect arguments.\n" . "The second argument (true/false) determines wether to echo or not.\n\n" . "php postprocess.php all true         ...: Does all the types of post processing.\n" . "php postprocess.php pre true         ...: Processes all Predb sites.\n" . "php postprocess.php nfo true         ...: Processes NFO files.\n" . "php postprocess.php movies true      ...: Processes movies.\n" . "php postprocess.php music true       ...: Processes music.\n" . "php postprocess.php console true     ...: Processes console games.\n" . "php postprocess.php games true       ...: Processes games.\n" . "php postprocess.php book true        ...: Processes books.\n" . "php postprocess.php anime true       ...: Processes anime.\n" . "php postprocess.php tv true          ...: Processes tv.\n" . "php postprocess.php tvdb true        ...: Processes tvdb.\n" . "php postprocess.php xxx true         ...: Processes xxx.\n" . "php postprocess.php additional true  ...: Processes previews/mediainfo/etc...\n" . "php postprocess.php sharing true     ...: Processes uploading/downloading comments.\n" . "php postprocess.php spotnab true     ...: Processes uploading/downloading comments from spotnab.\n" . "php postprocess.php allinf true      ...: Does all the types of post processing on a loop, sleeping 15 seconds between.\n" . "php postprocess.php amazon true      ...: Does all the amazon (books/console/games/music/xxx).\n"));
}
$nntp = null;
if ($args[$argv[1]] === true) {
    $nntp = new NNTP(['Settings' => $pdo]);
    if (($pdo->getSetting('alternate_nntp') == 1 ? $nntp->doConnect(true, true) : $nntp->doConnect()) !== true) {
        exit($pdo->log->error("Unable to connect to usenet." . PHP_EOL));
    }
}
$postProcess = new PProcess(['Settings' => $pdo, 'Echo' => $argv[2] === 'true' ? true : false]);
$charArray = ['a', 'b', 'c', 'd', 'e', 'f', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
switch ($argv[1]) {
    case 'all':
        $postProcess->processAll($nntp);
        break;
    case 'allinf':
        $i = 1;
        while ($i = 1) {
            $postProcess->processAll($nntp);
            sleep(15);
        }
        break;
    case 'additional':
        $postProcess->processAdditional($nntp, '', isset($argv[3]) && in_array($argv[3], $charArray) ? $argv[3] : '');
        break;
<?php

require_once dirname(__FILE__) . '/config.php';
use newznab\processing\PProcess;
$c = new ColorCLI();
if (!isset($argv[1])) {
    exit($c->error("This script is not intended to be run manually, it is called from postprocess_threaded.py."));
}
$tmux = new Tmux();
$torun = $tmux->get()->post;
$pieces = explode('           =+=            ', $argv[1]);
$postprocess = new PProcess(['Echo' => true]);
if (isset($pieces[6])) {
    // Create the connection here and pass
    $nntp = new NNTP();
    if ($nntp->doConnect() === false) {
        exit($c->error("Unable to connect to usenet."));
    }
    $postprocess->processAdditional($nntp, $argv[1]);
    $nntp->doQuit();
} else {
    if (isset($pieces[3])) {
        // Create the connection here and pass
        $nntp = new NNTP();
        if ($nntp->doConnect() === false) {
            exit($c->error("Unable to connect to usenet."));
        }
        $postprocess->processNfos($argv[1], $nntp);
        $nntp->doQuit();
    } else {
        if (isset($pieces[2])) {
Пример #4
0
 /**
  * Process all that require a single thread.
  */
 private function processSingle()
 {
     $postProcess = new PProcess(['Settings' => $this->pdo, 'ColorCLI' => $this->_colorCLI]);
     $pp = new \PostProcess(true);
     //$postProcess->processAnime();
     $postProcess->processBooks();
     $pp->processBooks();
     $postProcess->processConsoles();
     $postProcess->processGames();
     $postProcess->processMusic();
     $pp->processMusic();
     $postProcess->processXXX();
 }