From ceedfc8e291c099ac94f9b65334b4d98e58f1fcb Mon Sep 17 00:00:00 2001 From: Darko Date: Wed, 4 Dec 2013 12:28:06 +0100 Subject: [PATCH 1/8] Updates to namefixer --- bin/monitor.php | 2 +- test/namefixer.php | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/bin/monitor.php b/bin/monitor.php index 7e21b5457..c019a3038 100644 --- a/bin/monitor.php +++ b/bin/monitor.php @@ -4,7 +4,7 @@ require(dirname(__FILE__)."/config.php"); require(WWW_DIR.'/lib/postprocess.php'); require_once (WWW_DIR.'/lib/site.php'); -$version="0.3r067"; +$version="0.3r068"; $db = new DB(); $s = new Sites(); diff --git a/test/namefixer.php b/test/namefixer.php index 02601b3b0..44b68c301 100644 --- a/test/namefixer.php +++ b/test/namefixer.php @@ -445,6 +445,22 @@ class Namefixer $newresult = str_replace("-ALiAS"," PC GAME ALiAS",$result['0']); $this->updateRelease($release, $newresult, $method="gameCheck: PC Games -ALiAS", $echo, $type, $namestatus); } + elseif ($this->done === false && $this->relid !== $release["releaseID"] && preg_match('/\w[\w.\',;-].+\-RELOADED/i', $release["textstring"], $result)) + { + $newresult = str_replace("-RELOADED"," PC GAME RELOADED",$result['0']); + $this->updateRelease($release, $newresult, $method="gameCheck: PC Games -RELOADED", $echo, $type, $namestatus); + } + elseif ($this->done === false && $this->relid !== $release["releaseID"] && preg_match('/\w[\w.\',;-].+\-SKIDROW/i', $release["textstring"], $result)) + { + $newresult = str_replace("-SKIDROW"," PC GAME SKIDROW",$result['0']); + $this->updateRelease($release, $newresult, $method="gameCheck: PC Games -SKIDROW", $echo, $type, $namestatus); + } + elseif ($this->done === false && $this->relid !== $release["releaseID"] && preg_match('/\w[\w.\',;-].+\-FLT/i', $release["textstring"], $result)) + { + $newresult = str_replace("-FLT"," PC GAME FLT",$result['0']); + $this->updateRelease($release, $newresult, $method="gameCheck: PC Games -FAIRLIGHT", $echo, $type, $namestatus); + } + } // From 03135f08aa0209cad60997289f378176ee36738e Mon Sep 17 00:00:00 2001 From: Darko Date: Wed, 4 Dec 2013 13:11:40 +0100 Subject: [PATCH 2/8] Updates to removeCrapReleases and monitor --- bin/monitor.php | 4 ++-- test/removeCrapReleases.php | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/monitor.php b/bin/monitor.php index c019a3038..2429f28d1 100644 --- a/bin/monitor.php +++ b/bin/monitor.php @@ -4,7 +4,7 @@ require(dirname(__FILE__)."/config.php"); require(WWW_DIR.'/lib/postprocess.php'); require_once (WWW_DIR.'/lib/site.php'); -$version="0.3r068"; +$version="0.3r070"; $db = new DB(); $s = new Sites(); @@ -1379,7 +1379,7 @@ if ($array ['FIXRELEASES'] = "true") { if (( $array['MAX_LOAD'] >= get_load()) && (( TIME() - $time27 ) >= $array['FIXRELEASES_TIMER'] ) && ( $array['FIXRELEASES'] == "true" )) { $color = get_color(); $log = writelog($panes4[0]); - shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.0 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes4[0] $ds2 && cd $_test && $_php postprocess_pre.php 2>&1 $log && $_php fixReleaseNames.php 3 true other yes 2>&1 $log && $_php fixReleaseNames.php 5 true other yes 2>&1 $log && $_php fixReleaseNames.php 7 true other yes 2>&1 $log && $_php hash_decrypt.php true 2>&1 $log && $_php jb_fix_names.php 6 2>&1 $log && $_php removeCrapReleases.php true full 2>&1 $log echo \" \033[1;0;33m\" && $ds1 $panes4[0] $ds3' 2>&1 1> /dev/null"); + shell_exec("$_tmux respawnp -t {$array['TMUX_SESSION']}:4.0 'echo \"\033[38;5;\"$color\"m\" && $ds1 $panes4[0] $ds2 && cd $_test && $_php postprocess_pre.php 2>&1 $log && $_php fixReleaseNames.php 3 true other yes 2>&1 $log && $_php fixReleaseNames.php 5 true other yes 2>&1 $log && $_php fixReleaseNames.php 7 true other yes 2>&1 $log && $_php hash_decrypt.php true 2>&1 $log && $_php jb_fix_names.php 6 2>&1 $log && $_php removeCrapReleases.php true 2 2>&1 $log echo \" \033[1;0;33m\" && $ds1 $panes4[0] $ds3' 2>&1 1> /dev/null"); $time27 = TIME();} elseif ( $array['FIXRELEASES'] != "true" ) { $color = get_color(); diff --git a/test/removeCrapReleases.php b/test/removeCrapReleases.php index 670d399bd..58516f39d 100755 --- a/test/removeCrapReleases.php +++ b/test/removeCrapReleases.php @@ -82,7 +82,7 @@ if (isset($argv[1]) && $argv[1] == "true") { $type = "Gibberish"; $db = new DB(); - $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE searchname REGEXP '^[a-zA-Z0-9]{15,}$' AND nfostatus = 0 AND relnamestatus > 1 AND rarinnerfilecount = 0".$and); + $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE searchname REGEXP '^[a-zA-Z0-9]{15,}$' AND nfostatus = 0 AND relnamestatus > 1 AND rarinnerfilecount >= 0".$and); $delcount = deleteReleases($sql, $type); return $delcount; } @@ -92,7 +92,7 @@ if (isset($argv[1]) && $argv[1] == "true") { $type = "Hashed"; $db = new DB(); - $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE searchname REGEXP '[a-zA-Z0-9]{25,}' AND nfostatus = 0 AND relnamestatus > 1 AND rarinnerfilecount = 0".$and); + $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE searchname REGEXP '[a-zA-Z0-9]{25,}' AND nfostatus = 0 AND relnamestatus > 1 AND rarinnerfilecount >= 0".$and); $delcount = deleteReleases($sql, $type); return $delcount; } @@ -102,7 +102,7 @@ if (isset($argv[1]) && $argv[1] == "true") { $type = "Short"; $db = new DB(); - $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE searchname REGEXP '^[a-zA-Z0-9]{0,5}$' AND nfostatus = 0 AND relnamestatus > 1 AND rarinnerfilecount = 0".$and); + $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE searchname REGEXP '^[a-zA-Z0-9]{0,5}$' AND nfostatus = 0 AND relnamestatus > 1 AND rarinnerfilecount >= 0".$and); $delcount = deleteReleases($sql, $type); return $delcount; } @@ -112,11 +112,11 @@ if (isset($argv[1]) && $argv[1] == "true") { $type = "Executable"; $db = new DB(); - $sql = $db->query('SELECT r.ID, r.guid, r.searchname FROM releases r INNER JOIN releasefiles rf ON rf.releaseID = r.ID WHERE rf.name LIKE "%.exe%" AND r.categoryID NOT IN (4000, 4010, 4020, 4050, 8010)'.$and); + $sql = $db->query('SELECT r.ID, r.guid, r.searchname FROM releases r INNER JOIN releasefiles rf ON rf.releaseID = r.ID WHERE rf.name LIKE "%.exe%" AND r.categoryID NOT IN (4000, 4010, 4020, 4050)'.$and); $delcount = deleteReleases($sql, $type); return $delcount; } - + // Anything with an install.bin file. function deleteInstallBin($and) { @@ -142,7 +142,7 @@ if (isset($argv[1]) && $argv[1] == "true") { $type = "Passworded"; $db = new DB(); - $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE ( searchname LIKE '%passworded%' OR searchname LIKE '%password protect%' OR searchname LIKE '%password%' OR searchname LIKE '%passwort%' ) and searchname NOT LIKE '%no password%' and searchname NOT LIKE '%not passworded%' and searchname NOT LIKE '%unlocker%' and searchname NOT LIKE '%reset%' and searchname NOT LIKE '%recovery%' and searchname NOT LIKE '%keygen%' and searchname NOT LIKE '%advanced%' and nzbstatus in (1, 2) and categoryID not in (4000, 4010, 4020, 4030, 4040, 4050, 4060, 4070)".$and); + $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE ( searchname LIKE '%passworded%' OR searchname LIKE '%password protect%' OR searchname LIKE '%password%' OR searchname LIKE '%passwort%' ) AND searchname NOT LIKE '%no password%' AND searchname NOT LIKE '%not passworded%' AND searchname NOT LIKE '%unlocker%' AND searchname NOT LIKE '%reset%' AND searchname NOT LIKE '%recovery%' AND searchname NOT LIKE '%keygen%' AND searchname NOT LIKE '%advanced%' AND nzbstatus in (1, 2) AND categoryID not in (4000, 4010, 4020, 4030, 4040, 4050, 4060, 4070)".$and); $delcount = deleteReleases($sql, $type); return $delcount; } @@ -152,7 +152,7 @@ if (isset($argv[1]) && $argv[1] == "true") { $type = "Size"; $db = new DB(); - $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE totalPart = 1 and size < 1000000 and categoryID not in (7000, 7010, 7020, 7030, 3010)".$and); + $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE totalPart = 1 AND size < 1000000 AND categoryID not in (7000, 7010, 7020, 7030, 3010)".$and); $delcount = deleteReleases($sql, $type); return $delcount; } @@ -162,7 +162,7 @@ if (isset($argv[1]) && $argv[1] == "true") { $type = "Sample"; $db = new DB(); - $sql = $db->query('SELECT ID, guid, searchname FROM releases WHERE totalPart > 1 and name LIKE "%sample%" and size < 40000000 and categoryID in (5020, 5030, 5040, 5050, 5060, 5070, 5080, 2020, 2030, 2040, 2050, 2060)'.$and); + $sql = $db->query('SELECT ID, guid, searchname FROM releases WHERE totalPart > 1 AND name LIKE "%sample%" AND size < 40000000 AND categoryID IN (5020, 5030, 5040, 5050, 5060, 5070, 5080, 2020, 2030, 2040, 2050, 2060)'.$and); $delcount = deleteReleases($sql, $type); return $delcount; } From 58e14657d5bfe876e1e0b0526f33ae2c773ed6c9 Mon Sep 17 00:00:00 2001 From: Darko Date: Wed, 4 Dec 2013 13:34:52 +0100 Subject: [PATCH 3/8] Updated passworded releases detection in removeCrapReleases.php --- bin/monitor.php | 2 +- test/removeCrapReleases.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/monitor.php b/bin/monitor.php index 2429f28d1..dd7a1527b 100644 --- a/bin/monitor.php +++ b/bin/monitor.php @@ -4,7 +4,7 @@ require(dirname(__FILE__)."/config.php"); require(WWW_DIR.'/lib/postprocess.php'); require_once (WWW_DIR.'/lib/site.php'); -$version="0.3r070"; +$version="0.3r071"; $db = new DB(); $s = new Sites(); diff --git a/test/removeCrapReleases.php b/test/removeCrapReleases.php index 58516f39d..8ea88df94 100755 --- a/test/removeCrapReleases.php +++ b/test/removeCrapReleases.php @@ -142,7 +142,7 @@ if (isset($argv[1]) && $argv[1] == "true") { $type = "Passworded"; $db = new DB(); - $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE ( searchname LIKE '%passworded%' OR searchname LIKE '%password protect%' OR searchname LIKE '%password%' OR searchname LIKE '%passwort%' ) AND searchname NOT LIKE '%no password%' AND searchname NOT LIKE '%not passworded%' AND searchname NOT LIKE '%unlocker%' AND searchname NOT LIKE '%reset%' AND searchname NOT LIKE '%recovery%' AND searchname NOT LIKE '%keygen%' AND searchname NOT LIKE '%advanced%' AND nzbstatus in (1, 2) AND categoryID not in (4000, 4010, 4020, 4030, 4040, 4050, 4060, 4070)".$and); + $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE ( searchname LIKE '%passworded%' OR searchname LIKE '%password protect%' OR searchname LIKE '%password%' OR searchname LIKE '%passwort%' OR searchname LIKE '%pw%' ) AND searchname NOT LIKE '%no password%' AND searchname NOT LIKE '%not passworded%' AND searchname NOT LIKE '%unlocker%' AND searchname NOT LIKE '%reset%' AND searchname NOT LIKE '%recovery%' AND searchname NOT LIKE '%keygen%' AND searchname NOT LIKE '%advanced%' AND nzbstatus in (1, 2) AND categoryID not in (4000, 4010, 4020, 4030, 4040, 4050, 4060, 4070)".$and); $delcount = deleteReleases($sql, $type); return $delcount; } From baf7b61863f1404f8b7c5374a34cbbbac92a757f Mon Sep 17 00:00:00 2001 From: Darko Date: Wed, 4 Dec 2013 13:49:33 +0100 Subject: [PATCH 4/8] Fixed some typos, could lead to removal of wrong releases --- bin/monitor.php | 2 +- test/removeCrapReleases.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/monitor.php b/bin/monitor.php index dd7a1527b..da7e34aec 100644 --- a/bin/monitor.php +++ b/bin/monitor.php @@ -4,7 +4,7 @@ require(dirname(__FILE__)."/config.php"); require(WWW_DIR.'/lib/postprocess.php'); require_once (WWW_DIR.'/lib/site.php'); -$version="0.3r071"; +$version="0.3r072"; $db = new DB(); $s = new Sites(); diff --git a/test/removeCrapReleases.php b/test/removeCrapReleases.php index 8ea88df94..a21c2f87a 100755 --- a/test/removeCrapReleases.php +++ b/test/removeCrapReleases.php @@ -142,7 +142,7 @@ if (isset($argv[1]) && $argv[1] == "true") { $type = "Passworded"; $db = new DB(); - $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE ( searchname LIKE '%passworded%' OR searchname LIKE '%password protect%' OR searchname LIKE '%password%' OR searchname LIKE '%passwort%' OR searchname LIKE '%pw%' ) AND searchname NOT LIKE '%no password%' AND searchname NOT LIKE '%not passworded%' AND searchname NOT LIKE '%unlocker%' AND searchname NOT LIKE '%reset%' AND searchname NOT LIKE '%recovery%' AND searchname NOT LIKE '%keygen%' AND searchname NOT LIKE '%advanced%' AND nzbstatus in (1, 2) AND categoryID not in (4000, 4010, 4020, 4030, 4040, 4050, 4060, 4070)".$and); + $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE ( searchname LIKE '%passworded%' OR searchname LIKE '%password protect%' OR searchname LIKE '%password%' OR searchname LIKE '%passwort%' OR searchname LIKE '%[pw]%' ) AND searchname NOT LIKE '%no password%' AND searchname NOT LIKE '%not passworded%' AND searchname NOT LIKE '%unlocker%' AND searchname NOT LIKE '%reset%' AND searchname NOT LIKE '%recovery%' AND searchname NOT LIKE '%keygen%' AND searchname NOT LIKE '%advanced%' AND nzbstatus in (1, 2) AND categoryID not in (4000, 4010, 4020, 4030, 4040, 4050, 4060, 4070)".$and); $delcount = deleteReleases($sql, $type); return $delcount; } @@ -255,7 +255,7 @@ if (isset($argv[1]) && $argv[1] == "true") if($PURLDeleted > 0) echo "PURL : ".$PURLDeleted."\n"; if($PassDeleted > 0) - echo "Passwordeded : ".$PassDeleted."\n"; + echo "Passworded : ".$PassDeleted."\n"; if($sizeDeleted > 0) echo "Size : ".$sizeDeleted."\n"; if($sampleDeleted > 0) From 584631b1efebf11988fca6d3b0dfdc6619990d03 Mon Sep 17 00:00:00 2001 From: Darko Date: Wed, 4 Dec 2013 14:40:40 +0100 Subject: [PATCH 5/8] Removed relstatus column from releases and altered the scripts not to use it --- bin/monitor.php | 2 +- test/db_updates/db.sql | 3 +-- test/db_updates/db_update_04_12_2013.sql | 1 + test/db_updates/db_update_08_10_2013.sql | 2 +- test/functions.php | 7 ------- test/namefixer.php | 2 +- 6 files changed, 5 insertions(+), 12 deletions(-) create mode 100644 test/db_updates/db_update_04_12_2013.sql diff --git a/bin/monitor.php b/bin/monitor.php index da7e34aec..1a97348ff 100644 --- a/bin/monitor.php +++ b/bin/monitor.php @@ -4,7 +4,7 @@ require(dirname(__FILE__)."/config.php"); require(WWW_DIR.'/lib/postprocess.php'); require_once (WWW_DIR.'/lib/site.php'); -$version="0.3r072"; +$version="0.3r073"; $db = new DB(); $s = new Sites(); diff --git a/test/db_updates/db.sql b/test/db_updates/db.sql index 0b9be4880..167d4c41d 100644 --- a/test/db_updates/db.sql +++ b/test/db_updates/db.sql @@ -3,8 +3,7 @@ ALTER TABLE `predb` ADD INDEX ( `hash` ( 32 ) ); ALTER TABLE `releases` ADD `dehashstatus` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `haspreview`; ALTER TABLE `releases` ADD `nfostatus` TINYINT NOT NULL DEFAULT 0 after `dehashstatus`; ALTER TABLE `releases` ADD `relnamestatus` TINYINT NOT NULL DEFAULT 1 after `nfostatus`; -ALTER TABLE `releases` ADD `relstatus` TINYINT(4) NOT NULL DEFAULT 0 after `relnamestatus`; -ALTER TABLE `releases` ADD `hashed` BOOL DEFAULT FALSE after `relstatus`; +ALTER TABLE `releases` ADD `hashed` BOOL DEFAULT FALSE after `relnamestatus`; ALTER TABLE `releases` ADD `nzbstatus` TINYINT NOT NULL DEFAULT 0 after `hashed`; CREATE INDEX ix_releases_hashed on releases(hashed); CREATE INDEX ix_releases_mergedreleases on releases(dehashstatus, relnamestatus, passwordstatus); diff --git a/test/db_updates/db_update_04_12_2013.sql b/test/db_updates/db_update_04_12_2013.sql new file mode 100644 index 000000000..1d72709dc --- /dev/null +++ b/test/db_updates/db_update_04_12_2013.sql @@ -0,0 +1 @@ +ALTER TABLE releases DROP relstatus; diff --git a/test/db_updates/db_update_08_10_2013.sql b/test/db_updates/db_update_08_10_2013.sql index 6a7c7d335..cf1460cb9 100644 --- a/test/db_updates/db_update_08_10_2013.sql +++ b/test/db_updates/db_update_08_10_2013.sql @@ -1,4 +1,4 @@ -ALTER TABLE `releases` ADD `hashed` BOOL DEFAULT FALSE after `relstatus`; +ALTER TABLE `releases` ADD `hashed` BOOL DEFAULT FALSE after `relnamestatus`; CREATE INDEX ix_releases_hashed on releases(hashed); CREATE INDEX ix_releases_mergedreleases on releases(dehashstatus, relnamestatus, passwordstatus); UPDATE releases SET hashed = true WHERE searchname REGEXP '[a-fA-F0-9]{32}' OR name REGEXP '[a-fA-F0-9]{32}'; diff --git a/test/functions.php b/test/functions.php index bbfc935f1..854f0fb57 100755 --- a/test/functions.php +++ b/test/functions.php @@ -22,13 +22,6 @@ require_once("ColorCLI.php"); class Functions { - // - // the element relstatus of table releases is used to hold the status of the release - // The variable is a bitwise AND of status - // List of processed constants - used in releases table. Constants need to be powers of 2: 1, 2, 4, 8, 16 etc... - const NFO_PROCESSED_NAMEFIXER = 1; // We have processed the release against its .nfo file in the namefixer - const PREHASH_PROCESSED_NAMEFIXER = 2; // We have processed the release against a predb name - // database function public function fetchArray($result) { diff --git a/test/namefixer.php b/test/namefixer.php index 44b68c301..78ba8168c 100644 --- a/test/namefixer.php +++ b/test/namefixer.php @@ -62,7 +62,7 @@ class Namefixer $functions = new Functions (); $type = "NFO, "; // Only select releases we haven't checked here before - $query = "SELECT nfo.releaseID as nfoID, rel.groupID, rel.categoryID, rel.searchname, uncompress(nfo) as textstring, rel.ID as releaseID from releases rel inner join releasenfo nfo on (nfo.releaseID = rel.ID) where relnamestatus = 1 and relstatus & " . Functions::NFO_PROCESSED_NAMEFIXER . " = 0"; + $query = "SELECT nfo.releaseID as nfoID, rel.groupID, rel.categoryID, rel.searchname, uncompress(nfo) as textstring, rel.ID as releaseID from releases rel inner join releasenfo nfo on (nfo.releaseID = rel.ID) where relnamestatus = 1"; //24 hours, other cats if ($time == 1 && $cats == 1) From 9c8ddc49398120f45c5d3c9414ad650036ce11fc Mon Sep 17 00:00:00 2001 From: Darko Date: Wed, 4 Dec 2013 15:18:20 +0100 Subject: [PATCH 6/8] Updates to prehash --- bin/monitor.php | 2 +- test/prehash.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/monitor.php b/bin/monitor.php index 1a97348ff..e6f899984 100644 --- a/bin/monitor.php +++ b/bin/monitor.php @@ -4,7 +4,7 @@ require(dirname(__FILE__)."/config.php"); require(WWW_DIR.'/lib/postprocess.php'); require_once (WWW_DIR.'/lib/site.php'); -$version="0.3r073"; +$version="0.3r074"; $db = new DB(); $s = new Sites(); diff --git a/test/prehash.php b/test/prehash.php index 8127f88b2..87b325ac5 100755 --- a/test/prehash.php +++ b/test/prehash.php @@ -192,7 +192,7 @@ Class Predb if (preg_match('/(?P.+?)<\/td.+?(?P.+?)<\/a.+?|">(?PNUKE)+?)?<\/td.+?(?P.+?-)<a.+?<b>(?P<title2>.+?)<\/b>.+?<\/td.+?<td.+<td.+?(">(?P<size1>[\d.]+)<b>(?P<size2>.+?)<\/b>.+)?<\/tr>/s', $m, $matches2)) { $md5 = md5($matches2["title"].$matches2["title2"]); - $oldname = $db->queryOneRow(sprintf("SELECT title FROM prehash WHERE title = %s", $db->escapeString($md5))); + $oldname = $db->queryOneRow(sprintf("SELECT hash FROM prehash WHERE hash = %s", $db->escapeString($md5))); if ($oldname !== false && $oldname["md5"] == $md5) continue; else From 65a13baac0e2731aed967a673e74105f73ffca4a Mon Sep 17 00:00:00 2001 From: Darko <dkrisan@gmail.com> Date: Wed, 4 Dec 2013 15:42:10 +0100 Subject: [PATCH 7/8] Update to prehash, trying to fix retrieval of pre data from zenet --- bin/monitor.php | 2 +- test/prehash.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/monitor.php b/bin/monitor.php index e6f899984..84b83fa37 100644 --- a/bin/monitor.php +++ b/bin/monitor.php @@ -4,7 +4,7 @@ require(dirname(__FILE__)."/config.php"); require(WWW_DIR.'/lib/postprocess.php'); require_once (WWW_DIR.'/lib/site.php'); -$version="0.3r074"; +$version="0.3r075"; $db = new DB(); $s = new Sites(); diff --git a/test/prehash.php b/test/prehash.php index 87b325ac5..bf86841df 100755 --- a/test/prehash.php +++ b/test/prehash.php @@ -183,13 +183,13 @@ Class Predb $buffer = getUrl("http://pre.zenet.org/live.php"); if ($buffer !== false && strlen($buffer)) { - if (preg_match_all('/<tr bgcolor=".+?<\/tr>/s', $buffer, $matches)) + if (preg_match_all('/<div background-color=".+?<\/div>/s', $buffer, $matches)) { foreach ($matches as $match) { foreach ($match as $m) { - if (preg_match('/<tr bgcolor=".+?<td.+?">(?P<date>.+?)<\/td.+?<td.+?(<font.+?">(?P<category>.+?)<\/a.+?|">(?P<category1>NUKE)+?)?<\/td.+?<td.+?">(?P<title>.+?-)<a.+?<b>(?P<title2>.+?)<\/b>.+?<\/td.+?<td.+<td.+?(">(?P<size1>[\d.]+)<b>(?P<size2>.+?)<\/b>.+)?<\/tr>/s', $m, $matches2)) + if (preg_match('/<div background-color=".+?<div.+?">(?P<date>.+?)<\/div.+?<div.+?(<font.+?">(?P<category>.+?)<\/a.+?|">(?P<category1>NUKE)+?)?<\/div.+?<div.+?">(?P<title>.+?-)<a.+?<b>(?P<title2>.+?)<\/b>.+?<\/div.+?<div.+<div.+?(">(?P<size1>[\d.]+)<b>(?P<size2>.+?)<\/b>.+)?<\/div>/s', $m, $matches2)) { $md5 = md5($matches2["title"].$matches2["title2"]); $oldname = $db->queryOneRow(sprintf("SELECT hash FROM prehash WHERE hash = %s", $db->escapeString($md5))); From 83dca49844e9b6dda0869699884adf468c8f4806 Mon Sep 17 00:00:00 2001 From: Darko <dkrisan@gmail.com> Date: Thu, 5 Dec 2013 12:16:23 +0100 Subject: [PATCH 8/8] Updates to prehash and removeCrapReleases --- bin/monitor.php | 2 +- test/prehash.php | 90 ++++++++++++++++++------------------- test/removeCrapReleases.php | 6 +-- 3 files changed, 49 insertions(+), 49 deletions(-) diff --git a/bin/monitor.php b/bin/monitor.php index 84b83fa37..37abfc69f 100644 --- a/bin/monitor.php +++ b/bin/monitor.php @@ -4,7 +4,7 @@ require(dirname(__FILE__)."/config.php"); require(WWW_DIR.'/lib/postprocess.php'); require_once (WWW_DIR.'/lib/site.php'); -$version="0.3r075"; +$version="0.3r077"; $db = new DB(); $s = new Sites(); diff --git a/test/prehash.php b/test/prehash.php index bf86841df..a0f17aacf 100755 --- a/test/prehash.php +++ b/test/prehash.php @@ -118,7 +118,7 @@ Class Predb else $nfo = $db->escapeString("http://nzb.isasecret.com/".$matches2["nfo"]); - $db->query(sprintf("INSERT IGNORE INTO prehash (title, nfo, size, category, predate, adddate, source, hash) VALUES (%s, %s, %s, %s, FROM_UNIXTIME(".strtotime($matches2["date"])."), now(), %s, %s)", $db->escapeString($matches2["title"]), $nfo, $size, $db->escapeString($matches2["category"]), $db->escapeString("womble"), $db->escapeString(md5($matches2["title"])))); + $db->query(sprintf("INSERT INTO prehash (title, nfo, size, category, predate, adddate, source, hash) VALUES (%s, %s, %s, %s, FROM_UNIXTIME(".strtotime($matches2["date"])."), now(), %s, %s)", $db->escapeString($matches2["title"]), $nfo, $size, $db->escapeString($matches2["category"]), $db->escapeString("womble"), $db->escapeString(md5($matches2["title"])))); $newnames++; } } @@ -164,7 +164,7 @@ Class Predb { $size = $db->escapeString(round($matches2["size1"]).$matches2["size2"]); $title = preg_replace("/ - omgwtfnzbs.org/", "", $matches2["title"]); - $db->query(sprintf("INSERT IGNORE INTO prehash (title, size, category, predate, adddate, source, hash) VALUES (%s, %s, %s, FROM_UNIXTIME(".strtotime($matches2["date"])."), now(), %s, %s)", $db->escapeString($title), $size, $db->escapeString($matches2["category"]), $db->escapeString("omgwtfnzbs"), $db->escapeString($md5))); + $db->query(sprintf("INSERT INTO prehash (title, size, category, predate, adddate, source, hash) VALUES (%s, %s, %s, FROM_UNIXTIME(".strtotime($matches2["date"])."), now(), %s, %s)", $db->escapeString($title), $size, $db->escapeString($matches2["category"]), $db->escapeString("omgwtfnzbs"), $db->escapeString($md5))); $newnames++; } } @@ -176,49 +176,49 @@ Class Predb } public function retrieveZenet() - { - $db = new DB(); - $newnames = $updated = 0; + { + $db = new DB(); + $newnames = $updated = 0; - $buffer = getUrl("http://pre.zenet.org/live.php"); - if ($buffer !== false && strlen($buffer)) - { - if (preg_match_all('/<div background-color=".+?<\/div>/s', $buffer, $matches)) - { - foreach ($matches as $match) - { - foreach ($match as $m) - { - if (preg_match('/<div background-color=".+?<div.+?">(?P<date>.+?)<\/div.+?<div.+?(<font.+?">(?P<category>.+?)<\/a.+?|">(?P<category1>NUKE)+?)?<\/div.+?<div.+?">(?P<title>.+?-)<a.+?<b>(?P<title2>.+?)<\/b>.+?<\/div.+?<div.+<div.+?(">(?P<size1>[\d.]+)<b>(?P<size2>.+?)<\/b>.+)?<\/div>/s', $m, $matches2)) - { + $buffer = getUrl("http://pre.zenet.org/live.php"); + if ($buffer !== false && strlen($buffer)) + { + if (preg_match_all('/<tr bgcolor=".+?<\/tr>/s', $buffer, $matches)) + { + foreach ($matches as $match) + { + foreach ($match as $m) + { + if (preg_match('/<tr bgcolor=".+?<td.+?">(?P<date>.+?)<\/td.+?<td.+?(<font.+?">(?P<category>.+?)<\/a.+?|">(?P<category1>NUKE)+?)?<\/td.+?<td.+?">(?P<title>.+?-)<a.+?<b>(?P<title2>.+?)<\/b>.+?<\/td.+?<td.+<td.+?(">(?P<size1>[\d.]+)<b>(?P<size2>.+?)<\/b>.+)?<\/tr>/s', $m, $matches2)) + { $md5 = md5($matches2["title"].$matches2["title2"]); $oldname = $db->queryOneRow(sprintf("SELECT hash FROM prehash WHERE hash = %s", $db->escapeString($md5))); - if ($oldname !== false && $oldname["md5"] == $md5) - continue; - else - { - if (!isset($matches2["size1"]) && empty($matches2["size1"])) - $size = "NULL"; - else - $size = $db->escapeString(round($matches2["size1"]).$matches2["size2"]); + if ($oldname !== false && $oldname["md5"] == $md5) + continue; + else + { + if (!isset($matches2["size1"]) && empty($matches2["size1"])) + $size = "NULL"; + else + $size = $db->escapeString(round($matches2["size1"]).$matches2["size2"]); - if (isset($matches2["category"]) && !empty($matches2["category"])) - $category = $db->escapeString($matches2["category"]); - else if (isset($matches2["category1"]) && !empty($matches2["category1"])) - $category = $db->escapeString($matches2["category1"]); - else - $category = "NULL"; + if (isset($matches2["category"]) && !empty($matches2["category"])) + $category = $db->escapeString($matches2["category"]); + else if (isset($matches2["category1"]) && !empty($matches2["category1"])) + $category = $db->escapeString($matches2["category1"]); + else + $category = "NULL"; - $db->query(sprintf("INSERT IGNORE INTO prehash (title, size, category, predate, adddate, source, hash) VALUES (%s, %s, %s, FROM_UNIXTIME(".strtotime($matches2["date"])."), now(), %s, %s)", $db->escapeString($matches2["title"].$matches2["title2"]), $size, $category, $db->escapeString("zenet"), $db->escapeString($md5))); - $newnames++; - } - } - } - } - } - } - return $newnames; - } + $db->query(sprintf("INSERT INTO prehash (title, size, category, predate, adddate, source, hash) VALUES (%s, %s, %s, FROM_UNIXTIME(".strtotime($matches2["date"])."), now(), %s, %s)", $db->escapeString($matches2["title"].$matches2["title2"]), $size, $category, $db->escapeString("zenet"), $db->escapeString($md5))); + $newnames++; + } + } + } + } + } + } + return $newnames; + } public function retrievePrelist() { @@ -247,7 +247,7 @@ Class Predb else $size = $db->escapeString(round($matches2["size"])); - $db->query(sprintf("INSERT IGNORE INTO prehash (title, size, category, predate, adddate, source, hash) VALUES (%s, %s, %s, FROM_UNIXTIME(".strtotime($matches2["date"])."), now(), %s, %s)", $db->escapeString($matches2["title"]), $size, $db->escapeString($matches2["category"]), $db->escapeString("prelist"), $db->escapeString($md5))); + $db->query(sprintf("INSERT INTO prehash (title, size, category, predate, adddate, source, hash) VALUES (%s, %s, %s, FROM_UNIXTIME(".strtotime($matches2["date"])."), now(), %s, %s)", $db->escapeString($matches2["title"]), $size, $db->escapeString($matches2["category"]), $db->escapeString("prelist"), $db->escapeString($md5))); $newnames++; } } @@ -261,7 +261,7 @@ Class Predb { $category = $db->escapeString($matches2["category"].", ".$matches2["category1"]); - $db->query(sprintf("INSERT IGNORE INTO prehash (title, category, predate, adddate, source, hash) VALUES (%s, %s, FROM_UNIXTIME(".strtotime($matches2["date"])."), now(), %s, %s)", $db->escapeString($matches2["title"]), $category, $db->escapeString("prelist"), $db->escapeString($md5))); + $db->query(sprintf("INSERT INTO prehash (title, category, predate, adddate, source, hash) VALUES (%s, %s, FROM_UNIXTIME(".strtotime($matches2["date"])."), now(), %s, %s)", $db->escapeString($matches2["title"]), $category, $db->escapeString("prelist"), $db->escapeString($md5))); $newnames++; } } @@ -301,7 +301,7 @@ Class Predb else $size = $db->escapeString($matches2["size"]); - $db->query(sprintf("INSERT IGNORE INTO prehash (title, size, category, predate, adddate, source, hash) VALUES (%s, %s, %s, FROM_UNIXTIME(".strtotime($matches2["date"])."), now(), %s, %s)", $db->escapeString($matches2["title"]), $size, $db->escapeString($matches2["category"]), $db->escapeString("orlydb"), $db->escapeString($md5))); + $db->query(sprintf("INSERT INTO prehash (title, size, category, predate, adddate, source, hash) VALUES (%s, %s, %s, FROM_UNIXTIME(".strtotime($matches2["date"])."), now(), %s, %s)", $db->escapeString($matches2["title"]), $size, $db->escapeString($matches2["category"]), $db->escapeString("orlydb"), $db->escapeString($md5))); $newnames++; } } @@ -328,7 +328,7 @@ Class Predb continue; else { - $db->query(sprintf("INSERT IGNORE INTO prehash (title, predate, adddate, source, hash) VALUES (%s, FROM_UNIXTIME(".strtotime($release->pubDate)."), now(), %s, %s)", $db->escapeString($release->title), $db->escapeString("srrdb"), $db->escapeString($md5))); + $db->query(sprintf("INSERT INTO prehash (title, predate, adddate, source, hash) VALUES (%s, FROM_UNIXTIME(".strtotime($release->pubDate)."), now(), %s, %s)", $db->escapeString($release->title), $db->escapeString("srrdb"), $db->escapeString($md5))); $newnames++; } } @@ -354,7 +354,7 @@ Class Predb continue; else { - $db->query(sprintf("INSERT IGNORE INTO prehash (title, predate, adddate, source, hash) VALUES (%s, now(), now(), %s, %s)", $db->escapeString($release->title), $db->escapeString("predbme"), $db->escapeString($md5))); + $db->query(sprintf("INSERT INTO prehash (title, predate, adddate, source, hash) VALUES (%s, now(), now(), %s, %s)", $db->escapeString($release->title), $db->escapeString("predbme"), $db->escapeString($md5))); $newnames++; } } diff --git a/test/removeCrapReleases.php b/test/removeCrapReleases.php index a21c2f87a..fb3e21760 100755 --- a/test/removeCrapReleases.php +++ b/test/removeCrapReleases.php @@ -82,7 +82,7 @@ if (isset($argv[1]) && $argv[1] == "true") { $type = "Gibberish"; $db = new DB(); - $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE searchname REGEXP '^[a-zA-Z0-9]{15,}$' AND nfostatus = 0 AND relnamestatus > 1 AND rarinnerfilecount >= 0".$and); + $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE searchname REGEXP '^[a-zA-Z0-9]{15,}$' AND nfostatus = 0 AND relnamestatus >= 20 AND rarinnerfilecount >= 0".$and); $delcount = deleteReleases($sql, $type); return $delcount; } @@ -92,7 +92,7 @@ if (isset($argv[1]) && $argv[1] == "true") { $type = "Hashed"; $db = new DB(); - $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE searchname REGEXP '[a-zA-Z0-9]{25,}' AND nfostatus = 0 AND relnamestatus > 1 AND rarinnerfilecount >= 0".$and); + $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE searchname REGEXP '[a-zA-Z0-9]{25,}' AND nfostatus = 0 AND relnamestatus >= 20 AND rarinnerfilecount >= 0".$and); $delcount = deleteReleases($sql, $type); return $delcount; } @@ -102,7 +102,7 @@ if (isset($argv[1]) && $argv[1] == "true") { $type = "Short"; $db = new DB(); - $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE searchname REGEXP '^[a-zA-Z0-9]{0,5}$' AND nfostatus = 0 AND relnamestatus > 1 AND rarinnerfilecount >= 0".$and); + $sql = $db->query("SELECT ID, guid, searchname FROM releases WHERE searchname REGEXP '^[a-zA-Z0-9]{0,5}$' AND nfostatus = 0 AND relnamestatus >= 20 AND rarinnerfilecount >= 0".$and); $delcount = deleteReleases($sql, $type); return $delcount; }