mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-30 17:58:59 +00:00
Add new regexes, update predb_import_daily_batch script, add new PreDb class to manage predb imports.
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
2015-11-09 DariusIII
|
||||
Add: Add new PreDb class for prehash imports, update predb_import_daily_batch to use the new nZEDb github repo.
|
||||
Add: Add new collection and release_naming regexes from nZEDb
|
||||
2015-11-06 DariusIII
|
||||
Fix: Wrong column name in NameFixer
|
||||
Wrong cat name
|
||||
|
||||
Regular → Executable
+136
-166
@@ -1,115 +1,135 @@
|
||||
<?php
|
||||
/**
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program (see LICENSE.txt in the base directory. If
|
||||
* not, see:
|
||||
*
|
||||
* @link <http://www.gnu.org/licenses/>.
|
||||
* @author niel
|
||||
* @copyright 2015 nZEDb
|
||||
*/
|
||||
|
||||
/* TODO better tune the queries for performance, including using prepared statements and
|
||||
pre-fetching groupid and other data for faster inclusion in the main query.
|
||||
/* TODO better tune the queries for performance, including pre-fetching group_id and other data for
|
||||
faster inclusion in the main query.
|
||||
*/
|
||||
require_once realpath(dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'indexer.php');
|
||||
|
||||
use newznab\db\Settings;
|
||||
use newznab\db\PreDb;
|
||||
use newznab\utility\Utility;
|
||||
|
||||
require_once realpath(dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'indexer.php');
|
||||
unset($config);
|
||||
|
||||
if (!Utility::isWin()) {
|
||||
$fullPath = DS;
|
||||
$paths = preg_split('#/#', NN_RES);
|
||||
foreach ($paths as $path) {
|
||||
if ($path !== '') {
|
||||
$fullPath .= $path . DS;
|
||||
if (!is_readable($fullPath) || !is_executable($fullPath)) {
|
||||
exit('The (' . $fullPath . ') folder must be readable and executable by all.' .
|
||||
PHP_EOL);
|
||||
}
|
||||
}
|
||||
if (NN_DEBUG) {
|
||||
echo "Checking resource path\n";
|
||||
}
|
||||
unset($fullPath, $paths, $path);
|
||||
$canExeRead = Utility::canExecuteRead(NN_RES);
|
||||
if (is_string($canExeRead)) {
|
||||
exit($canExeRead);
|
||||
}
|
||||
unset($canExeRead);
|
||||
}
|
||||
|
||||
if (NN_DEBUG) {
|
||||
echo "Checking directory is writable\n";
|
||||
}
|
||||
if (!is_writable(NN_RES)) {
|
||||
exit('The (' . NN_RES . ') folder must be writable.' . PHP_EOL);
|
||||
}
|
||||
|
||||
$progress = rw_progress(settings_array());
|
||||
|
||||
if (!isset($argv[1]) || !is_numeric($argv[1]) && $argv[1] != 'progress' || !isset($argv[2]) ||
|
||||
!in_array($argv[2], ['local', 'remote']) || !isset($argv[3]) ||
|
||||
!in_array($argv[3], ['true', 'false'])
|
||||
) {
|
||||
exit('This script quickly imports the daily PreDB dumps.' . PHP_EOL .
|
||||
'Argument 1: Enter the unix time of the patch to start at.' . PHP_EOL .
|
||||
'You can find the unix time in the file name of the patch, it\'s the long number.' .
|
||||
PHP_EOL .
|
||||
'You can put in 0 to import all the daily PreDB dumps.' . PHP_EOL .
|
||||
'You can put in progress to track progress of the imports and only import newer ones.' .
|
||||
PHP_EOL .
|
||||
'Argument 2: If your MySQL server is local, type local else type remote.' . PHP_EOL .
|
||||
'Argument 3: Show output of dump_predb.php or not, true | false' . PHP_EOL
|
||||
'Argument 1: Enter the unix time of the patch to start at.' . PHP_EOL .
|
||||
'You can find the unix time in the file name of the patch, it\'s the long number.' .
|
||||
PHP_EOL .
|
||||
'You can put in 0 to import all the daily PreDB dumps.' . PHP_EOL .
|
||||
'You can put in progress to track progress of the imports and only import newer ones.' .
|
||||
PHP_EOL .
|
||||
'Argument 2: If your MySQL server is local, type local else type remote.' . PHP_EOL .
|
||||
'Argument 3: Show output of queries or not, true | false' . PHP_EOL
|
||||
);
|
||||
}
|
||||
$fileName = '_predb_dump.csv.gz';
|
||||
$innerUrl = 'fb2pffwwriruyco';
|
||||
$baseUrl = 'https://www.dropbox.com/sh/' . $innerUrl;
|
||||
$folderUrl['url'] = $baseUrl . '/AACy9Egno_v2kcziVHuvWbbxa';
|
||||
|
||||
$result = Utility::getUrl($folderUrl);
|
||||
|
||||
if (!$result) {
|
||||
exit('Error connecting to dropbox.com, try again later?' . PHP_EOL);
|
||||
if (NN_DEBUG) {
|
||||
echo "Parameter check completed\n";
|
||||
}
|
||||
|
||||
$result = preg_match_all('#<a [\w"=-]+ href="https://www.dropbox.com/sh/' . $innerUrl . '/(\S+/\d+' . $fileName .
|
||||
'\?dl=0)"#',
|
||||
$result,
|
||||
$all_matches
|
||||
);
|
||||
if ($result) {
|
||||
exec('clear');
|
||||
$all_matches = array_unique($all_matches[1]);
|
||||
$total = count($all_matches);
|
||||
$pdo = new Settings();
|
||||
$url = 'https://api.github.com/repos/nZEDb/nZEDbPre_Dumps/contents/dumps/';
|
||||
$filePattern = '(?P<filename>(?P<stamp>\d+)_predb_dump\.csv\.gz)';
|
||||
|
||||
if ($argv[1] != 'progress') {
|
||||
$progress['last'] = !is_numeric($argv[1]) ? time() : $argv[1];
|
||||
}
|
||||
if (NN_DEBUG) {
|
||||
echo "Fetching predb_dump list from GitHub\n";
|
||||
}
|
||||
|
||||
$pdo->queryExec('DROP TABLE IF EXISTS tmp_pre');
|
||||
$pdo->queryExec('CREATE TABLE tmp_pre LIKE prehash');
|
||||
$result = Utility::getUrl(
|
||||
[
|
||||
'url' => $url,
|
||||
'requestheaders' => [
|
||||
'Content-Type: application/json',
|
||||
'User-Agent: nZEDb'
|
||||
]
|
||||
]);
|
||||
|
||||
// Drop id as it is not needed and incurs overhead creating each id.
|
||||
$pdo->queryExec('ALTER TABLE tmp_pre DROP COLUMN id');
|
||||
if ($result === false) {
|
||||
exit('Error connecting to GitHub, try again later?' . PHP_EOL);
|
||||
}
|
||||
|
||||
// Add a column for the group's name which is included instead of the groupid, which may be
|
||||
// different between individual databases
|
||||
$pdo->queryExec('ALTER TABLE tmp_pre ADD COLUMN groupname VARCHAR (255)');
|
||||
if (NN_DEBUG) {
|
||||
echo "Extracting filenames from list.\n";
|
||||
}
|
||||
|
||||
// Drop indexes on tmp_pre
|
||||
$pdo->queryExec('ALTER TABLE tmp_pre DROP INDEX `ix_prehash_nfo`, DROP INDEX `ix_prehash_predate`, DROP INDEX `ix_prehash_source`, DROP INDEX `ix_prehash_title`, DROP INDEX `ix_prehash_requestid`');
|
||||
$data = json_decode($result, true);
|
||||
if (is_null($data)) {
|
||||
exit("Error: $result");
|
||||
}
|
||||
|
||||
foreach ($all_matches as $matches) {
|
||||
if (preg_match('#^(.+)/(\d+)_#', $matches, $match)) {
|
||||
$total = count($data);
|
||||
$predb = new PreDb();
|
||||
|
||||
$progress = $predb->progress(settings_array());
|
||||
|
||||
foreach ($data as $file) {
|
||||
if (preg_match("#^https://raw\.githubusercontent\.com/nZEDb/nZEDbPre_Dumps/master/dumps/$filePattern$#",
|
||||
$file['download_url'])) {
|
||||
if (preg_match("#^$filePattern$#", $file['name'], $match)) {
|
||||
$timematch = $progress['last'];
|
||||
|
||||
// Skip patches the user does not want.
|
||||
if ($match[2] < $timematch) {
|
||||
echo 'Skipping dump ' . $match[2] . ', as your minimum unix time argument is ' .
|
||||
$timematch . PHP_EOL;
|
||||
if ($match[1] < $timematch) {
|
||||
echo 'Skipping dump ' . $match[2] .
|
||||
', as your minimum unix time argument is ' .
|
||||
$timematch . PHP_EOL;
|
||||
--$total;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Download the dump.
|
||||
$file['url'] = $baseUrl . '/' . $match[1] . '/' . $match[2] . $fileName . '?dl=1';
|
||||
$dump = Utility::getUrl($file);
|
||||
$dump = Utility::getUrl(['url' => $file['download_url']]);
|
||||
echo "Downloading: {$file['download_url']}\n";
|
||||
|
||||
if (!$dump) {
|
||||
echo 'Error downloading dump ' . $match[2] . ' you can try manually importing it.' .
|
||||
PHP_EOL;
|
||||
echo "Error downloading dump {$match[2]} you can try manually importing it." .
|
||||
PHP_EOL;
|
||||
continue;
|
||||
} else {
|
||||
if (NN_DEBUG) {
|
||||
echo "Dump {$match[2]} downloaded\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure we didn't get a HTML page.
|
||||
if (strlen($dump) < 5000 && strpos($dump, '<!DOCTYPE html>') !== false) {
|
||||
echo 'The dump file ' . $match[2] . ' might be missing from dropbox.' . PHP_EOL;
|
||||
// Make sure we didn't get an HTML page.
|
||||
if (strpos($dump, '<!DOCTYPE html>') !== false) {
|
||||
echo "The dump file {$match[2]} might be missing from GitHub." . PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -117,35 +137,68 @@ if ($result) {
|
||||
$dump = gzdecode($dump);
|
||||
|
||||
if (!$dump) {
|
||||
echo 'Error decompressing dump ' . $match[2] . '.' . PHP_EOL;
|
||||
echo "Error decompressing dump {$match[2]}." . PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Store the dump.
|
||||
$dumpFile = NN_RES . $match[2] . '_predb_dump.csv';
|
||||
$fetched = file_put_contents($dumpFile, $dump);
|
||||
$fetched = file_put_contents($dumpFile, $dump);
|
||||
if (!$fetched) {
|
||||
echo 'Error storing dump file ' . $match[2] . ' in (' . NN_RES . ').' . PHP_EOL;
|
||||
echo "Error storing dump file {$match[2]} in (" . NN_RES . ').' .
|
||||
PHP_EOL;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Make sure it's readable by all.
|
||||
chmod($dumpFile, 0777);
|
||||
$local = strtolower($argv[2]) == 'local' ? true : false;
|
||||
$local = strtolower($argv[2]) == 'local' ? true : false;
|
||||
$verbose = $argv[3] == true ? true : false;
|
||||
importDump($dumpFile, $local, $verbose);
|
||||
|
||||
if ($verbose) {
|
||||
echo $predb->log->info("Clearing import table");
|
||||
}
|
||||
|
||||
// Truncate to clear any old data
|
||||
$predb->executeTruncate();
|
||||
|
||||
// Import file into predb_imports
|
||||
$predb->executeLoadData(
|
||||
[
|
||||
'fields' => '\\t\\t',
|
||||
'lines' => '\\r\\n',
|
||||
'local' => $local,
|
||||
'path' => $dumpFile,
|
||||
]);
|
||||
|
||||
// Remove any titles where length <=8
|
||||
if ($verbose === true) {
|
||||
echo $predb->log->info("Deleting any records where title <=8 from Temporary Table");
|
||||
}
|
||||
$predb->executeDeleteShort();
|
||||
|
||||
// Add any groups that do not currently exist
|
||||
$predb->executeAddGroups();
|
||||
|
||||
// Fill the group_id
|
||||
$predb->executeUpdateGroupID();
|
||||
|
||||
echo $predb->log->info("Inserting records from temporary table into predb table");
|
||||
$predb->executeInsert();
|
||||
|
||||
// Delete the dump.
|
||||
// unlink($dumpFile);
|
||||
unlink($dumpFile);
|
||||
|
||||
$progress = rw_progress(settings_array($match[2] + 1, $progress), false);
|
||||
echo 'Successfully imported PreDB dump ' . $match[2] . ' ' . (--$total) .
|
||||
' dumps remaining to import.' . PHP_EOL;
|
||||
$progress = $predb->progress(settings_array($match[2] + 1, $progress),
|
||||
['read' => false]);
|
||||
echo "Successfully imported PreDB dump {$match[2]}, " . (--$total) .
|
||||
' dumps remaining.' . PHP_EOL;
|
||||
} else {
|
||||
echo "Ignoring: {$file['download_url']}\n";
|
||||
}
|
||||
} else if (NN_DEBUG) {
|
||||
echo "^https://raw.githubusercontent.com/nZEDb/nZEDbPre_Dumps/master/dumps/$filePattern$\n {$file['download_url']}\n";
|
||||
}
|
||||
|
||||
// Drop tmp_pre table
|
||||
$pdo->queryExec('DROP TABLE IF EXISTS tmp_pre');
|
||||
}
|
||||
|
||||
function settings_array($last = null, $settings = null)
|
||||
@@ -161,87 +214,4 @@ function settings_array($last = null, $settings = null)
|
||||
return $settings;
|
||||
}
|
||||
|
||||
function rw_progress($settings, $read = true)
|
||||
{
|
||||
if (!$read || !is_file(__DIR__ . DS . 'prehash_progress.txt')) {
|
||||
file_put_contents(__DIR__ . DS . 'prehash_progress.txt', base64_encode(serialize($settings)));
|
||||
} else {
|
||||
$settings = unserialize(base64_decode(file_get_contents(__DIR__ . DS .
|
||||
'prehash_progress.txt'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
// This function duplicates how dump_predb works but does not drop the hashes/triggers as recreating
|
||||
// potentially millions for the small addition that dailies add, isn't worth it.
|
||||
function importDump($path, $local, $verbose = true, $table = 'prehash')
|
||||
{
|
||||
global $pdo;
|
||||
|
||||
// Create temp table to allow updating
|
||||
if ($verbose) {
|
||||
echo $pdo->log->info("Creating temporary table");
|
||||
}
|
||||
|
||||
// Truncate to clear any old data
|
||||
$pdo->queryDirect("TRUNCATE TABLE tmp_pre");
|
||||
|
||||
// Import file into tmp_pre
|
||||
$sqlLoad = sprintf(
|
||||
"LOAD DATA %s INFILE '%s' IGNORE INTO TABLE tmp_pre FIELDS TERMINATED BY '\\t\\t' ENCLOSED BY \"'\" LINES TERMINATED BY '\\r\\n' (title, nfo, size, files, filename, nuked, nukereason, category, predate, source, requestid, groupname);",
|
||||
($local === false ? 'LOCAL' : ''),
|
||||
$path
|
||||
);
|
||||
if (NN_DEBUG) {
|
||||
echo $pdo->log->header($sqlLoad);
|
||||
}
|
||||
$pdo->queryDirect($sqlLoad);
|
||||
|
||||
// Remove any titles where length <=8
|
||||
if ($verbose) {
|
||||
echo $pdo->log->info("Deleting any records where title <=8 from Temporary Table");
|
||||
}
|
||||
$pdo->queryDirect("DELETE FROM tmp_pre WHERE LENGTH(title) <= 8");
|
||||
|
||||
// Add any groups that do not currently exist
|
||||
$sqlAddGroups = <<<SQL_ADD_GROUPS
|
||||
INSERT IGNORE INTO groups (`name`, description)
|
||||
SELECT groupname, 'Added by predb import script'
|
||||
FROM tmp_pre AS t LEFT JOIN groups AS g ON t.`groupname` = g.`name`
|
||||
WHERE t.`groupname` IS NOT NULL AND g.`name` IS NULL
|
||||
GROUP BY groupname;
|
||||
SQL_ADD_GROUPS;
|
||||
|
||||
$pdo->queryDirect($sqlAddGroups);
|
||||
|
||||
// Fill the groupid
|
||||
$pdo->queryDirect("UPDATE tmp_pre AS t SET groupid = (SELECT id FROM groups WHERE name = t.groupname) WHERE groupname IS NOT NULL");
|
||||
|
||||
// Insert and update table
|
||||
$sqlInsert = <<<SQL_INSERT
|
||||
INSERT INTO $table (title, nfo, size, files, filename, nuked, nukereason, category, predate, SOURCE, requestid, groupid)
|
||||
SELECT t.title, t.nfo, t.size, t.files, t.filename, t.nuked, t.nukereason, t.category, t.predate, t.source, t.requestid, t.groupid
|
||||
FROM tmp_pre AS t
|
||||
ON DUPLICATE KEY UPDATE prehash.nfo = IF(prehash.nfo IS NULL, t.nfo, prehash.nfo),
|
||||
prehash.size = IF(prehash.size IS NULL, t.size, prehash.size),
|
||||
prehash.files = IF(prehash.files IS NULL, t.files, prehash.files),
|
||||
prehash.filename = IF(prehash.filename = '', t.filename, prehash.filename),
|
||||
prehash.nuked = IF(t.nuked > 0, t.nuked, prehash.nuked),
|
||||
prehash.nukereason = IF(t.nuked > 0, t.nukereason, prehash.nukereason),
|
||||
prehash.category = IF(prehash.category IS NULL, t.category, prehash.category),
|
||||
prehash.requestid = IF(prehash.requestid = 0, t.requestid, prehash.requestid),
|
||||
prehash.groupid = IF(prehash.groupid = 0, t.groupid, prehash.groupid);
|
||||
SQL_INSERT;
|
||||
|
||||
echo $pdo->log->info("Inserting records from temporary table into $table");
|
||||
if (NN_DEBUG) {
|
||||
echo $pdo->log->primary($sqlInsert);
|
||||
}
|
||||
if ($pdo->queryDirect($sqlInsert) === false) {
|
||||
echo "FAILED\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -0,0 +1,301 @@
|
||||
<?php
|
||||
/**
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program (see LICENSE.txt in the base directory. If
|
||||
* not, see:
|
||||
*
|
||||
* @link <http://www.gnu.org/licenses/>.
|
||||
* @author niel
|
||||
* @copyright 2014 nZEDb
|
||||
*/
|
||||
namespace newznab\db;
|
||||
|
||||
|
||||
class PreDb extends DB
|
||||
{
|
||||
/**
|
||||
* @var array Prepared Statement objects
|
||||
*/
|
||||
protected $ps = [
|
||||
'AddGroups' => null,
|
||||
'DeleteShort' => null,
|
||||
'Export' => null,
|
||||
'Import' => null,
|
||||
'Insert' => null,
|
||||
'LoadData' => null,
|
||||
'Truncate' => null,
|
||||
'UpdateGroupID' => null,
|
||||
];
|
||||
|
||||
public function __construct(array $options = [])
|
||||
{
|
||||
$defaults = [];
|
||||
$options += $defaults;
|
||||
parent::__construct($options);
|
||||
|
||||
$this->tableMain = 'prehash';
|
||||
$this->tableTemp = 'prehash_imports';
|
||||
}
|
||||
|
||||
public function executeAddGroups()
|
||||
{
|
||||
if (!isset($this->ps['AddGroups'])) {
|
||||
$this->prepareSQLAddGroups();
|
||||
}
|
||||
|
||||
return $this->ps['AddGroups']->execute();
|
||||
}
|
||||
|
||||
public function executeDeleteShort()
|
||||
{
|
||||
if (!isset($this->ps['DeleteShort'])) {
|
||||
$this->prepareSQLDeleteShort();
|
||||
}
|
||||
|
||||
return $this->ps['DeleteShort']->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array|null $options array of parameter.
|
||||
* 'enclosedby' - string for enclosed by clause. default: empty string,
|
||||
* 'fields' - string for FIELDS SEPARATED BY clause. default: '\t',
|
||||
* 'limit' - string for LIMIT clause. Zero indicate no clause. Default: 0,
|
||||
* 'lines' - string for LINES TERMINATED BY. Default: '\r\n' (Windows style EOLs to allow \n to be used in text),
|
||||
* 'path' - path (including filename) to write data to.
|
||||
* All parameter will be escaped before use.
|
||||
*
|
||||
* @return false|\PDOStatement
|
||||
*/
|
||||
public function executeExport(array $options = null)
|
||||
{
|
||||
$defaults = [
|
||||
'enclosedby' => '',
|
||||
'fields' => '\t',
|
||||
'limit' => 0,
|
||||
'lines' => '\r\n', // use Windows style endings so that text can contain \n
|
||||
'path' => null,
|
||||
];
|
||||
$options += $defaults;
|
||||
|
||||
if (empty($options['path'])) {
|
||||
return null;
|
||||
} else if (!is_numeric($options['limit'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$limit = $options['limit'] > 0 ? "LIMIT {$options['limit']}" : '';
|
||||
|
||||
$enclosedby = empty($options['enclosedby']) ? '' : "ENCLOSED BY {$this->escapeString($options['enclosedby'])}";
|
||||
|
||||
$sql = <<<SQL_EXPORT
|
||||
SELECT title, nfo, size, files, filename, nuked, nukereason, category, predate, source, requestid, g.name
|
||||
FROM {$this->tableMain} p LEFT OUTER JOIN groups g ON p.groupid = g.id $limit
|
||||
INTO OUTFILE '{$options['path']}'
|
||||
FIELDS TERMINATED BY '{$options['fields']}' $enclosedby
|
||||
LINES TERMINATED BY '{$options['lines']}';
|
||||
SQL_EXPORT;
|
||||
if (NN_DEBUG) {
|
||||
echo "$sql\n";
|
||||
}
|
||||
|
||||
return $this->queryDirect($sql);
|
||||
}
|
||||
|
||||
public function executeInsert()
|
||||
{
|
||||
if (!isset($this->ps['Insert'])) {
|
||||
$this->prepareSQLInsert();
|
||||
}
|
||||
|
||||
return $this->ps['Insert']->execute();
|
||||
}
|
||||
|
||||
public function executeLoadData(array $options = null)
|
||||
{
|
||||
$defaults = [
|
||||
'path' => null,
|
||||
];
|
||||
$options += $defaults;
|
||||
|
||||
if (empty($options['path'])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!isset($this->ps['LoadData'])) {
|
||||
// TODO detect LOCAL here and pass parameter as appropriate
|
||||
$this->prepareSQLLoadData($options);
|
||||
}
|
||||
|
||||
return $this->ps['LoadData']->execute([':path' => $options['path']]);
|
||||
}
|
||||
|
||||
public function executeTruncate()
|
||||
{
|
||||
if (!isset($this->ps['Truncate'])) {
|
||||
$this->prepareSQLTruncate();
|
||||
}
|
||||
return $this->ps['Truncate']->execute();
|
||||
}
|
||||
|
||||
public function executeUpdateGroupID()
|
||||
{
|
||||
if (!isset($this->ps['UpdateGroupID'])) {
|
||||
$this->prepareSQLUpdateGroupIDs();
|
||||
}
|
||||
|
||||
return $this->ps['UpdateGroupID']->execute();
|
||||
}
|
||||
|
||||
public function import($filespec, $localDB = false)
|
||||
{
|
||||
if (!($this->ps['AddGroups'] instanceof \PDOStatement)) {
|
||||
$this->prepareImportSQL($localDB);
|
||||
}
|
||||
|
||||
$this->ps['Truncate']->execute();
|
||||
|
||||
$this->ps['LoadData']->execute([':path' => $filespec]);
|
||||
|
||||
$this->ps['DeleteShort']->execute();
|
||||
|
||||
$this->ps['AddGroups']->execute();
|
||||
|
||||
$this->ps['UpdateGroupID']->execute();
|
||||
|
||||
$this->ps['Insert']->execute();
|
||||
}
|
||||
|
||||
public function progress($settings = null, array $options = [])
|
||||
{
|
||||
$defaults = [
|
||||
'path' => NN_ROOT . 'cli' . DS . 'data' . DS . 'predb_progress.txt',
|
||||
'read' => true,
|
||||
];
|
||||
$options += $defaults;
|
||||
|
||||
if (!$options['read'] || !is_file($options['path'])) {
|
||||
file_put_contents($options['path'], base64_encode(serialize($settings)));
|
||||
} else {
|
||||
$settings = unserialize(base64_decode(file_get_contents($options['path'])));
|
||||
}
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
protected function prepareImportSQL($localDB = false, $enclosedby = '')
|
||||
{
|
||||
$this->prepareSQLTruncate();
|
||||
|
||||
$this->prepareSQLLoadData(['local' => $localDB, 'enclosedby' => $enclosedby, 'optional' => true]);
|
||||
|
||||
$this->prepareSQLDeleteShort();
|
||||
|
||||
$this->prepareSQLAddGroups();
|
||||
|
||||
$this->prepareSQLUpdateGroupIDs();
|
||||
|
||||
$this->prepareSQLInsert();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sql
|
||||
* @param string $index
|
||||
*/
|
||||
protected function prepareSQLStatement($sql, $index)
|
||||
{
|
||||
$this->ps[$index] = $this->prepare($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add any groups that are not in our current groups table
|
||||
*/
|
||||
protected function prepareSQLAddGroups()
|
||||
{
|
||||
$sql = <<<SQL_ADD_GROUPS
|
||||
INSERT IGNORE INTO groups (name, description)
|
||||
SELECT groupname, 'Added by predb import script'
|
||||
FROM prehash_imports AS pi LEFT JOIN groups AS g ON pi.groupname = g.name
|
||||
WHERE pi.groupname IS NOT NULL AND g.name IS NULL
|
||||
GROUP BY groupname;
|
||||
SQL_ADD_GROUPS;
|
||||
|
||||
$this->prepareSQLStatement($sql, 'AddGroups');
|
||||
}
|
||||
|
||||
protected function prepareSQLDeleteShort()
|
||||
{
|
||||
$this->prepareSQLStatement('DELETE FROM prehash_imports WHERE LENGTH(title) <= 8', 'DeleteShort');
|
||||
}
|
||||
|
||||
protected function prepareSQLInsert()
|
||||
{
|
||||
$sql = <<<SQL_INSERT
|
||||
INSERT INTO {$this->tableMain} (title, nfo, size, files, filename, nuked, nukereason, category, predate, SOURCE, requestid, groupid)
|
||||
SELECT pi.title, pi.nfo, pi.size, pi.files, pi.filename, pi.nuked, pi.nukereason, pi.category, pi.predate, pi.source, pi.requestid, groupid
|
||||
FROM prehash_imports AS pi
|
||||
ON DUPLICATE KEY UPDATE prehash.nfo = IF(prehash.nfo IS NULL, pi.nfo, prehash.nfo),
|
||||
prehash.size = IF(prehash.size IS NULL, pi.size, prehash.size),
|
||||
prehash.files = IF(prehash.files IS NULL, pi.files, prehash.files),
|
||||
prehash.filename = IF(prehash.filename = '', pi.filename, prehash.filename),
|
||||
prehash.nuked = IF(pi.nuked > 0, pi.nuked, prehash.nuked),
|
||||
prehash.nukereason = IF(pi.nuked > 0, pi.nukereason, prehash.nukereason),
|
||||
prehash.category = IF(prehash.category IS NULL, pi.category, prehash.category),
|
||||
prehash.requestid = IF(prehash.requestid = 0, pi.requestid, prehash.requestid),
|
||||
prehash.groupid = IF(prehash.groupid = 0, pi.groupid, prehash.groupid);
|
||||
SQL_INSERT;
|
||||
|
||||
$this->prepareSQLStatement($sql, 'Insert');
|
||||
}
|
||||
|
||||
protected function prepareSQLLoadData(array $options = [])
|
||||
{
|
||||
$enclosedby = '';
|
||||
$defaults = [
|
||||
'enclosedby' => "'",
|
||||
'fields' => '\t',
|
||||
'lines' => '\r\n', // Windows' style EOL to allow \n to be used in text.
|
||||
'local' => false,
|
||||
'optional' => true,
|
||||
];
|
||||
$options += $defaults;
|
||||
|
||||
$local = $options['local'] === false ? 'LOCAL' : '';
|
||||
if (!empty($options['enclosedby'])) {
|
||||
$optional = $options['optional'] === true ? ' OPTIONALLY' : '';
|
||||
$enclosedby = "$optional ENCLOSED BY \"{$options['enclosedby']}\"";
|
||||
}
|
||||
$sql = <<<SQL_LOAD_DATA
|
||||
LOAD DATA $local INFILE :path
|
||||
IGNORE INTO TABLE prehash_imports
|
||||
FIELDS TERMINATED BY '{$options['fields']}' {$enclosedby}
|
||||
LINES TERMINATED BY '{$options['lines']}'
|
||||
(title, nfo, size, files, filename, nuked, nukereason, category, predate, source, requestid, groupname);
|
||||
SQL_LOAD_DATA;
|
||||
if (NN_DEBUG) {
|
||||
echo "$sql\n";
|
||||
}
|
||||
|
||||
$this->prepareSQLStatement($sql, 'LoadData');
|
||||
}
|
||||
|
||||
protected function prepareSQLTruncate()
|
||||
{
|
||||
$this->prepareSQLStatement('TRUNCATE TABLE prehash_imports', 'Truncate');
|
||||
}
|
||||
|
||||
protected function prepareSQLUpdateGroupIDs()
|
||||
{
|
||||
$sql = "UPDATE prehash_imports AS pi SET groupid = (SELECT id FROM groups WHERE name = pi.groupname) WHERE groupname IS NOT NULL";
|
||||
$this->prepareSQLStatement($sql, 'UpdateGroupID');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
DELETE FROM collection_regexes WHERE id = 600;
|
||||
INSERT INTO collection_regexes (id, group_regex, regex, status, description, ordinal)
|
||||
VALUES (
|
||||
600,
|
||||
'^alt\\.binaries\\.cores$',
|
||||
'/^(?P<match0>.+?) - \\[\\d+\\/\\d+\\] - ".+?" yEnc$/',
|
||||
1,
|
||||
'Gracepoint S01E04 Episode Four 1080p WEB-DL DD51 H 264 CtrlHD - [52/52] - "Gracepoint S01E04 Episode Four 1080p WEB-DL DD51 H 264 CtrlHD.vol511+021.par2" yEnc',
|
||||
80
|
||||
);
|
||||
@@ -0,0 +1,30 @@
|
||||
REPLACE INTO collection_regexes (id, group_regex, regex, status, description, ordinal)
|
||||
VALUES (
|
||||
586,
|
||||
'^alt\\.binaries\\.sounds\\.(flac|lossless)$',
|
||||
'/^.+dream-of-usenet.+[-_ ]{0,3}\\[\\d+\/(?P<match0>\\d+\\])[-_ ]{0,3}("|#34;)(?P<match1>.+?)(\\.part\\d*|\\.rar)?(\\.vol.+ \\(\\d+\/\\d+\) "|\\.[A-Za-z0-9]{2,4}("|#34;))[-_ ]{0,3}yEnc$/i',
|
||||
1,
|
||||
'(dream-of-usenet.info) - [01/21] - "A_Perfect_Circle-aMOTION-CD-FLAC-2004-SCORN.nfo" yEnc',
|
||||
5
|
||||
), (
|
||||
587,
|
||||
'^alt\\.binaries\\.sounds\\.flac$',
|
||||
'/^.+www\\.EliteNZB\\.net.+[-_ ]{0,3}\[\\d+\/(?P<match0>\\d+\\])[-_ ]{0,3}("|#34;)(?P<match1>.+?)(\\.part\\d*|\\.rar)?(\\.vol.+ \\(\\d+\/\\d+\) "|\\.[A-Za-z0-9]{2,4}("|#34;))[-_ ]{0,3}yEnc$/i',
|
||||
1,
|
||||
'The Elite Team Presents www.EliteNZB.net, Powered by 4UX.NL, Only The Best 4 You!!!! [01/19] - "Habariyaasubuhi_12352_TvPYrS1128.par2" yEnc',
|
||||
15
|
||||
), (
|
||||
588,
|
||||
'^alt\\.binaries\\.sounds\\.flac$',
|
||||
'/^("|#34;)(?P<match1>.+?)(\\.part\\d*|\\.rar)?(\\.vol.+ \\(\\d+\/\\d+\) "|\\.[A-Za-z0-9]{2,4}("|#34;))[-_ ]{0,3}\\[\\d+\/(?P<match0>\\d+\\]).+www\\.EliteNZB\\.net.+[-_ ]{0,3}yEnc$/i',
|
||||
1,
|
||||
'"Jinsi_12187_v807.par2" [01/13] - The Elite Team Presents www.EliteNZB.net, Powered by 4UX.NL, Only The Best 4 You!!!! yEnc',
|
||||
20
|
||||
), (
|
||||
589,
|
||||
'^alt\\.binaries\\.mp3(\\.full_albums)?$',
|
||||
'/^JN Dutplanet.+[-_ ]{0,3}\\[\\d+\/(?P<match0>\\d+\\])[-_ ]{0,3}("|#34;)(?P<match1>.+?)(\\.part\\d*|\\.rar)?(\\.vol.+ \\(\\d+\/\\d+\) "|\\.[A-Za-z0-9]{2,4}("|#34;))[-_ ]{0,3}yEnc$/i',
|
||||
1,
|
||||
'JN Dutplanet.net - [02/16] - "JN Dutplanet.net Foreigner - I Want To Know What Love Is - The Ballads [2014]FLAC.part1.rar" yEnc',
|
||||
5
|
||||
);
|
||||
@@ -0,0 +1,30 @@
|
||||
REPLACE INTO collection_regexes (id, group_regex, regex, status, description, ordinal)
|
||||
VALUES (
|
||||
586,
|
||||
'^alt\\.binaries\\.sounds\\.(flac|lossless)$',
|
||||
'/^.+dream-of-usenet.+[-_ ]{0,3}\\[\\d+\\/(?P<match0>\\d+\\])[-_ ]{0,3}("|#34;)(?P<match1>.+?)(\\.part\\d*|\\.rar)?(\\.vol.+ (\\d+\\/\\d+) "|\\.[A-Za-z0-9]{2,4}("|#34;))[-_ ]{0,3}yEnc$/i',
|
||||
1,
|
||||
'(dream-of-usenet.info) - [01/21] - "A_Perfect_Circle-aMOTION-CD-FLAC-2004-SCORN.nfo" yEnc',
|
||||
5
|
||||
), (
|
||||
587,
|
||||
'^alt\\.binaries\\.sounds\\.flac$',
|
||||
'/^.+www\\.EliteNZB\\.net.+[-_ ]{0,3}\\[\\d+\\/(?P<match0>\\d+\\])[-_ ]{0,3}("|#34;)(?P<match1>.+?)(\\.part\\d*|\\.rar)?(\\.vol.+ (\\d+\\/\\d+) "|\\.[A-Za-z0-9]{2,4}("|#34;))[-_ ]{0,3}yEnc$/i',
|
||||
1,
|
||||
'The Elite Team Presents www.EliteNZB.net, Powered by 4UX.NL, Only The Best 4 You!!!! [01/19] - "Habariyaasubuhi_12352_TvPYrS1128.par2" yEnc',
|
||||
15
|
||||
), (
|
||||
588,
|
||||
'^alt\\.binaries\\.sounds\\.flac$',
|
||||
'/^("|#34;)(?P<match1>.+?)(\\.part\\d*|\\.rar)?(\\.vol.+ \\(\\d+\/\\d+\) "|\\.[A-Za-z0-9]{2,4}("|#34;))[-_ ]{0,3}\\[\\d+\/(?P<match0>\\d+\\]).+www\\.EliteNZB\\.net.+[-_ ]{0,3}yEnc$/i',
|
||||
1,
|
||||
'"Jinsi_12187_v807.par2" [01/13] - The Elite Team Presents www.EliteNZB.net, Powered by 4UX.NL, Only The Best 4 You!!!! yEnc',
|
||||
20
|
||||
), (
|
||||
589,
|
||||
'^alt\\.binaries\\.mp3(\\.full_albums)?$',
|
||||
'/^JN Dutplanet.+[-_ ]{0,3}\\[\\d+\\/(?P<match0>\\d+\\])[-_ ]{0,3}("|#34;)(?P<match1>.+?)(\\.part\\d*|\\.rar)?(\\.vol.+ (\\d+\\/\\d+) "|\\.[A-Za-z0-9]{2,4}("|#34;))[-_ ]{0,3}yEnc$/i',
|
||||
1,
|
||||
'JN Dutplanet.net - [02/16] - "JN Dutplanet.net Foreigner - I Want To Know What Love Is - The Ballads [2014]FLAC.part1.rar" yEnc',
|
||||
5
|
||||
);
|
||||
@@ -0,0 +1,44 @@
|
||||
ALTER TABLE binaryblacklist MODIFY COLUMN description VARCHAR(1000) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL;
|
||||
|
||||
INSERT INTO binaryblacklist (id, groupname, regex, msgcol, optype, status, description)
|
||||
VALUES (
|
||||
14,
|
||||
'^alt\\.binaries\\.multimedia\\.korean$',
|
||||
'TESTMAN',
|
||||
2,
|
||||
1,
|
||||
1,
|
||||
'Posts by TESTMAN (jpegs)'
|
||||
), (
|
||||
15,
|
||||
'^alt\\.binaries\\.multimedia\\.korean$',
|
||||
'^yEnc ".+torrent"$',
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
'torrent uploads ::: yEnc "SBS ÃñⰡ¿ä.E690.120916.HDTV.H264.720p-KOR.avi.torrent"'
|
||||
), (
|
||||
16,
|
||||
'^korea\\.binaries\\.movies$',
|
||||
'^.\[?(Kornet|SK|xpeed|KT)\]?',
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
'Incomplete releases'
|
||||
), (
|
||||
17,
|
||||
'^korea\\.binaries\\.movies$',
|
||||
'^(top@top.t \\(top\\)|shit@xxxxxxxxaa.com \\(shit\\)|none@nonemail.com \\(none\\))$',
|
||||
2,
|
||||
1,
|
||||
1,
|
||||
'incomplete cryptic releases'
|
||||
), (
|
||||
18,
|
||||
'^korea\\.binaries\\.movies$',
|
||||
'^filzilla6@web\\.de \\(Baruth\\)$',
|
||||
2,
|
||||
1,
|
||||
1,
|
||||
'Virus Poster'
|
||||
);
|
||||
@@ -0,0 +1,139 @@
|
||||
ALTER TABLE release_naming_regexes
|
||||
MODIFY COLUMN description VARCHAR(1000) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
MODIFY COLUMN regex VARCHAR(2000) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL;
|
||||
|
||||
INSERT INTO release_naming_regexes (id, group_regex, regex, status, description, ordinal)
|
||||
VALUES (
|
||||
1134,
|
||||
'^korea\\.binaries\\.music\\.videos)$',
|
||||
'/^\\[KoreanMusic\\] \\[(?P<match0>(뮤직뱅크|스케치북|음악중심|인기가요|더\\.쇼))\\](?P<match1>\\.\\d{6}\\..+?) \\[\\d+\\/\\d+\\] - ".+?" yEnc$/',
|
||||
1,
|
||||
'[KoreanMusic] [더.쇼].150730.워너비.전체.차렷.ts [5/16] - "[더.쇼].150730.워너비.전체.차렷.part04.rar" yEnc',
|
||||
0
|
||||
), (
|
||||
1135,
|
||||
'^korea\\.binaries\\.music\\.videos$',
|
||||
'/^\\[KoreanMusic\\] (?P<match1>\\d{8}_)(?P<match0>(Simply\\.K-POP|쇼챔|더쇼|위열|음중|엠카)_)(?P<match2>.*?)_FHD_M2T \\[\\d+\\/\\d+\\] - ".+?" yEnc$/',
|
||||
1,
|
||||
'[KoreanMusic] 20151009_Simply.K-POP_GI-Doligo.Doligo_FHD_M2T [11/18] - "20151009_Simply.K-POP_GI-Doligo.Doligo_FHD_M2T.part09.rar" yEnc',
|
||||
1
|
||||
), (
|
||||
1136,
|
||||
'^korea\\.binaries\\.movies$',
|
||||
'/^\\[KoreanMovies\\] (?P<match0>.+?) \\[\\d+\\/\\d+\\] - ".+" yEnc$/',
|
||||
1,
|
||||
'[KoreanMovies] 12.Deep.Red.Nights.2013.AVC1.H264.720p-UNknown [11/69] - "12 Deep Red Nights 2013.AVC1.H264.720p-UNknown.part09.rar" yEnc',
|
||||
6
|
||||
), (
|
||||
1137,
|
||||
'^(korea\\.binaries\\.tv|alt\\.binaries\\.multimedia\\.korean)$',
|
||||
'/^\\[KoreanTV] (\\[.+?]\\.)?(?P<match0>.+?) \\[\\d+\\/\\d+\\] - ".+?" yEnc$/',
|
||||
1,
|
||||
'[KoreanTV] Hyde.Jekyll.Me.E15.150311.HDTV.H264.720p-WITH [20/31] - "Hyde.Jekyll.Me.E15.150311.HDTV.H264.720p-WITH.part19.rar" yEnc ::: [KoreanTV] [OCN].My.Beautiful.Bride.E16.END.150809.HDTV.H264.720p-WITH.mp4 [31/32] - "[OCN] 아름다운 나의신부.E16.END.150809.HDTV.H264.720p-WITH.vol15+16.par2" yEnc',
|
||||
0
|
||||
), (
|
||||
1138,
|
||||
'^(korea\\.binaries\\.tv|alt\\.binaries\\.multimedia\\.korean)$',
|
||||
'/^.+?-enjoy-\\s+\\[\\d+\\/\\d+\\] - "(?P<match0>.+?)\\.(mkv|mp4|avi|jpe?g|par2|nzb|nfo|iso|ts|part\\d+\\.rar|vol\\d+\\+\\d+\\.par2|rar)(\\.\\d+)?" yEnc$/i',
|
||||
1,
|
||||
'Take Care of the Young Lady 2009 720p Completed -enjoy- [542/630] - "Take Care of the Young Lady.E06.720p.HDTV.x264-Zeus.vol000+001.PAR2" yEnc ::: Dream High 2 E01 720p -enjoy- [01/40] - "Dream.High.2.E01.120130.HDTV.X264.720p-HANrel.par2" yEnc',
|
||||
10
|
||||
), (
|
||||
1139,
|
||||
'^(korea\\.binaries\\.tv|alt\\.binaries\\.multimedia\\.korean)$',
|
||||
'/^.+?-enjoy-\\s+- File \\d+ of \\d+: "(?P<match0>.+?)\\.(mkv|mp4|avi|jpe?g|par2|nzb|nfo|iso|ts|part\\d+\\.rar|vol\\d+\\+\\d+\\.par2|rar)(\\.\\d+)?" yEnc$/i',
|
||||
1,
|
||||
'[MV] C-REAL - No No No No No [2011.10.12] 1080p WEB MP4 -enjoy- - File 03 of 15: "C-real-no.no.no.no.part1.rar" yEnc',
|
||||
70
|
||||
), (
|
||||
1140,
|
||||
'^(korea\\.binaries\\.tv|alt\\.binaries\\.multimedia\\.korean)$',
|
||||
'/^.+?-enjoy-\\s+\\(\\d+\\/\\d+\\) "(?P<match0>.+)$/',
|
||||
1,
|
||||
'Queen Seon Deok 720p Completed -enjoy- (1538/2482) "Queen Seon Deok.E39.091005.HDTV.X264.720p-HAN',
|
||||
40
|
||||
), (
|
||||
1141,
|
||||
'^alt\\.binaries\\.multimedia\\.korean$',
|
||||
'/^\\(\\d+\\/\\d+\\) "(?P<match0>.+?)\\.(par2|part\\d+\\.rar)" - .+yEnc$/',
|
||||
1,
|
||||
'(01/24) "IRIS E02 091015 HDTV X264 720p-HAN™.par2" - 1.60 GB - ????(IRIS) E02 091015 HDTV X264 720p-HAN™ with eng subs yEnc',
|
||||
45
|
||||
), (
|
||||
1142,
|
||||
'^alt\\.binaries\\.multimedia\\.korean$',
|
||||
'/^alt\\.binaries\\.newmiyamoto - .+? \\[\\d+\\/\\d+\\] - "(?P<match0>.+?)\\.(vol\\d+\\+\\d+\\.par2|avi|mkv)(\\.\\d+)?" yEnc$/',
|
||||
1,
|
||||
'alt.binaries.newmiyamoto - for scr3wtard and the canuck [002/276] - "Delightful Girl Choon-Hyang .vol000+561.par2" yEnc',
|
||||
20
|
||||
), (
|
||||
1143,
|
||||
'^alt\\.binaries\\.multimedia\\.korean$',
|
||||
'/^(\\(|\\[)OMNi(\\)|\\]) (alt\\.binaries\\.newmiyamoto - )?.+?\\[\\d+\\/\\d+] - "(?P<match0>.+?)\\.(avi|mkv|vol\\d+\\+\\d+|iso|t(s|p))(\\.(par2|\\d+))?" yEnc$/i',
|
||||
1,
|
||||
'(OMNi) alt.binaries.newmiyamoto - Gourmet 720p RAW - 19-24 - [052/206] - "Sikgaek.E20.720p.HDTV.x264-jinuki.mkv.011" yEnc ::: (OMNi) alt.binaries.newmiyamoto - Fantasy Couple 720p - softsubbed - [002/584] - "Fantasy.Couple.01-02.vol00+01.PAR2" yEnc ::: (OMNi) Korean Kdrama of Hana Yori Dango - [02/70] - "Boys.Before.Flowers.E01.720p.HDTV.x264-NotoriouS.mkv.001" yEnc',
|
||||
21
|
||||
), (
|
||||
1144,
|
||||
'^alt\\.binaries\\.multimedia\\.korean$',
|
||||
'/^\\(.+?\\) \\[\\d+\\/\\d+] - "(?P<match0>.+)\\[T1\\]\\.avi" yEnc$/',
|
||||
1,
|
||||
'(Winter Sonata) [12/34] - "Winter_Sonata_ep-10[T1].avi" yEnc',
|
||||
60
|
||||
), (
|
||||
1145,
|
||||
'^alt\\.binaries\\.multimedia\\.korean$',
|
||||
'/^\\[KDrama\\].+? \\[\\d+\\/\\d+\\] - "(?P<match0>.+?)\\.(nzb|par2|r\\d+)" yEnc$/',
|
||||
1,
|
||||
'[KDrama]Secret.Garden.450p-HANrel [00/12] - "Secret.Garden.New.Year.Special.Part2.HDTV.X264.450p-HANrel.nzb" yEnc',
|
||||
50
|
||||
), (
|
||||
1146,
|
||||
'^alt\\.binaries\\.multimedia\\.korean$',
|
||||
'/^\\[Album\\] (?P<match0>.+?) -enjoy- .+" yEnc$/',
|
||||
1,
|
||||
'[Album] Secret - Moving In Secret [2011.10.18] MP3 320 WEB -enjoy- - File 02 of 20: "02 섹시하게.mp3" yEnc',
|
||||
65
|
||||
), (
|
||||
1147,
|
||||
'^alt\\.binaries\\.multimedia\\.korean$',
|
||||
'/^\\[\\?{4}\\] - "(?P<match0>.+?)\\.mp3" \\[\\d+\\/\\d+\\] yEnc$/',
|
||||
1,
|
||||
'[????] - "Elmio-09-You Will Follow.mp3" [009/130] yEnc',
|
||||
55
|
||||
), (
|
||||
1148,
|
||||
'^alt\\.binaries\\.multimedia\\.korean$',
|
||||
'/^\\(\\d+\\/\\d+\\) "(?P<match0>.+?)\\..+?" - \\d+\\.\\d+ .+ yEnc$/',
|
||||
1,
|
||||
'(1/1) "100612.MBC MusicCore.Just Married.Bye Bye Bye.60fps.x264-Izo.mkv" - 150.66 MB - 100612.MBC MusicCore.Double K.Favorite Music.60fps.x264-Izo yEnc',
|
||||
35
|
||||
), (
|
||||
1149,
|
||||
'^korea\\.binaries\\.tv$',
|
||||
'/^.+? -?"(?P<match0>.+?)\\.(nzb|par2|vol\\d+\\+\\d+\\.par2|part\\d+\\.rar|r\\d+|rar)" \\[\\d+\\/\\d+\\] yEnc$/',
|
||||
1,
|
||||
'Posts by AREA11 ::: Sunbi18 "Scholar.Who.Walks.the.Night.E18.720p.HDTV.x264-AREA11.nzb" [00/56] yEnc',
|
||||
15
|
||||
), (
|
||||
1150,
|
||||
'^(korea\\.binaries\\.(tv|movies)|alt\\.binaries\\.multimedia\\.korean)$',
|
||||
'/^\\((?P<match0>.+?)\\) \\[\\d+\\/\\d+\\] - ".+?" yEnc$/',
|
||||
1,
|
||||
'(BMask.E25.120829.HDTV.H264.720p-HANrel) [00/44] - "BMask.E25.nzb" yEnc',
|
||||
30
|
||||
), (
|
||||
1151,
|
||||
'^korea\\.binaries\\.tv$',
|
||||
'/^"(?P<match0>\\w.+)\\.(par2|nzb|part\\d+\\.rar)" \\[\\d+\\/\\d+\\] yEnc$/',
|
||||
1,
|
||||
'"Queen.InHyun\'s.Man.E16.END.720p.HDTV.x264-AREA11.nzb" [00/40] yEnc',
|
||||
25
|
||||
), (
|
||||
1152,
|
||||
'^korea\\.binaries\\.music\\.videos$',
|
||||
'/^\\[KoreanMusic\\] \\[.+?\\]\\.(?P<match1>.+?)(?P<match0>(MCD|The\\.Show)\\.\\d{6}\\.)(?P<match2>1080i\\.HDMI) \\[\\d+\\/\\d+\\] - ".+?" yEnc$/',
|
||||
1,
|
||||
'[KoreanMusic] [Mnet].NS윤지-Wifey.MCD.150409.1080i.HDMI [5/16] - "[Mnet].NS윤지-Wifey.MCD.150409.1080i.HDMI.part04.rar" yEnc',
|
||||
2
|
||||
);
|
||||
@@ -0,0 +1,46 @@
|
||||
ALTER TABLE collection_regexes MODIFY COLUMN description VARCHAR(1000) CHARSET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL;
|
||||
|
||||
INSERT INTO collection_regexes (id, group_regex, regex, status, description, ordinal)
|
||||
VALUES (
|
||||
592,
|
||||
'^alt\\.binaries\\.multimedia\\.korean$',
|
||||
'/^(?P<match0>\\[KoreanTV\\]\s.+?\\[)\\d+\\/\\d+\\] - ".+?" yEnc$/',
|
||||
1,
|
||||
'[KoreanTV] The.Village.Achiaras.Secret.E08.151029.HDTV.XviD-WITH [2/18] - "마을.아치아라의.비밀.E08.151029.HDTV.XviD-WITH.part01.rar" yEnc',
|
||||
5
|
||||
), (
|
||||
593,
|
||||
'^korea\\.binaries\\.tv$',
|
||||
'/^(?P<match0>\\[KoreanTV\\]\s.+?\\[)\\d+\\/\\d+\\] - ".+?" yEnc$/',
|
||||
1,
|
||||
'[KoreanTV] The.Village.Achiaras.Secret.E08.151029.HDTV.XviD-WITH [2/18] - "마을.아치아라의.비밀.E08.151029.HDTV.XviD-WITH.part01.rar" yEnc',
|
||||
5
|
||||
), (
|
||||
594,
|
||||
'^korea\\.binaries\\.music\\.videos$',
|
||||
'/^(?P<match0>\\[KoreanMusic\\] .+) \\[\\d+\\/\\d+\\] - ".+?" yEnc$/',
|
||||
1,
|
||||
'[KoreanMusic] 151015.TWTV.MTV.Idols.of.Asia.Lovelyz [2/45] - "151015.TWTV.MTV.Idols.of.Asia.Lovelyz.part01.rar" yEnc',
|
||||
5
|
||||
), (
|
||||
595,
|
||||
'^korea\\.binaries\\.movies$',
|
||||
'/^(?P<match0>\\[KoreanMovies\\] .+) \\[\\d+\\/\\d+\\] - ".+?" yEnc$/',
|
||||
1,
|
||||
'[KoreanMovies] Gangnam.Blues.2015.720p.BluRay.x264-WiKi [2/125] - "Gangnam.Blues.2015.720p.BluRay.x264-WiKi.part001.rar" yEnc',
|
||||
5
|
||||
), (
|
||||
596,
|
||||
'^korea\\.binaries\\.tv$',
|
||||
'/^(?P<match0>area-11) "(?P<match1>.+?)\\.(vol\\d+\\+\\d+\\.par2|part\\d+\\.rar|par2|nzb)" \\[\\d+\\/\\d+\\] yEnc$/i',
|
||||
1,
|
||||
'area-11 "Glamorous.Temptation.E01.720p.HDTV.x264-AREA11.nzb" [00/56] yEnc',
|
||||
10
|
||||
), (
|
||||
597,
|
||||
'^alt\\.binaries\\.multimedia\\.korean$',
|
||||
'/^(?P<match0>.+?(MP3 320K|FLAC)\\[)\\d+\\/\\d+\\] - ".+" yEnc$/',
|
||||
1,
|
||||
'Davichi - Amaranth Repackage MP3 320K[01/21] - ".par2" yEnc',
|
||||
10
|
||||
);
|
||||
@@ -0,0 +1,44 @@
|
||||
INSERT INTO collection_regexes (id, group_regex, regex, status, description, ordinal)
|
||||
VALUES (
|
||||
598,
|
||||
'^alt\\.binaries\\.e-book\\.technical$',
|
||||
'/^(?P<match0>(New )?tech eBooks -=?\\[?\\s?[\\w\\.-]+\\s?\\]?=?- )".+?" yEnc$/i',
|
||||
1,
|
||||
'New tech eBooks -[ Springer.Toxic.Trauma.A.Basic.Clinical.Guide.2014.RETAIL.EBOOK-METHLAB ]- "ml-0435a.zip" yEnc',
|
||||
5
|
||||
), (
|
||||
599,
|
||||
'^alt\\.binaries\\.(cores|ath)$',
|
||||
'/^(?P<match0>\\[(SERIES|MOVIES)\\]-\\[ www\\.vip-lounge\\.me \\]) \\[\\d+\\/\\d+\\] - "(?P<match1>.+?)\\.(par2|nfo|rar|part\\d+\\.rar|vol\\d+\\+\\d+\\.par2)" - \\d+,\\d+ [MG]B yEnc$/i',
|
||||
1,
|
||||
'[SERIES]-[ www.vip-lounge.me ] [19/20] - "Wild.World.Africas.Deadly.Eden.480p.x264-mSD.vol03+4.par2" - 443,42 MB yEnc',
|
||||
55
|
||||
), (
|
||||
600,
|
||||
'^alt\\.binaries\\.cores$',
|
||||
'/^(?P<match0>.+?) - \[\d+\/\d+\] - ".+?" yEnc$/',
|
||||
1,
|
||||
'Gracepoint S01E04 Episode Four 1080p WEB-DL DD51 H 264 CtrlHD - [52/52] - "Gracepoint S01E04 Episode Four 1080p WEB-DL DD51 H 264 CtrlHD.vol511+021.par2" yEnc',
|
||||
80
|
||||
), (
|
||||
601,
|
||||
'^alt\\.binaries\\.howard-stern$',
|
||||
'/^(?P<match0>.+?) \\[\\d+\\/\\d+\\] "(?P<match1>.+?)\\.(mp3|nzb).*?" yEnc$/',
|
||||
1,
|
||||
'Artie Lange ArtieQuitter Podcast [2/9] "ArtieQuiterPodcast_2015-11-05_161_CF_128k.mp3.par2" yEnc',
|
||||
5
|
||||
), (
|
||||
602,
|
||||
'^alt\\.binaries\\.howard-stern$',
|
||||
'/^(?P<match0>.+?) - File \\d+ of \\d+ - yEnc "(?P<match1>.+?).mp3" \\d+ bytes$/',
|
||||
1,
|
||||
'Howard Stern 11.04.2015 CF 32K 57.7MB + WUS - File 1 of 1 - yEnc "Howard Stern 11.04.15 (Alanis Morissette Visits).mp3" 60596352 bytes',
|
||||
10
|
||||
), (
|
||||
603,
|
||||
'^alt\\.binaries\\.howard-stern$',
|
||||
'/^(?P<match0>.+?) \\d (?P<match1>\\d+kbps) - \\[\\d+\\/\\d+\\] - "(?P<match2>.+?)Part_\\d+\\.(mp3|nzb).*?" yEnc$/',
|
||||
1,
|
||||
'Howard Stern Show Oct 19 2015 Mon Hour 6 96kbps - [1/1] - "Stern-2015_10_19-96k-Part_06.mp3" yEnc',
|
||||
15
|
||||
);
|
||||
@@ -0,0 +1,44 @@
|
||||
INSERT INTO release_naming_regexes (id, group_regex, regex, status, description, ordinal)
|
||||
VALUES (
|
||||
1153,
|
||||
'^alt\\.binaries\\.e-book\\.technical$',
|
||||
'/^(New )?tech eBooks -=?\\[?\\s?(?P<match0>[\\w\\.-]+)\\s?\\]?=?- ".+?" yEnc$/i',
|
||||
1,
|
||||
'New Tech eBooks -=[ ELSEVIER.SYSTEMS.PROGRAMMING.2015.RETAIL.EPUB.EBOOK-kE]=- "kesp15ef.zip" yEnc',
|
||||
5
|
||||
), (
|
||||
1154,
|
||||
'^alt\\.binaries\\.(cores|ath)$',
|
||||
'/^\\[(SERIES|MOVIES)\]-\\[ www\\.vip-lounge\\.me \\] \\[\\d+\\/\\d+\\] - "(?P<match0>.+?)\\.(par2|nfo|rar|part\\d+\\.rar|vol\\d+\\+\\d+\\.par2)" - \\d+,\\d+ [GM]B yEnc$/i',
|
||||
1,
|
||||
'[SERIES]-[ www.vip-lounge.me ] [19/20] - "Wild.World.Africas.Deadly.Eden.480p.x264-mSD.vol03+4.par2" - 443,42 MB yEnc',
|
||||
55
|
||||
), (
|
||||
1155,
|
||||
'^alt\\.binaries\\.cores$',
|
||||
'/^(?P<match0>.+?) - \[\d+\/\d+\] - ".+?" yEnc$/',
|
||||
1,
|
||||
'Gracepoint S01E04 Episode Four 1080p WEB-DL DD51 H 264 CtrlHD - [52/52] - "Gracepoint S01E04 Episode Four 1080p WEB-DL DD51 H 264 CtrlHD.vol511+021.par2" yEnc',
|
||||
110
|
||||
), (
|
||||
1156,
|
||||
'^alt\\.binaries\\.howard-stern$',
|
||||
'/^.+? \[\d+\/\d+\] "(?P<match0>.+?)\.(mp3|nzb).*?" yEnc$/',
|
||||
1,
|
||||
'Artie Lange ArtieQuitter Podcast [2/9] "ArtieQuiterPodcast_2015-11-05_161_CF_128k.mp3.par2" yEnc',
|
||||
5
|
||||
), (
|
||||
1157,
|
||||
'^alt\\.binaries\\.howard-stern$',
|
||||
'/^.+? - File \\d+ of \\d+ - yEnc "(?P<match0>.+?).mp3" \\d+ bytes$/',
|
||||
1,
|
||||
'Howard Stern 11.04.2015 CF 32K 57.7MB + WUS - File 1 of 1 - yEnc "Howard Stern 11.04.15 (Alanis Morissette Visits).mp3" 60596352 bytes',
|
||||
10
|
||||
), (
|
||||
1158,
|
||||
'^alt\\.binaries\\.howard-stern$',
|
||||
'/^(?P<match0>.+?) \\d (?P<match1>\\d+kbps) - \\[\\d+\\/\\d+\\] - ".+?Part_\\d+\\.(mp3|nzb).*?" yEnc$/',
|
||||
1,
|
||||
'Howard Stern Show Oct 19 2015 Mon Hour 6 96kbps - [1/1] - "Stern-2015_10_19-96k-Part_06.mp3" yEnc',
|
||||
15
|
||||
);
|
||||
@@ -0,0 +1,31 @@
|
||||
DELETE FROM collection_regexes WHERE id BETWEEN 586 AND 589;
|
||||
INSERT INTO collection_regexes (id, group_regex, regex, status, description, ordinal)
|
||||
VALUES (
|
||||
586,
|
||||
'^alt\\.binaries\\.sounds\\.(flac|lossless)$',
|
||||
'/^.+dream-of-usenet.+[-_ ]{0,3}\\[\\d+\/(?P<match0>\\d+\\])[-_ ]{0,3}("|#34;)(?P<match1>.+?)(\\.part\\d*|\\.rar)?(\\.vol.+ \\(\\d+\/\\d+\) "|\\.[A-Za-z0-9]{2,4}("|#34;))[-_ ]{0,3}yEnc$/i',
|
||||
1,
|
||||
'(dream-of-usenet.info) - [01/21] - "A_Perfect_Circle-aMOTION-CD-FLAC-2004-SCORN.nfo" yEnc',
|
||||
5
|
||||
), (
|
||||
587,
|
||||
'^alt\\.binaries\\.sounds\\.flac$',
|
||||
'/^.+www\\.EliteNZB\\.net.+[-_ ]{0,3}\[\\d+\/(?P<match0>\\d+\\])[-_ ]{0,3}("|#34;)(?P<match1>.+?)(\\.part\\d*|\\.rar)?(\\.vol.+ \\(\\d+\/\\d+\) "|\\.[A-Za-z0-9]{2,4}("|#34;))[-_ ]{0,3}yEnc$/i',
|
||||
1,
|
||||
'The Elite Team Presents www.EliteNZB.net, Powered by 4UX.NL, Only The Best 4 You!!!! [01/19] - "Habariyaasubuhi_12352_TvPYrS1128.par2" yEnc',
|
||||
15
|
||||
), (
|
||||
588,
|
||||
'^alt\\.binaries\\.sounds\\.flac$',
|
||||
'/^("|#34;)(?P<match1>.+?)(\\.part\\d*|\\.rar)?(\\.vol.+ \\(\\d+\/\\d+\) "|\\.[A-Za-z0-9]{2,4}("|#34;))[-_ ]{0,3}\\[\\d+\/(?P<match0>\\d+\\]).+www\\.EliteNZB\\.net.+[-_ ]{0,3}yEnc$/i',
|
||||
1,
|
||||
'"Jinsi_12187_v807.par2" [01/13] - The Elite Team Presents www.EliteNZB.net, Powered by 4UX.NL, Only The Best 4 You!!!! yEnc',
|
||||
20
|
||||
), (
|
||||
589,
|
||||
'^alt\\.binaries\\.mp3(\\.full_albums)?$',
|
||||
'/^JN Dutplanet.+[-_ ]{0,3}\\[\\d+\/(?P<match0>\\d+\\])[-_ ]{0,3}("|#34;)(?P<match1>.+?)(\\.part\\d*|\\.rar)?(\\.vol.+ \\(\\d+\/\\d+\) "|\\.[A-Za-z0-9]{2,4}("|#34;))[-_ ]{0,3}yEnc$/i',
|
||||
1,
|
||||
'JN Dutplanet.net - [02/16] - "JN Dutplanet.net Foreigner - I Want To Know What Love Is - The Ballads [2014]FLAC.part1.rar" yEnc',
|
||||
5
|
||||
);
|
||||
@@ -0,0 +1,31 @@
|
||||
DELETE FROM release_naming_regexes WHERE id in (1, 1130, 1155, 1156);
|
||||
INSERT INTO release_naming_regexes (id, group_regex, regex, status, description, ordinal)
|
||||
VALUES (
|
||||
1,
|
||||
'^alt\\.binaries\\.teevee$',
|
||||
'/\\[\\d+\\]-\\[.+?\\]-\\[.+?\\]-\\[ (?P<match0>.+\\.S\\d\\dE\\d\\d\\..+?) \\][- ]\\[\\d+\\/\\d+\\][ -]{0,3}"[\\w\\säöüÄÖÜß+¤¶!.,&_()\\[\\]\\\'\\`{}-]{8,}?\\b.?([-_](proof|sample|thumbs?))*(\\.part\\d*(\\.rar)?|\\.rar|\\.7z)?(\\d{1,3}\\.rev"|\\.vol.+?"|\\.[A-Za-z0-9]{2,4}"|")[-_\\s]{0,3}\d+([.,]\\d+)? [kKmMgG][bB][-_\\s]{0,3}[-_\\s]{0,3}yEnc$/ui',
|
||||
1,
|
||||
'rename these teevee releases as the requestid is for the full season ::: [169018]-[FULL]-[a.b.teevee]-[ House.of.Lies.S01E01.720p.WEB-DL.DD5.1.H.264-BS ]-[04/32] - "House.of.Lies.S01E01.The.Gods.of.Dangerous.Financial.Instruments.720p.WEB-DL.DD5.1.H.264-BS.part03.rar" yEnc',
|
||||
5
|
||||
), (
|
||||
1130,
|
||||
'^alt\\.binaries\\.teevee$',
|
||||
'#^\\[KoreanTV\\]\\s*(?P<match0>.+?)\\.[a-z0-9]+\\s+\\[\\d+/\\d+\\]\s+-\\s+".+?"\\s+yEnc$#i',
|
||||
1,
|
||||
'[KoreanTV] Star.King.E412.150509.HDTV.H264.720p-WITH.mp4 [1/36] - "놀�운 대회 스타킹.E412.150509.HDTV.H264.720p-WITH.par2" yEnc',
|
||||
445
|
||||
), (
|
||||
1155,
|
||||
'^alt\\.binaries\\.cores$',
|
||||
'/^(?P<match0>.+?) - \\[\\d+\\/\\d+\\] - ".+?" yEnc$/',
|
||||
1,
|
||||
'Gracepoint S01E04 Episode Four 1080p WEB-DL DD51 H 264 CtrlHD - [52/52] - "Gracepoint S01E04 Episode Four 1080p WEB-DL DD51 H 264 CtrlHD.vol511+021.par2" yEnc',
|
||||
110
|
||||
), (
|
||||
1156,
|
||||
'^alt\\.binaries\\.howard-stern$',
|
||||
'/^.+? \\[\\d+\\/\\d+\] "(?P<match0>.+?)\\.(mp3|nzb).*?" yEnc$/',
|
||||
1,
|
||||
'Artie Lange ArtieQuitter Podcast [2/9] "ArtieQuiterPodcast_2015-11-05_161_CF_128k.mp3.par2" yEnc',
|
||||
5
|
||||
);
|
||||
Reference in New Issue
Block a user