mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-30 01:38:54 +00:00
Updates to scripts
This commit is contained in:
+1
-1
@@ -5,7 +5,7 @@ require(WWW_DIR.'/lib/postprocess.php');
|
||||
require_once (WWW_DIR.'/lib/site.php');
|
||||
require_once("../test/ColorCLI.php");
|
||||
|
||||
$version="0.3r634";
|
||||
$version="0.3r638";
|
||||
|
||||
$db = new DB();
|
||||
$s = new Sites();
|
||||
|
||||
@@ -49,11 +49,11 @@ function preName($argv)
|
||||
$success = false;
|
||||
if (preg_match('/([0-9a-fA-F]{32})/', $row['searchname'], $match) || preg_match('/([0-9a-fA-F]{32})/', $row['name'], $match))
|
||||
{
|
||||
$pre = $db->queryOneRow(sprintf("SELECT title, source FROM prehash WHERE md5 = %s", $db->escapeString($match[1])));
|
||||
$pre = $db->queryOneRow(sprintf("SELECT ID, title, source FROM prehash WHERE md5 = %s", $db->escapeString($match[1])));
|
||||
if ($pre !== false)
|
||||
{
|
||||
$determinedcat = $category->determineCategory($row["groupID"], $pre['title']);
|
||||
$result = $db->query(sprintf("UPDATE releases SET dehashstatus = 1, bitwise = ((bitwise & ~37)|37), searchname = %s, categoryID = %d WHERE ID = %d", $db->escapeString($pre['title']), $determinedcat, $row['ID']));
|
||||
$result = $db->query(sprintf("UPDATE releases SET preID = %d, dehashstatus = 1, bitwise = ((bitwise & ~37)|37), searchname = %s, categoryID = %d WHERE ID = %d", $pre['ID'], $db->escapeString($pre['title']), $determinedcat, $row['ID']));
|
||||
$total = count($result);
|
||||
if ($total > 0)
|
||||
{
|
||||
|
||||
+22
-15
@@ -43,10 +43,10 @@ class Namefixer
|
||||
$this->relid = $this->fixed = $this->checked = 0;
|
||||
$this->db = new DB();
|
||||
$db = $this->db;
|
||||
$this->timeother = " AND rel.adddate > (now() - interval 6 hour) AND rel.categoryID in (2020, 5050, 6070, 8010) GROUP BY rel.ID ORDER BY postdate DESC";
|
||||
$this->timeall = " AND rel.adddate > (now() - interval 6 hour) GROUP BY rel.ID ORDER BY postdate DESC";
|
||||
$this->fullother = " AND rel.categoryID IN (2020, 5050, 6070, 8010) GROUP BY rel.ID order by postdate DESC";
|
||||
$this->fullall = " ORDER BY postdate DESC";
|
||||
$this->timeother = " AND rel.adddate > (now() - interval 6 hour) AND rel.categoryID in (2020, 5050, 6070, 8010) GROUP BY rel.ID ORDER BY postdate";
|
||||
$this->timeall = " AND rel.adddate > (now() - interval 6 hour) GROUP BY rel.ID ORDER BY postdate";
|
||||
$this->fullother = " AND rel.categoryID IN (2020, 5050, 6070, 8010) GROUP BY rel.ID";
|
||||
$this->fullall = "";
|
||||
$this->done = $this->matched = false;
|
||||
$this->c = new ColorCLI();
|
||||
$this->consoletools = new ConsoleTools();
|
||||
@@ -142,12 +142,14 @@ class Namefixer
|
||||
$db = new DB();
|
||||
$functions = new Functions();
|
||||
$type = "Filenames, ";
|
||||
$preid = false;
|
||||
if ($cats === 3) {
|
||||
$query = "SELECT relfiles.name AS textstring, rel.categoryID, rel.searchname, rel.groupID, relfiles.releaseID AS fileID, "
|
||||
. "rel.ID AS releaseID FROM releases rel "
|
||||
. "INNER JOIN releasefiles relfiles ON (relfiles.releaseID = rel.ID) "
|
||||
. "WHERE (bitwise & 256) = 256 AND preID IS NULL";
|
||||
$cats = 2;
|
||||
$preid = true;
|
||||
} else {
|
||||
$query = "SELECT relfiles.name AS textstring, rel.categoryID, rel.searchname, rel.groupID, relfiles.releaseID AS fileID, "
|
||||
. "rel.ID AS releaseID FROM releases rel "
|
||||
@@ -174,7 +176,7 @@ class Namefixer
|
||||
sleep(2);
|
||||
foreach ($relres as $relrow) {
|
||||
$this->done = $this->matched = false;
|
||||
$this->checkName($relrow, $echo, $type, $namestatus, $show);
|
||||
$this->checkName($relrow, $echo, $type, $namestatus, $show, $preid);
|
||||
$this->checked++;
|
||||
if ($this->checked % 500 == 0 && $show === 1) {
|
||||
echo $this->c->alternate($this->checked . " files processed.");
|
||||
@@ -385,23 +387,28 @@ class Namefixer
|
||||
//
|
||||
// Check the array using regex for a clean name.
|
||||
//
|
||||
public function checkName($release, $echo, $type, $namestatus, $show)
|
||||
public function checkName($release, $echo, $type, $namestatus, $show, $preid = false)
|
||||
{
|
||||
// Get pre style name from releases.name
|
||||
$matches = '';
|
||||
preg_match_all('/([\w\(\)]+[\._]([\w\(\)]+[\._-])+[\w\(\)]+-\w+)/', $release['textstring'], $matches);
|
||||
foreach ($matches as $match) {
|
||||
foreach ($match as $val) {
|
||||
$title = $this->db->queryOneRow("SELECT title, ID from prehash WHERE title = " . $this->db->escapeString(trim($val)));
|
||||
if (isset($title['title'])) {
|
||||
$this->cleanerName = $title['title'];
|
||||
if (!empty($this->cleanerName)) {
|
||||
$this->updateRelease($release, $title['title'], $method = "prehash: Match", $echo, $type, $namestatus, $show);
|
||||
continue;
|
||||
if (preg_match_all('/([\w\(\)]+[\s\._-]([\w\(\)]+[\s\._-])+[\w\(\)]+-\w+)/', $release['textstring'], $matches)) {
|
||||
foreach ($matches as $match) {
|
||||
foreach ($match as $val) {
|
||||
$title = $this->db->queryOneRow("SELECT title, ID from prehash WHERE title = " . $this->db->escapeString(trim($val)));
|
||||
if (isset($title['title'])) {
|
||||
$this->cleanerName = $title['title'];
|
||||
if (!empty($this->cleanerName)) {
|
||||
$this->updateRelease($release, $title['title'], $method = "prehash: Match", $echo, $type, $namestatus, $show, $title['ID']);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if processing preid on filename, do not continue
|
||||
if ($preid === true) {
|
||||
return false;
|
||||
}
|
||||
if ($type == "PAR2, ") {
|
||||
$this->fileCheck($release, $echo, $type, $namestatus, $show);
|
||||
} else {
|
||||
|
||||
@@ -49,11 +49,11 @@ function preName($argv)
|
||||
$success = false;
|
||||
if (preg_match('/([0-9a-fA-F]{32})/', $row['searchname'], $match) || preg_match('/([0-9a-fA-F]{32})/', $row['name'], $match))
|
||||
{
|
||||
$pre = $db->queryOneRow(sprintf("SELECT dirname FROM predb WHERE md5 = %s", $db->escapeString($match[1])));
|
||||
$pre = $db->queryOneRow(sprintf("SELECT ID, dirname FROM predb WHERE md5 = %s", $db->escapeString($match[1])));
|
||||
if ($pre !== false)
|
||||
{
|
||||
$determinedcat = $category->determineCategory($row["groupID"], $pre['dirname']);
|
||||
$result = $db->query(sprintf("UPDATE releases SET dehashstatus = 1, bitwise = ((bitwise & ~37)|37), searchname = %s, categoryID = %d WHERE ID = %d", $db->escapeString($pre['dirname']), $determinedcat, $row['ID']));
|
||||
$result = $db->query(sprintf("UPDATE releases SET preID = %d, dehashstatus = 1, bitwise = ((bitwise & ~37)|37), searchname = %s, categoryID = %d WHERE ID = %d", $pre['ID'], $db->escapeString($pre['dirname']), $determinedcat, $row['ID']));
|
||||
$total = count($result);
|
||||
if ( $total > 0)
|
||||
{
|
||||
|
||||
+4
-1
@@ -88,7 +88,10 @@ Class Predb
|
||||
if ($this->echooutput) {
|
||||
echo $this->c->primary($newUsenetCrawler . " \tRetrieved from Usenet-Crawler.");
|
||||
}
|
||||
exit;
|
||||
$this->retrieveAllfilledMoovee();
|
||||
$this->retrieveAllfilledTeevee();
|
||||
$this->retrieveAllfilledErotica();
|
||||
$this->retrieveAllfilledForeign();
|
||||
$newnames = $newwomble + $newomgwtf + $newzenet + $newprelist + $neworly + $newsrr + $newpdme + $abgx + $newUsenetCrawler;
|
||||
if (count($newnames) > 0) {
|
||||
$db->exec(sprintf('UPDATE prehash SET adddate = NOW() WHERE ID = %d', $newestrel['ID']));
|
||||
|
||||
+12
-10
@@ -72,17 +72,19 @@ if (isset($argv[1]) && $argv[1] === "all") {
|
||||
{
|
||||
// Do a local lookup
|
||||
$newTitle = localLookup($requestID, $row["groupname"], $row["name"]);
|
||||
if ($newTitle != false && $newTitle != '')
|
||||
$bFound = true;
|
||||
|
||||
if (is_array($newTitle) && $newTitle['title'] != ''){
|
||||
$bFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($bFound === true)
|
||||
{
|
||||
$title = $newTitle['title'];
|
||||
$preid = $newTitle['ID'];
|
||||
$groupname = $functions->getByNameByID($row["groupname"]);
|
||||
$determinedcat = $category->determineCategory($groupname, $newTitle);
|
||||
$run = $db->query(sprintf("UPDATE releases SET reqidstatus = 1, bitwise = ((bitwise & ~4)|4), searchname = %s, categoryID = %d where ID = %d", $db->escapeString($newTitle), $determinedcat, $row["ID"]));
|
||||
$determinedcat = $category->determineCategory($groupname, $title );
|
||||
$run = $db->queryDirect(sprintf('UPDATE releases SET preID = %d, reqidstatus = 1, bitwise = ((bitwise & ~5)|5), searchname = %s, categoryID = %d WHERE ID = %d', $preid, $db->escapeString($title), $determinedcat, $row['ID']));
|
||||
if ($row['name'] !== $newTitle)
|
||||
{
|
||||
$counter++;
|
||||
@@ -91,7 +93,7 @@ if (isset($argv[1]) && $argv[1] === "all") {
|
||||
$newcatname = $functions->getNameByID($determinedcat);
|
||||
$oldcatname = $functions->getNameByID($row['categoryID']);
|
||||
|
||||
echo $c->headerOver($n.$n.'New name: ').$c->primary($newTitle).
|
||||
echo $c->headerOver($n.$n.'New name: ').$c->primary($title).
|
||||
$c->headerOver('Old name: ').$c->primary($row["name"]).
|
||||
$c->headerOver('New cat: ').$c->primary($newcatname).
|
||||
$c->headerOver('Old cat: ').$c->primary($oldcatname).
|
||||
@@ -130,12 +132,12 @@ if (isset($argv[1]) && $argv[1] === "all") {
|
||||
$groups = new Groups();
|
||||
$functions = new Functions();
|
||||
$groupID = $functions->getIDByName($groupName);
|
||||
$run = $db->queryOneRow(sprintf("SELECT title FROM prehash WHERE requestID = %d AND groupID = %d", $requestID, $groupID));
|
||||
$run = $db->queryOneRow(sprintf("SELECT ID, title FROM prehash WHERE requestID = %d AND groupID = %d", $requestID, $groupID));
|
||||
if (isset($run["title"]) && preg_match('/s\d+/i', $run["title"]) && !preg_match('/s\d+e\d+/i', $run["title"])) {
|
||||
return false;
|
||||
}
|
||||
if (isset($run["title"]))
|
||||
return $run["title"];
|
||||
return array('title' => $run['title'], 'ID' => $run['ID']);
|
||||
if (preg_match('/\[#?a\.b\.teevee\]/', $oldname))
|
||||
$groupID = $functions->getIDByName('alt.binaries.teevee');
|
||||
else if (preg_match('/\[#?a\.b\.moovee\]/', $oldname))
|
||||
@@ -170,9 +172,9 @@ if (isset($argv[1]) && $argv[1] === "all") {
|
||||
|
||||
|
||||
|
||||
$run = $db->queryOneRow(sprintf("SELECT title FROM prehash WHERE requestID = %d AND groupID = %d", $requestID, $groupID));
|
||||
$run = $db->queryOneRow(sprintf("SELECT ID, title FROM prehash WHERE requestID = %d AND groupID = %d", $requestID, $groupID));
|
||||
if (isset($run['title']))
|
||||
return $run['title'];
|
||||
return array('title' => $run['title'], 'ID' => $run['ID']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user