diff --git a/Changelog b/Changelog index 1de81a988..6d6f08f67 100755 --- a/Changelog +++ b/Changelog @@ -1,3 +1,5 @@ +2016-08-09 DariusIII + * Chg: Properly process SDPORN releases 2016-08-08 DariusIII * Chg: Change updating (ported from nZEDb) * Chg: Remove rss button from search page in Gamma theme. diff --git a/misc/testing/Releases/fixReleaseNames.php b/misc/testing/Releases/fixReleaseNames.php index b2f58e07b..f57d67d0c 100755 --- a/misc/testing/Releases/fixReleaseNames.php +++ b/misc/testing/Releases/fixReleaseNames.php @@ -75,10 +75,10 @@ if (isset($argv[1]) && isset($argv[2]) && isset($argv[3]) && isset($argv[4])) { $namefixer->fixNamesWithMedia(2, $update, $other, $setStatus, $show); break; case 11: - $namefixer->fixNamesWithFiles(1, $update, $other, $setStatus, $show, true); + $namefixer->fixXXXNamesWithFiles(1, $update, $other, $setStatus, $show); break; case 12: - $namefixer->fixNamesWithFiles(2, $update, $other, $setStatus, $show, true); + $namefixer->fixXXXNamesWithFiles(2, $update, $other, $setStatus, $show); break; default : exit($pdo->log->error("\nERROR: Wrong argument, type php $argv[0] to see a list of valid arguments." . $n)); @@ -100,6 +100,6 @@ if (isset($argv[1]) && isset($argv[2]) && isset($argv[3]) && isset($argv[4])) { . "php $argv[0] 8 false other no ...: Fix release names in misc categories using Par2 Files.\n" . "php $argv[0] 9 false other no ...: Fix release names in misc categories using UID in the past 6 hours.\n" . "php $argv[0] 10 false other no ...: Fix release names in misc categories using UID.\n" - . "php $argv[0] 11 false other no ...: Fix release names in misc categories using specific File Name in the past 6 hours.\n" - . "php $argv[0] 12 false other no ...: Fix release names in misc categories using specific File Name.\n")); + . "php $argv[0] 11 false other no ...: Fix SDPORN XXX release names in misc categories using specific File Name in the past 6 hours.\n" + . "php $argv[0] 12 false other no ...: Fix SDPORN XXX release names in misc categories using specific File Name.\n")); } diff --git a/nntmux/Categorize.php b/nntmux/Categorize.php index 2bd487be8..f7a8065b9 100644 --- a/nntmux/Categorize.php +++ b/nntmux/Categorize.php @@ -1030,6 +1030,9 @@ class Categorize extends Category switch(true) { case $this->checkPoster( '/oz@lot[.]com/i', $this->poster, Category::XXX_CLIPSD): return true; + case preg_match('/SDPORN/i', $this->releaseName): + $this->tmpCat = Category::XXX_CLIPSD; + return true; default: return false; } diff --git a/nntmux/NameFixer.php b/nntmux/NameFixer.php index d513f3d99..05aa75296 100755 --- a/nntmux/NameFixer.php +++ b/nntmux/NameFixer.php @@ -258,9 +258,8 @@ class NameFixer * @param int $cats 1: other categories, 2: all categories * @param $nameStatus * @param $show - * @param bool $rfstring false: use standard filenames query, true: use specific rf.name to rename releases */ - public function fixNamesWithFiles($time, $echo, $cats, $nameStatus, $show, $rfstring = true) + public function fixNamesWithFiles($time, $echo, $cats, $nameStatus, $show) { $this->_echoStartMessage($time, 'file names'); $type = 'Filenames, '; @@ -285,11 +284,75 @@ class NameFixer FROM releases rel INNER JOIN release_files rf ON (rf.releases_id = rel.id) WHERE (rel.isrenamed = %d OR rel.categories_id IN(%d, %d)) - %s', + AND proc_files = %d', self::IS_RENAMED_NONE, Category::OTHER_MISC, Category::OTHER_HASHED, - ($rfstring ? sprintf ('AND rf.name %s', $this->pdo->likeString('SDPORN', true, true)) : sprintf('AND proc_files = %d', self::PROC_FILES_NONE)) + self::PROC_FILES_NONE + ); + } + + $releases = $this->_getReleases($time, $cats, $query); + if ($releases instanceof \Traversable && $releases !== false) { + + $total = $releases->rowCount(); + if ($total > 0) { + $this->_totalReleases = $total; + echo $this->pdo->log->primary(number_format($total) . ' file names to process.'); + + foreach ($releases as $release) { + $this->done = $this->matched = false; + $this->checkName($release, $echo, $type, $nameStatus, $show, $preId); + $this->checked++; + $this->_echoRenamed($show); + } + + $this->_echoFoundCount($echo, ' files'); + } else { + echo $this->pdo->log->info('Nothing to fix.'); + } + } + } + + /** + * Attempts to fix release names using the File name. + * + * @param int $time 1: 24 hours, 2: no time limit + * @param boolean $echo 1: change the name, anything else: preview of what could have been changed. + * @param int $cats 1: other categories, 2: all categories + * @param $nameStatus + * @param $show + */ + public function fixXXXNamesWithFiles($time, $echo, $cats, $nameStatus, $show) + { + $this->_echoStartMessage($time, 'file names'); + $type = 'Filenames, '; + + $preId = false; + if ($cats === 3) { + $query = sprintf(' + SELECT rf.name AS textstring, rel.categories_id, rel.name, rel.searchname, rel.fromname, rel.groups_id, + rf.releases_id AS fileid, rel.id AS releases_id + FROM releases rel + INNER JOIN release_files rf ON (rf.releases_id = rel.id) + WHERE nzbstatus = %d + AND predb_id = 0', + NZB::NZB_ADDED + ); + $cats = 2; + $preId = true; + } else { + $query = sprintf(' + SELECT rf.name AS textstring, rel.categories_id, rel.name, rel.searchname, rel.fromname, rel.groups_id, + rf.releases_id AS fileid, rel.id AS releases_id + FROM releases rel + INNER JOIN release_files rf ON (rf.releases_id = rel.id) + WHERE (rel.isrenamed = %d OR rel.categories_id IN(%d, %d)) + AND rf.name %s', + self::IS_RENAMED_NONE, + Category::OTHER_MISC, + Category::OTHER_HASHED, + $this->pdo->likeString('SDPORN', true, true) ); } @@ -1594,8 +1657,8 @@ class NameFixer case preg_match('/^VIDEOOT-[A-Z0-9]+\\\\([\w!.,& ()\[\]\'\`-]{8,}?\b.?)([-_](proof|sample|thumbs?))*(\.part\d*(\.rar)?|\.rar|\.7z)?(\d{1,3}\.rev|\.vol.+?|\.mp4)/', $release["textstring"], $result): $this->updateRelease($release, $result["1"] . " XXX DVDRIP XviD-VIDEOOT", $method = "fileCheck: XXX XviD VIDEOOT", $echo, $type, $namestatus, $show); break; - case preg_match('/^(.+?SDPORN+?)\\\\.+/i', $release["textstring"], $result): - $this->updateRelease($release, $result["1"], $method = "fileCheck: XXX SDPORN", $echo, $type, $namestatus, $show); + case preg_match('/^.+?SDPORN/i', $release["textstring"], $result): + $this->updateRelease($release, $result["0"], $method = "fileCheck: XXX SDPORN", $echo, $type, $namestatus, $show); break; case preg_match('/\w[-\w.\',;& ]+1080i[._ -]DD5[._ -]1[._ -]MPEG2-R&C(?=\.ts)/i', $release["textstring"], $result): $result = str_replace("MPEG2", "MPEG2.HDTV", $result["0"]); diff --git a/nntmux/TmuxRun.php b/nntmux/TmuxRun.php index 45021f776..dc5cac5f2 100644 --- a/nntmux/TmuxRun.php +++ b/nntmux/TmuxRun.php @@ -176,6 +176,7 @@ class TmuxRun extends Tmux case $runVar['counts']['now']['processrenames'] > 0: $log = $this->writelog($runVar['panes']['one'][0]); shell_exec("tmux respawnp -t{$runVar['constants']['tmux_session']}:1.0 ' \ + {$runVar['commands']['_php']} {$runVar['paths']['misc']}testing/Releases/fixReleaseNames.php 11 true other yes show $log; \ {$runVar['commands']['_php']} {$runVar['paths']['misc']}update/nix/multiprocessing/fixrelnames.php standard $log; \ {$runVar['commands']['_php']} {$runVar['paths']['misc']}update/nix/multiprocessing/fixrelnames.php predbft $log; date +\"{$this->_dateFormat}\"; \ {$runVar['commands']['_sleep']} {$runVar['settings']['fix_timer']}' 2>&1 1> /dev/null"