Ejemplo n.º 1
0
 $releases = new ProcessReleases(['Settings' => $pdo, 'ConsoleTools' => $consoletools]);
 if ($argv[1] == 1 && $argv[2] == 'true') {
     $releases->processReleases(1, 1, $groupName, $nntp, true);
 } else {
     if ($argv[1] == 1 && $argv[2] == 'false') {
         $releases->processReleases(1, 2, $groupName, $nntp, true);
     } else {
         if ($argv[1] == 2 && $argv[2] == 'true') {
             $releases->processReleases(2, 1, $groupName, $nntp, true);
         } else {
             if ($argv[1] == 2 && $argv[2] == 'false') {
                 $releases->processReleases(2, 2, $groupName, $nntp, true);
             } else {
                 if ($argv[1] == 4 && ($argv[2] == 'true' || $argv[2] == 'false')) {
                     echo $pdo->log->header("Moving all releases to other -> misc, this can take a while, be patient.");
                     $releases->resetCategorize();
                 } else {
                     if ($argv[1] == 5 && ($argv[2] == 'true' || $argv[2] == 'false')) {
                         echo $pdo->log->header("Categorizing all non-categorized releases in other->misc using usenet subject. This can take a while, be patient.");
                         $timestart = TIME();
                         $relcount = $releases->categorizeRelease('name', 'WHERE iscategorized = 0 AND categoryID = 7010');
                         $time = $consoletools->convertTime(TIME() - $timestart);
                         echo $pdo->log->primary("\n" . 'Finished categorizing ' . $relcount . ' releases in ' . $time . " seconds, using the usenet subject.");
                     } else {
                         if ($argv[1] == 6 && $argv[2] == 'true') {
                             echo $pdo->log->header("Categorizing releases in all sections using the searchname. This can take a while, be patient.");
                             $timestart = TIME();
                             $relcount = $releases->categorizeRelease('searchname', '');
                             $consoletools = new ConsoleTools(['ColorCLI' => $pdo->log]);
                             $time = $consoletools->convertTime(TIME() - $timestart);
                             echo $pdo->log->primary("\n" . 'Finished categorizing ' . $relcount . ' releases in ' . $time . " seconds, using the search name.");
Ejemplo n.º 2
0
         $rc = new ReleaseCleaning($pdo);
         foreach ($res as $row) {
             $newname = $rc->releaseCleaner($row['name'], $row['fromname'], $row['size'], $row['gname']);
             if (is_array($newname)) {
                 $newname = $newname['cleansubject'];
             }
             $newname = $pdo->escapeString($newname);
             $pdo->queryExec(sprintf("UPDATE releases SET searchname = %s WHERE id = %d", $newname, $row['id']));
             $sphinx->updateRelease($row['id']);
             $done++;
             $consoletools->overWritePrimary("Renaming:" . $consoletools->percentString($done, count($res)));
         }
         $timenc = $consoletools->convertTime(time() - $timestart);
         echo $pdo->log->header($done . " releases renamed in " . $timenc . ".\nNow the releases will be recategorized.");
         $releases = new ProcessReleases(['Settings' => $pdo, 'ConsoleTools' => $consoletools, 'ReleaseCleaning' => $rc]);
         $releases->resetCategorize("WHERE isrenamed = 0");
         $categorized = $releases->categorizeRelease("name", "WHERE isrenamed = 0");
         $timecat = $consoletools->convertTime(time() - $timestart);
         echo $pdo->log->header("Finished categorizing " . $categorized . " releases in " . $timecat . ".\nFinally, the releases will be fixed using the NFO/filenames.");
         $namefixer = new NameFixer(['Settings' => $pdo, 'ConsoleTools' => $consoletools]);
         $namefixer->fixNamesWithNfo(2, 1, 1, 1, $show);
         $namefixer->fixNamesWithFiles(2, 1, 1, 1, $show);
         $timetotal = $consoletools->convertTime(time() - $timestart);
         echo $pdo->log->header("Finished recreating search names / recategorizing / refixing names in " . $timetotal);
     } else {
         exit($pdo->log->info("You have no releases in the DB."));
     }
 } else {
     if (isset($argv[1]) && $argv[1] == "reset") {
         $pdo = new Settings();
         $res = $pdo->query("SELECT releases.id, releases.name, releases.fromname, releases.size, groups.name AS gname FROM releases INNER JOIN groups ON releases.group_id = groups.id");