} switch ($argv[1]) { case 1: $predb->parseTitles(1, $update, $other, $setStatus, $show); break; case 2: $predb->parseTitles(2, $update, $other, $setStatus, $show); break; case 3: $namefixer->fixNamesWithNfo(1, $update, $other, $setStatus, $show); break; case 4: $namefixer->fixNamesWithNfo(2, $update, $other, $setStatus, $show); break; case 5: $namefixer->fixNamesWithFiles(1, $update, $other, $setStatus, $show); break; case 6: $namefixer->fixNamesWithFiles(2, $update, $other, $setStatus, $show); break; case 7: $namefixer->fixNamesWithPar2(1, $update, $other, $setStatus, $show, $nntp); break; case 8: $namefixer->fixNamesWithPar2(2, $update, $other, $setStatus, $show, $nntp); break; default: exit($pdo->log->error("\nERROR: Wrong argument, type php {$argv['0']} to see a list of valid arguments." . $n)); break; } } else {
$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"); if (count($res) > 0) { echo $pdo->log->header("Going to reset search names, this can take a while."); $done = 0; $timestart = time(); $consoletools = new ConsoleTools(['ColorCLI' => $pdo->log]); foreach ($res as $row) {