Change categoryid to categories_id, category table to categories table

This commit is contained in:
DariusIII
2016-05-09 09:50:28 +02:00
parent f5f642f8aa
commit 2cbd7052af
68 changed files with 377 additions and 311 deletions
+2
View File
@@ -1,3 +1,5 @@
2016-05-09 DariusIII
* Upd: Change categoryid to categories_id, category table to categories table
2016-05-08 DariusIII
* Upd: Composer replace qtip2 with qtip2-main
* Fix: Fix missed table renames in scripts.
+2 -2
View File
@@ -16,8 +16,8 @@
</last>
</scripts>
<sql>
<db>249</db>
<file>249</file>
<db>251</db>
<file>251</file>
</sql>
</versions>
</nntmux>
+10 -10
View File
@@ -63,7 +63,7 @@ if (isset($argv[1]) && ($argv[1] === "consoles" || $argv[1] === "all")) {
$where = ' WHERE consoleinfoid IS NOT NULL';
} else {
echo $pdo->log->header("Resetting all failed Console postprocessing");
$where = " WHERE consoleinfoid IN (-2, 0) AND categoryid BETWEEN " . Category::GAME_ROOT . " AND " . Category::GAME_OTHER;
$where = " WHERE consoleinfoid IN (-2, 0) AND categories_id BETWEEN " . Category::GAME_ROOT . " AND " . Category::GAME_OTHER;
}
$qry = $pdo->queryDirect("SELECT id FROM releases" . $where);
@@ -91,7 +91,7 @@ if (isset($argv[1]) && ($argv[1] === "games" || $argv[1] === "all")) {
$where = ' WHERE gamesinfo_id != 0';
} else {
echo $pdo->log->header("Resetting all failed Games postprocessing");
$where = " WHERE gamesinfo_id IN (-2, 0) AND categoryid = 4050";
$where = " WHERE gamesinfo_id IN (-2, 0) AND categories_id = 4050";
}
$qry = $pdo->queryDirect("SELECT id FROM releases" . $where);
@@ -119,7 +119,7 @@ if (isset($argv[1]) && ($argv[1] === "movies" || $argv[1] === "all")) {
$where = ' WHERE imdbid IS NOT NULL';
} else {
echo $pdo->log->header("Resetting all failed Movie postprocessing");
$where = " WHERE imdbid IN (-2, 0) AND categoryid BETWEEN " . Category::MOVIE_ROOT . " AND " . Category::MOVIE_OTHER;
$where = " WHERE imdbid IN (-2, 0) AND categories_id BETWEEN " . Category::MOVIE_ROOT . " AND " . Category::MOVIE_OTHER;
}
$qry = $pdo->queryDirect("SELECT id FROM releases" . $where);
@@ -147,7 +147,7 @@ if (isset($argv[1]) && ($argv[1] === "music" || $argv[1] === "all")) {
$where = ' WHERE musicinfoid IS NOT NULL';
} else {
echo $pdo->log->header("Resetting all failed Music postprocessing");
$where = " WHERE musicinfoid IN (-2, 0) AND categoryid BETWEEN " . Category::MUSIC_ROOT . " AND " . Category::MUSIC_OTHER;
$where = " WHERE musicinfoid IN (-2, 0) AND categories_id BETWEEN " . Category::MUSIC_ROOT . " AND " . Category::MUSIC_OTHER;
}
$qry = $pdo->queryDirect("SELECT id FROM releases" . $where);
@@ -196,10 +196,10 @@ if (isset($argv[1]) && ($argv[1] === "tv" || $argv[1] === "all")) {
}
if (isset($argv[2]) && $argv[2] === "true") {
echo $pdo->log->header("Resetting all TV postprocessing");
$where = " WHERE videos_id != 0 AND tv_episodes_id != 0 AND categoryid BETWEEN " . Category::TV_ROOT . " AND " . Category::TV_OTHER;
$where = " WHERE videos_id != 0 AND tv_episodes_id != 0 AND categories_id BETWEEN " . Category::TV_ROOT . " AND " . Category::TV_OTHER;
} else {
echo $pdo->log->header("Resetting all failed TV postprocessing");
$where = " WHERE tv_episodes_id < 0 AND categoryid BETWEEN " . Category::GAME_ROOT . " AND " . Category::GAME_OTHER;
$where = " WHERE tv_episodes_id < 0 AND categories_id BETWEEN " . Category::GAME_ROOT . " AND " . Category::GAME_OTHER;
}
$qry = $pdo->queryDirect("SELECT id FROM releases" . $where);
@@ -225,10 +225,10 @@ if (isset($argv[1]) && ($argv[1] === "anime" || $argv[1] === "all")) {
}
if (isset($argv[2]) && $argv[2] === "true") {
echo $pdo->log->header("Resetting all Anime postprocessing");
$where = ' WHERE categoryid = 5070';
$where = ' WHERE categories_id = 5070';
} else {
echo $pdo->log->header("Resetting all failed Anime postprocessing");
$where = " WHERE anidbid BETWEEN -2 AND -1 AND categoryid = " . Category::TV_ANIME;
$where = " WHERE anidbid BETWEEN -2 AND -1 AND categories_id = " . Category::TV_ANIME;
}
$qry = $pdo->queryDirect("SELECT id FROM releases" . $where);
@@ -256,7 +256,7 @@ if (isset($argv[1]) && ($argv[1] === "books" || $argv[1] === "all")) {
$where = ' WHERE bookinfoid IS NOT NULL';
} else {
echo $pdo->log->header("Resetting all failed Book postprocessing");
$where = " WHERE bookinfoid IN (-2, 0) AND categoryid BETWEEN " . Category::BOOKS_ROOT . " AND " . Category::BOOKS_UNKNOWN;
$where = " WHERE bookinfoid IN (-2, 0) AND categories_id BETWEEN " . Category::BOOKS_ROOT . " AND " . Category::BOOKS_UNKNOWN;
}
$qry = $pdo->queryDirect("SELECT id FROM releases" . $where);
@@ -280,7 +280,7 @@ if (isset($argv[1]) && ($argv[1] === "xxx" || $argv[1] === "all")) {
$where = ' WHERE xxxinfo_id != 0';
} else {
echo $pdo->log->header("Resetting all failed XXX postprocessing");
$where = " WHERE xxxinfo_id IN (-2, 0) AND categoryid BETWEEN " . Category::XXX_ROOT . " AND " . Category::XXX_X264;
$where = " WHERE xxxinfo_id IN (-2, 0) AND categories_id BETWEEN " . Category::XXX_ROOT . " AND " . Category::XXX_X264;
}
$qry = $pdo->queryDirect("SELECT id FROM releases" . $where);
+1 -1
View File
@@ -15,7 +15,7 @@ $console = new Console(['Echo' => true, 'Settings' => $pdo]);
$res = $pdo->queryDirect(
sprintf(
"SELECT searchname, id FROM releases WHERE consoleinfoid IS NULL AND categoryid
"SELECT searchname, id FROM releases WHERE consoleinfoid IS NULL AND categories_id
BETWEEN %s AND %s ORDER BY id DESC",
Category::GAME_ROOT,
Category::GAME_OTHER
+2 -2
View File
@@ -27,7 +27,7 @@ if ($totalArgs < 2) {
'adddate : Look for releases added to our DB (older than|newer than) x hours. (modifiers: bigger,smaller)' . $n .
'postdate : Look for posted to usenet (older than|newer than) x hours. (modifiers: bigger,smaller)' . $n .
'completion : Look for completion (less than) (modifiers: smaller)' . $n .
'categoryid : Look for releases within specified category (modifiers: equals)' . $n .
'categories_id : Look for releases within specified category (modifiers: equals)' . $n .
'imdbid : Look for releases with imdbid (modifiers: equals)' . $n .
'rageid : Look for releases with rageid (modifiers: equals)' . $n .
'totalpart : Look for releases with certain number of parts (modifiers: equals,bigger,smaller)' . $n .
@@ -45,7 +45,7 @@ if ($totalArgs < 2) {
$_SERVER['_'] . ' ' . $argv[0] . ' guid=equals="8fb5956bae3de4fb94edcc69da44d6883d586fd0"' . $n .
$_SERVER['_'] . ' ' . $argv[0] . ' size=smaller="104857600" size=bigger="2048" groupname=like="movies"' . $n .
$_SERVER['_'] . ' ' . $argv[0] . ' fromname=like="@XviD.net" groupname=equals="alt.binaries.movies.divx" ignore' .$n .
$_SERVER['_'] . ' ' . $argv[0] . ' imdbid=equals=NULL categoryid=equals=2999 nzbstatus=equals=1 adddate=bigger=2880 # Remove other movie releases with non-cleaned names added > 120 days ago'
$_SERVER['_'] . ' ' . $argv[0] . ' imdbid=equals=NULL categories_id=equals=2999 nzbstatus=equals=1 adddate=bigger=2880 # Remove other movie releases with non-cleaned names added > 120 days ago'
));
}
+5 -5
View File
@@ -35,7 +35,7 @@ function reCategorize($argv)
} else if (isset($argv[1]) && preg_match('/\([\d, ]+\)/', $argv[1])) {
$where = ' AND groupid IN ' . $argv[1];
} else if (isset($argv[1]) && $argv[1] === 'misc') {
$where = sprintf(' AND categoryid IN (%s)', $othercats);
$where = sprintf(' AND categories_id IN (%s)', $othercats);
}
if (isset($argv[2]) && $argv[2] === 'test') {
$update = false;
@@ -73,13 +73,13 @@ function categorizeRelease($where, $update = true, $echooutput = false)
$pdo->log = new ColorCLI();
$consoletools = new ConsoleTools(['ColorCLI' => $pdo->log]);
$relcount = $chgcount = 0;
echo $pdo->log->primary("SELECT id, searchname, groupid, categoryid FROM releases " . $where);
$resrel = $pdo->queryDirect("SELECT id, searchname, groupid, categoryid FROM releases " . $where);
echo $pdo->log->primary("SELECT id, searchname, groupid, categories_id FROM releases " . $where);
$resrel = $pdo->queryDirect("SELECT id, searchname, groupid, categories_id FROM releases " . $where);
$total = $resrel->rowCount();
if ($total > 0) {
foreach ($resrel as $rowrel) {
$catId = $cat->determineCategory($rowrel['groupid'], $rowrel['searchname']);
if ($rowrel['categoryid'] != $catId) {
if ($rowrel['categories_id'] != $catId) {
if ($update === true) {
$pdo->queryExec(
sprintf("
@@ -94,7 +94,7 @@ function categorizeRelease($where, $update = true, $echooutput = false)
bookinfoid = NULL,
anidbid = NULL,
xxxinfo_id = 0,
categoryid = %d
categories_id = %d
WHERE id = %d",
$catId,
$rowrel['id']
+10 -10
View File
@@ -86,7 +86,7 @@ function preName($argv, $argc)
$where = ' AND groupid = ' . $argv[2];
$why = ' WHERE nzbstatus = 1 AND isrenamed = 0';
} else if ($full === true) {
$why = ' WHERE nzbstatus = 1 AND (isrenamed = 0 OR categoryid between 7000 AND 7999)';
$why = ' WHERE nzbstatus = 1 AND (isrenamed = 0 OR categories_id between 7000 AND 7999)';
} else if ($all === true) {
$why = ' WHERE nzbstatus = 1';
} else {
@@ -94,10 +94,10 @@ function preName($argv, $argc)
}
resetSearchnames();
echo $pdo->log->header(
"SELECT id, name, searchname, fromname, size, groupid, categoryid FROM releases" . $why . $what .
"SELECT id, name, searchname, fromname, size, groupid, categories_id FROM releases" . $why . $what .
$where . ";\n"
);
$res = $pdo->queryDirect("SELECT id, name, searchname, fromname, size, groupid, categoryid FROM releases" . $why . $what . $where);
$res = $pdo->queryDirect("SELECT id, name, searchname, fromname, size, groupid, categories_id FROM releases" . $why . $what . $where);
$total = $res->rowCount();
if ($total > 0) {
$consoletools = new ConsoleTools(['ColorCLI' => $pdo->log]);
@@ -160,14 +160,14 @@ function preName($argv, $argc)
$pdo->queryExec(
sprintf(
"UPDATE releases SET videos_id = 0, tv_episodes_id = 0, imdbid = NULL, musicinfoid = NULL, consoleinfoid = NULL, bookinfoid = NULL, anidbid = NULL, "
. "iscategorized = 1, isrenamed = 1, searchname = %s, categoryid = %d, preid = " . $preid . " WHERE id = %d", $pdo->escapeString($cleanName), $determinedcat, $row['id']
. "iscategorized = 1, isrenamed = 1, searchname = %s, categories_id = %d, preid = " . $preid . " WHERE id = %d", $pdo->escapeString($cleanName), $determinedcat, $row['id']
)
);
} else {
$pdo->queryExec(
sprintf(
"UPDATE releases SET videos_id = 0, tv_episodes_id = 0, imdbid = NULL, musicinfoid = NULL, consoleinfoid = NULL, bookinfoid = NULL, anidbid = NULL, "
. "iscategorized = 1, searchname = %s, categoryid = %d, preid = " . $preid . " WHERE id = %d", $pdo->escapeString($cleanName), $determinedcat, $row['id']
. "iscategorized = 1, searchname = %s, categories_id = %d, preid = " . $preid . " WHERE id = %d", $pdo->escapeString($cleanName), $determinedcat, $row['id']
)
);
}
@@ -181,7 +181,7 @@ function preName($argv, $argc)
$external++;
}
if ($show === 1) {
$oldcatname = $category->getNameByID($row["categoryid"]);
$oldcatname = $category->getNameByID($row["categories_id"]);
$newcatname = $category->getNameByID($determinedcat);
NameFixer::echoChangedReleaseName([
@@ -222,7 +222,7 @@ function preName($argv, $argc)
}
$timestart = TIME();
if (isset($argv[1]) && is_numeric($argv[1])) {
$relcount = catRelease("searchname", "WHERE (iscategorized = 0 OR categoryid = 0010) AND adddate > NOW() - INTERVAL " . $argv[1] . " HOUR", true);
$relcount = catRelease("searchname", "WHERE (iscategorized = 0 OR categories_id = 0010) AND adddate > NOW() - INTERVAL " . $argv[1] . " HOUR", true);
} else if (isset($argv[2]) && preg_match('/\([\d, ]+\)/', $argv[2]) && $full === true) {
$relcount = catRelease("searchname", str_replace(" AND", "WHERE", $where) . " AND iscategorized = 0 ", true);
} else if (isset($argv[2]) && preg_match('/\([\d, ]+\)/', $argv[2]) && $all === true) {
@@ -232,13 +232,13 @@ function preName($argv, $argc)
} else if (isset($argv[2]) && is_numeric($argv[2]) && $argv[1] == "all") {
$relcount = catRelease("searchname", str_replace(" AND", "WHERE", $where), true);
} else if (isset($argv[1]) && $argv[1] == "full") {
$relcount = catRelease("searchname", "WHERE categoryid = 0010 OR iscategorized = 0", true);
$relcount = catRelease("searchname", "WHERE categories_id = 0010 OR iscategorized = 0", true);
} else if (isset($argv[1]) && $argv[1] == "all") {
$relcount = catRelease("searchname", "", true);
} else if (isset($argv[1]) && $argv[1] == "preid") {
$relcount = catRelease("searchname", "WHERE preid = 0 AND nzbstatus = 1", true);
} else {
$relcount = catRelease("searchname", "WHERE (iscategorized = 0 OR categoryid = 0010) AND adddate > NOW() - INTERVAL " . $argv[1] . " HOUR", true);
$relcount = catRelease("searchname", "WHERE (iscategorized = 0 OR categories_id = 0010) AND adddate > NOW() - INTERVAL " . $argv[1] . " HOUR", true);
}
$consoletools = new ConsoleTools(['ColorCLI' => $pdo->log]);
$time = $consoletools->convertTime(TIME() - $timestart);
@@ -284,7 +284,7 @@ function catRelease($type, $where, $echooutput = false)
if ($total > 0) {
foreach ($resrel as $rowrel) {
$catId = $cat->determineCategory($rowrel['groupid'], $rowrel[$type]);
$pdo->queryExec(sprintf("UPDATE releases SET iscategorized = 1, categoryid = %d WHERE id = %d", $catId, $rowrel['id']));
$pdo->queryExec(sprintf("UPDATE releases SET iscategorized = 1, categories_id = %d WHERE id = %d", $catId, $rowrel['id']));
$relcount++;
if ($echooutput) {
$consoletools->overWritePrimary("Categorizing: " . $consoletools->percentString($relcount, $total));
+1 -1
View File
@@ -13,7 +13,7 @@ $rescount = 0;
//
// [1] change for all where the regex isnt aimed at a specific category (affects most releases)
//
//$res = $db->queryDirect("select r.id as id, r.searchname as searchname, g.name as groupname, r.categoryID as rcat from releases r, releaseregex rr, groups g where r.regexid=rr.id and g.ID = r.groupID and rr.categoryid is null");
//$res = $db->queryDirect("select r.id as id, r.searchname as searchname, g.name as groupname, r.categoryID as rcat from releases r, releaseregex rr, groups g where r.regexid=rr.id and g.ID = r.groupID and rr.categories_id is null");
//
// [2] update for all in a category
+3 -3
View File
@@ -31,11 +31,11 @@ function getPreName($argv)
$res = false;
if (isset($argv[1]) && $argv[1] === "all") {
$res = $pdo->queryDirect('SELECT id AS releaseid, name, searchname, groupid, categoryid, dehashstatus FROM releases WHERE preid = 0 AND ishashed = 1');
$res = $pdo->queryDirect('SELECT id AS releaseid, name, searchname, groupid, categories_id, dehashstatus FROM releases WHERE preid = 0 AND ishashed = 1');
} else if (isset($argv[1]) && $argv[1] === "full") {
$res = $pdo->queryDirect('SELECT id AS releaseid, name, searchname, groupid, categoryid, dehashstatus FROM releases WHERE categoryid = 7020 AND ishashed = 1 AND dehashstatus BETWEEN -6 AND 0');
$res = $pdo->queryDirect('SELECT id AS releaseid, name, searchname, groupid, categories_id, dehashstatus FROM releases WHERE categories_id = 7020 AND ishashed = 1 AND dehashstatus BETWEEN -6 AND 0');
} else if (isset($argv[1]) && is_numeric($argv[1])) {
$res = $pdo->queryDirect('SELECT id AS releaseid, name, searchname, groupid, categoryid, dehashstatus FROM releases WHERE categoryid = 7020 AND ishashed = 1 AND dehashstatus BETWEEN -6 AND 0 ORDER BY postdate DESC LIMIT ' . $argv[1]);
$res = $pdo->queryDirect('SELECT id AS releaseid, name, searchname, groupid, categories_id, dehashstatus FROM releases WHERE categories_id = 7020 AND ishashed = 1 AND dehashstatus BETWEEN -6 AND 0 ORDER BY postdate DESC LIMIT ' . $argv[1]);
}
$counter = $counted = $total = 0;
+1 -1
View File
@@ -146,7 +146,7 @@ foreach ($filestoprocess as $nzbFile) {
$regexMatches['regcatid'] = ($categoryoverride != -1 ? $categoryoverride : $regexMatches['regcatid']);
$sql = sprintf("INSERT INTO binaries (name, fromname, date, xref, totalParts, groupid, binaryhash, dateadded,
categoryid, regexid, reqid, procstat, relpart, reltotalpart, relname)
categories_id, regexid, reqid, procstat, relpart, reltotalpart, relname)
values (%s, %s, %s, %s, %d, %d, %s, NOW(), %s, %d, %s, %d, %d, %d, %s )",
$db->escapeString($postFile["subject"]), $db->escapeString($postFile["poster"]),
$db->escapeString(date("Y-m-d H:i:s", $postFile["posted"])),
@@ -173,7 +173,7 @@ do
# $PYTHON -OOu ${THREADED_PATH}/requestid_threaded.py #This is much slower for local lookup, but is faster for remote lookup
# $PHP ${DB_PATH}/populate_nzb_guid.php limited
# $PHP ${DB_PATH}/populate_nzb_guid.php true
## $PYTHON -OOu ${THREADED_PATH}/postprocess_threaded.py additional #you can run per group_id, categoryid or parentid
## $PYTHON -OOu ${THREADED_PATH}/postprocess_threaded.py additional #you can run per group_id, categories_id or parentid
## $PYTHON -OOu ${THREADED_PATH}/postprocess_threaded.py nfo
## $PYTHON -OOu ${THREADED_PATH}/fixreleasenames_threaded.py md5 #fixReleaseNames.php should be used instead
## $PYTHON -OOu ${THREADED_PATH}/fixreleasenames_threaded.py nfo
+4 -4
View File
@@ -18,7 +18,7 @@ if (!isset($argv[1])) {
$pieces = explode(' ', $argv[1]);
if (isset($pieces[1]) && $pieces[0] == 'nfo') {
$release = $pieces[1];
if ($res = $db->queryOneRow(sprintf('SELECT rel.guid AS guid, nfo.releaseid AS nfoid, rel.groupid, rel.categoryid, rel.name, rel.searchname, uncompress(nfo) AS textstring, rel.id AS releaseid FROM releases rel INNER JOIN release_nfos nfo ON (nfo.releaseid = rel.id) WHERE rel.id = %d', $release))) {
if ($res = $db->queryOneRow(sprintf('SELECT rel.guid AS guid, nfo.releaseid AS nfoid, rel.groupid, rel.categories_id, rel.name, rel.searchname, uncompress(nfo) AS textstring, rel.id AS releaseid FROM releases rel INNER JOIN release_nfos nfo ON (nfo.releaseid = rel.id) WHERE rel.id = %d', $release))) {
//ignore encrypted nfos
if (preg_match('/^=newz\[NZB\]=\w+/', $res['textstring'])) {
$namefixer->done = $namefixer->matched = false;
@@ -36,7 +36,7 @@ if (!isset($argv[1])) {
}
} else if (isset($pieces[1]) && $pieces[0] == 'filename') {
$release = $pieces[1];
if ($res = $db->queryOneRow(sprintf('SELECT relfiles.name AS textstring, rel.categoryid, rel.searchname, '
if ($res = $db->queryOneRow(sprintf('SELECT relfiles.name AS textstring, rel.categories_id, rel.searchname, '
. 'rel.groupid, relfiles.releaseid AS fileid, rel.id AS releaseid, rel.name FROM releases rel '
. 'INNER JOIN release_files relfiles ON (relfiles.releaseid = rel.id) WHERE rel.id = %d', $release))) {
$namefixer->done = $namefixer->matched = false;
@@ -47,7 +47,7 @@ if (!isset($argv[1])) {
}
} else if (isset($pieces[1]) && $pieces[0] == 'srr') {
$release = $pieces[1];
if ($res = $db->queryOneRow(sprintf('SELECT relfiles.name AS textstring, rel.categoryid, rel.searchname, '
if ($res = $db->queryOneRow(sprintf('SELECT relfiles.name AS textstring, rel.categories_id, rel.searchname, '
. 'rel.groupid, relfiles.releaseid AS fileid, rel.id AS releaseid, rel.name FROM releases rel '
. 'INNER JOIN release_files relfiles ON (relfiles.releaseid = rel.id) WHERE rel.id = %d', $release))) {
$namefixer->done = $namefixer->matched = false;
@@ -58,7 +58,7 @@ if (!isset($argv[1])) {
}
}else if (isset($pieces[1]) && $pieces[0] == 'md5') {
$release = $pieces[1];
if ($res = $db->queryOneRow(sprintf('SELECT r.id AS releaseid, r.name, r.searchname, r.categoryid, r.groupid, dehashstatus, rf.name AS filename FROM releases r LEFT JOIN release_files rf ON r.id = rf.releaseid WHERE r.id = %d', $release))) {
if ($res = $db->queryOneRow(sprintf('SELECT r.id AS releaseid, r.name, r.searchname, r.categories_id, r.groupid, dehashstatus, rf.name AS filename FROM releases r LEFT JOIN release_files rf ON r.id = rf.releaseid WHERE r.id = %d', $release))) {
if (preg_match('/[a-fA-F0-9]{32,40}/i', $res['name'], $matches)) {
$namefixer->matchPredbHash($matches[0], $res, 1, 1, true, 1);
} else if (preg_match('/[a-fA-F0-9]{32,40}/i', $res['filename'], $matches)) {
@@ -24,7 +24,7 @@ if (!isset($argv[1])) {
case $pieces[0] === 'nfo' && isset($guidChar) && isset($maxperrun) && is_numeric($maxperrun):
$releases = $pdo->queryDirect(
sprintf('
SELECT r.id AS releaseid, r.guid, r.groupid, r.categoryid, r.name, r.searchname,
SELECT r.id AS releaseid, r.guid, r.groupid, r.categories_id, r.name, r.searchname,
uncompress(nfo) AS textstring
FROM releases r
INNER JOIN release_nfos rn ON r.id = rn.releaseid
@@ -64,7 +64,7 @@ if (!isset($argv[1])) {
case $pieces[0] === 'md5' && isset($guidChar) && isset($maxperrun) && is_numeric($maxperrun):
$releases = $pdo->queryDirect(
sprintf('
SELECT DISTINCT r.id AS releaseid, r.name, r.searchname, r.categoryid, r.groupid, r.dehashstatus,
SELECT DISTINCT r.id AS releaseid, r.name, r.searchname, r.categories_id, r.groupid, r.dehashstatus,
rf.name AS filename
FROM releases r
LEFT OUTER JOIN release_files rf ON r.id = rf.releaseid AND rf.ishashed = 1
+1 -1
View File
@@ -41,7 +41,7 @@ $tRun->runPane('scraper', $runVar);
$runVar['panes'] = $tRun->getListOfPanes($runVar['constants']);
//totals per category in db, results by parentid
$catcntqry = "SELECT c.parentid AS parentid, COUNT(r.id) AS count FROM category c, releases r WHERE r.categoryid = c.id GROUP BY c.parentid";
$catcntqry = "SELECT c.parentid AS parentid, COUNT(r.id) AS count FROM category c, releases r WHERE r.categories_id = c.id GROUP BY c.parentid";
//create timers and set to now
$runVar['timers']['timer1'] = $runVar['timers']['timer2'] = $runVar['timers']['timer3'] =
+17 -17
View File
@@ -19,7 +19,7 @@ conf = info.readConfig()
cur = info.connect()
if len(sys.argv) == 1:
print(bcolors.ERROR + "\nWrong set of arguments.\nThe first argument [additional, nfo, movie, clean] determines the postprocessing to do.\nThe optional second argument for [additional, nfo] [group_id, categoryid] allows to process only that group or category.\nThe optional second argument for [movies, tv] [clean] allows processing only properly renamed releases.\n\npython postprocess_threaded.py [additional, nfo] (optional [group_id, categoryid])\npython postprocess_threaded.py [movie, tv] (optional [clean])\n" + bcolors.ENDC)
print(bcolors.ERROR + "\nWrong set of arguments.\nThe first argument [additional, nfo, movie, clean] determines the postprocessing to do.\nThe optional second argument for [additional, nfo] [group_id, categories_id] allows to process only that group or category.\nThe optional second argument for [movies, tv] [clean] allows processing only properly renamed releases.\n\npython postprocess_threaded.py [additional, nfo] (optional [group_id, categories_id])\npython postprocess_threaded.py [movie, tv] (optional [clean])\n" + bcolors.ENDC)
sys.exit()
if len(sys.argv) == 3 and sys.argv[2] == "clean":
print(bcolors.HEADER + "\nPostProcess {} Clean Threaded Started at {}".format(sys.argv[1],datetime.datetime.now().strftime("%H:%M:%S")) + bcolors.ENDC)
@@ -33,38 +33,38 @@ if sys.argv[1] == "additional":
elif sys.argv[1] == "nfo":
print(bcolors.HEADER + "* = hidden NFO, + = NFO, - = no NFO, f = download failed." + bcolors.ENDC)
# You can limit postprocessing for additional and nfo by group_id or categoryid
# You can limit postprocessing for additional and nfo by group_id or categories_id
if len(sys.argv) == 3 and sys.argv[2].isdigit() and len(sys.argv[2]) < 4:
group_id = 'AND group_id = '+sys.argv[2]
print(bcolors.HEADER + "Using group_id "+sys.argv[2] + bcolors.ENDC)
elif len(sys.argv) == 3 and sys.argv[2].isdigit() and len(sys.argv[2]) == 4:
if sys.argv[2] == '1000':
group_id = 'AND categoryid BETWEEN 1000 AND 1999'
group_id = 'AND categories_id BETWEEN 1000 AND 1999'
print(bcolors.HEADER + "Using categoryids 1000-1999" + bcolors.ENDC)
elif sys.argv[2] == '2000':
group_id = 'AND categoryid BETWEEN 2000 AND 2999'
group_id = 'AND categories_id BETWEEN 2000 AND 2999'
print(bcolors.HEADER + "Using categoryids 2000-2999" + bcolors.ENDC)
elif sys.argv[2] == '3000':
group_id = 'AND categoryid BETWEEN 3000 AND 3999'
group_id = 'AND categories_id BETWEEN 3000 AND 3999'
print(bcolors.HEADER + "Using categoryids 3000-3999" + bcolors.ENDC)
elif sys.argv[2] == '4000':
group_id = 'AND categoryid BETWEEN 4000 AND 4999'
group_id = 'AND categories_id BETWEEN 4000 AND 4999'
print(bcolors.HEADER + "Using categoryids 4000-4999" + bcolors.ENDC)
elif sys.argv[2] == '5000':
group_id = 'AND categoryid BETWEEN 5000 AND 5999'
group_id = 'AND categories_id BETWEEN 5000 AND 5999'
print(bcolors.HEADER + "Using categoryids 5000-5999" + bcolors.ENDC)
elif sys.argv[2] == '6000':
group_id = 'AND categoryid BETWEEN 6000 AND 6999'
group_id = 'AND categories_id BETWEEN 6000 AND 6999'
print(bcolors.HEADER + "Using categoryids 6000-6999" + bcolors.ENDC)
elif sys.argv[2] == '7000':
group_id = 'AND categoryid BETWEEN 7000 AND 7999'
group_id = 'AND categories_id BETWEEN 7000 AND 7999'
print(bcolors.HEADER + "Using categoryids 7000-7999" + bcolors.ENDC)
elif sys.argv[2] == '0000':
group_id = 'AND categoryid BETWEEN 0000 AND 0999'
group_id = 'AND categories_id BETWEEN 0000 AND 0999'
print(bcolors.HEADER + "Using categoryids 0000-0999" + bcolors.ENDC)
else:
group_id = 'AND categoryid = '+sys.argv[2]
print(bcolors.HEADER + "Using categoryid "+sys.argv[2] + bcolors.ENDC)
group_id = 'AND categories_id = '+sys.argv[2]
print(bcolors.HEADER + "Using categories_id "+sys.argv[2] + bcolors.ENDC)
else:
group_id = ''
@@ -130,22 +130,22 @@ process_additional = run_threads * ppperrun
process_nfo = run_threads * nfoperrun
if sys.argv[1] == "additional":
cur[0].execute("SELECT LEFT(r.guid, 1) FROM releases r LEFT JOIN category c ON c.id = r.categoryid WHERE r.nzbstatus = 1 "+maxsize+" AND (r.haspreview = -1 AND c.disablepreview = 0) AND r.passwordstatus BETWEEN -6 AND -1 GROUP BY LEFT(r.guid, 1) LIMIT 16")
cur[0].execute("SELECT LEFT(r.guid, 1) FROM releases r LEFT JOIN category c ON c.id = r.categories_id WHERE r.nzbstatus = 1 "+maxsize+" AND (r.haspreview = -1 AND c.disablepreview = 0) AND r.passwordstatus BETWEEN -6 AND -1 GROUP BY LEFT(r.guid, 1) LIMIT 16")
datas = cur[0].fetchall()
elif sys.argv[1] == "nfo":
cur[0].execute("SELECT LEFT(guid, 1) FROM releases WHERE nzbstatus = 1 AND nfostatus BETWEEN -8 AND -1 GROUP BY LEFT(guid, 1) LIMIT 16")
datas = cur[0].fetchall()
elif sys.argv[1] == "movie" and len(sys.argv) == 3 and sys.argv[2] == "clean":
cur[0].execute("SELECT LEFT(guid, 1) FROM releases WHERE nzbstatus = 1 AND isrenamed = 1 AND searchname IS NOT NULL AND imdbid IS NULL AND categoryid BETWEEN 2000 AND 2999 GROUP BY LEFT(guid, 1) "+orderBY+" LIMIT 16")
cur[0].execute("SELECT LEFT(guid, 1) FROM releases WHERE nzbstatus = 1 AND isrenamed = 1 AND searchname IS NOT NULL AND imdbid IS NULL AND categories_id BETWEEN 2000 AND 2999 GROUP BY LEFT(guid, 1) "+orderBY+" LIMIT 16")
datas = cur[0].fetchall()
elif sys.argv[1] == "movie":
cur[0].execute("SELECT LEFT(guid, 1) FROM releases WHERE nzbstatus = 1 AND searchname IS NOT NULL AND imdbid IS NULL AND categoryid BETWEEN 2000 AND 2999 GROUP BY LEFT(guid, 1) "+orderBY+" LIMIT 16")
cur[0].execute("SELECT LEFT(guid, 1) FROM releases WHERE nzbstatus = 1 AND searchname IS NOT NULL AND imdbid IS NULL AND categories_id BETWEEN 2000 AND 2999 GROUP BY LEFT(guid, 1) "+orderBY+" LIMIT 16")
datas = cur[0].fetchall()
elif sys.argv[1] == "tv" and len(sys.argv) == 3 and sys.argv[2] == "clean":
cur[0].execute("SELECT LEFT(guid, 1) FROM releases WHERE nzbstatus = 1 AND isrenamed = 1 AND searchname IS NOT NULL AND videos_id = 0 AND categoryid BETWEEN 5000 AND 5999 GROUP BY LEFT(guid, 1) "+orderBY+" LIMIT 16")
cur[0].execute("SELECT LEFT(guid, 1) FROM releases WHERE nzbstatus = 1 AND isrenamed = 1 AND searchname IS NOT NULL AND videos_id = 0 AND categories_id BETWEEN 5000 AND 5999 GROUP BY LEFT(guid, 1) "+orderBY+" LIMIT 16")
datas = cur[0].fetchall()
elif sys.argv[1] == "tv":
cur[0].execute("SELECT LEFT(guid, 1) FROM releases WHERE nzbstatus = 1 AND searchname IS NOT NULL AND videos_id = 0 AND categoryid BETWEEN 5000 AND 5999 GROUP BY LEFT(guid, 1) "+orderBY+" LIMIT 16")
cur[0].execute("SELECT LEFT(guid, 1) FROM releases WHERE nzbstatus = 1 AND searchname IS NOT NULL AND videos_id = 0 AND categories_id BETWEEN 5000 AND 5999 GROUP BY LEFT(guid, 1) "+orderBY+" LIMIT 16")
datas = cur[0].fetchall()
#close connection to mysql
+2 -2
View File
@@ -39,7 +39,7 @@ if (isset($argv[1]) && isset($argv[2])) {
} else if ($argv[1] == 5 && ($argv[2] == 'true' || $argv[2] == 'false')) {
echo $pdo->log->header("Categorizing all non-categorized releases in other->misc using usenet subject. This can take a while, be patient.");
$timestart = TIME();
$relcount = $releases->categorizeRelease('name', "WHERE iscategorized = 0 AND categoryid = " . Category::OTHER_MISC);
$relcount = $releases->categorizeRelease('name', "WHERE iscategorized = 0 AND categories_id = " . Category::OTHER_MISC);
$time = $consoletools->convertTime(TIME() - $timestart);
echo $pdo->log->primary("\n" . 'Finished categorizing ' . $relcount . ' releases in ' . $time . " seconds, using the usenet subject.");
} else if ($argv[1] == 6 && $argv[2] == 'true') {
@@ -53,7 +53,7 @@ if (isset($argv[1]) && isset($argv[2])) {
echo $pdo->log->header("Categorizing releases in misc sections using the searchname. This can take a while, be patient.");
$timestart = TIME();
$relcount = $releases->categorizeRelease('searchname',
sprintf("WHERE categoryid IN (%s, %s, %s, %s, %s, %s)",
sprintf("WHERE categories_id IN (%s, %s, %s, %s, %s, %s)",
Category::GAME_OTHER,
Category::MOVIE_OTHER,
Category::MUSIC_OTHER,
+8 -8
View File
@@ -178,7 +178,7 @@ class Books
$exccatlist = '';
if (count($excludedcats) > 0) {
$exccatlist = ' AND r.categoryid NOT IN (' . implode(',', $excludedcats) . ')';
$exccatlist = ' AND r.categories_id NOT IN (' . implode(',', $excludedcats) . ')';
}
$order = $this->getBookOrder($orderby);
@@ -389,11 +389,11 @@ class Books
$this->processBookReleasesHelper(
$this->pdo->queryDirect(
sprintf('
SELECT searchname, id, categoryid
SELECT searchname, id, categories_id
FROM releases
WHERE nzbstatus = 1 %s
AND bookinfoid IS NULL
AND categoryid in (%s)
AND categories_id in (%s)
ORDER BY postdate
DESC LIMIT %d', $this->renamed, $bookids[$i], $this->bookqty)
), $bookids[$i]
@@ -413,14 +413,14 @@ class Books
{
if ($res instanceof \Traversable && $res->rowCount() > 0) {
if ($this->echooutput) {
$this->pdo->log->doEcho($this->pdo->log->header("\nProcessing " . $res->rowCount() . ' book release(s) for category id ' . $categoryID));
$this->pdo->log->doEcho($this->pdo->log->header("\nProcessing " . $res->rowCount() . ' book release(s) for categories id ' . $categoryID));
}
foreach ($res as $arr) {
$startTime = microtime(true);
$usedAmazon = false;
// audiobooks are also books and should be handled in an identical manor, even though it falls under a music category
if ($arr['categoryid'] == '3030') {
if ($arr['categories_id'] == '3030') {
// audiobook
$bookInfo = $this->parseTitle($arr['searchname'], $arr['id'], 'audiobook');
} else {
@@ -468,7 +468,7 @@ class Books
}
}
} else if ($this->echooutput) {
$this->pdo->log->doEcho($this->pdo->log->header('No book releases to process for category id ' . $categoryID));
$this->pdo->log->doEcho($this->pdo->log->header('No book releases to process for categories id ' . $categoryID));
}
}
@@ -493,7 +493,7 @@ class Books
$this->pdo->log->headerOver('Changing category to misc books: ') . $this->pdo->log->primary($releasename)
);
}
$this->pdo->queryExec(sprintf('UPDATE releases SET categoryid = %s WHERE id = %d', Category::BOOKS_UNKNOWN, $releaseID));
$this->pdo->queryExec(sprintf('UPDATE releases SET categories_id = %s WHERE id = %d', Category::BOOKS_UNKNOWN, $releaseID));
return false;
} else if (preg_match('/^([a-z0-9ü!]+ ){1,2}(N|Vol)?\d{1,4}(a|b|c)?$|^([a-z0-9]+ ){1,2}(Jan( |unar|$)|Feb( |ruary|$)|Mar( |ch|$)|Apr( |il|$)|May(?![a-z0-9])|Jun( |e|$)|Jul( |y|$)|Aug( |ust|$)|Sep( |tember|$)|O(c|k)t( |ober|$)|Nov( |ember|$)|De(c|z)( |ember|$))/i', $releasename) && !preg_match('/Part \d+/i', $releasename)) {
@@ -502,7 +502,7 @@ class Books
$this->pdo->log->headerOver('Changing category to magazines: ') . $this->pdo->log->primary($releasename)
);
}
$this->pdo->queryExec(sprintf('UPDATE releases SET categoryid = %s WHERE id = %d', Category::BOOKS_MAGAZINES, $releaseID));
$this->pdo->queryExec(sprintf('UPDATE releases SET categories_id = %s WHERE id = %d', Category::BOOKS_MAGAZINES, $releaseID));
return false;
} else if (!empty($releasename) && !preg_match('/^[a-z0-9]+$|^([0-9]+ ){1,}$|Part \d+/i', $releasename)) {
return $releasename;
+1 -1
View File
@@ -65,7 +65,7 @@ class Categorize extends Category
* @param string $releaseName The name to parse.
* @param int|string $groupID The groupid.
*
* @return int The categoryid.
* @return int The categories_id.
*/
public function determineCategory($groupID, $releaseName = '')
{
+17 -17
View File
@@ -147,9 +147,9 @@ class Category
}
if ($chlist != '-99') {
$catsrch .= ' r.categoryid IN (' . $chlist . ') OR ';
$catsrch .= ' r.categories_id IN (' . $chlist . ') OR ';
} else {
$catsrch .= sprintf(' r.categoryid = %d OR ', $category);
$catsrch .= sprintf(' r.categories_id = %d OR ', $category);
}
$catsrch .= '1=2 )';
}
@@ -188,7 +188,7 @@ class Category
public function isParent($cid)
{
$ret = $this->pdo->query(
sprintf("SELECT id FROM category WHERE id = %d AND parentid IS NULL", $cid),
sprintf("SELECT id FROM categories WHERE id = %d AND parentid IS NULL", $cid),
true, NN_CACHE_EXPIRY_LONG
);
return (isset($ret[0]['id']));
@@ -205,7 +205,7 @@ class Category
if ($activeonly) {
$act = sprintf(" WHERE c.status = %d ", Category::STATUS_ACTIVE);
}
return $this->pdo->query("SELECT c.*, (SELECT title FROM category WHERE id=c.parentid) AS parentName FROM category c " . $act . " ORDER BY c.id");
return $this->pdo->query("SELECT c.*, (SELECT title FROM categories WHERE id=c.parentid) AS parentName FROM categories c " . $act . " ORDER BY c.id");
}
/**
@@ -218,7 +218,7 @@ class Category
public function getChildren($cid)
{
return $this->pdo->query(
sprintf("SELECT c.* FROM category c WHERE parentid = %d", $cid),
sprintf("SELECT c.* FROM categories c WHERE parentid = %d", $cid),
true, NN_CACHE_EXPIRY_LONG
);
}
@@ -230,7 +230,7 @@ class Category
public function getEnabledParentNames()
{
return $this->pdo->query(
"SELECT title FROM category WHERE parentid IS NULL AND status = 1",
"SELECT title FROM categories WHERE parentid IS NULL AND status = 1",
true, NN_CACHE_EXPIRY_LONG
);
}
@@ -243,7 +243,7 @@ class Category
public function getDisabledIDs()
{
return $this->pdo->query(
"SELECT id FROM category WHERE status = 2 OR parentid IN (SELECT id FROM category WHERE status = 2 AND parentid IS NULL)",
"SELECT id FROM categories WHERE status = 2 OR parentid IN (SELECT id FROM categories WHERE status = 2 AND parentid IS NULL)",
true, NN_CACHE_EXPIRY_LONG
);
}
@@ -258,13 +258,13 @@ class Category
public function getById($id)
{
return $this->pdo->queryOneRow(sprintf("SELECT c.disablepreview, c.id, c.description, c.minsizetoformrelease, c.maxsizetoformrelease, CONCAT(COALESCE(cp.title,'') , CASE WHEN cp.title IS NULL THEN '' ELSE ' > ' END , c.title) as title, c.status, c.parentid from category c left outer join category cp on cp.id = c.parentid where c.id = %d", $id));
return $this->pdo->queryOneRow(sprintf("SELECT c.disablepreview, c.id, c.description, c.minsizetoformrelease, c.maxsizetoformrelease, CONCAT(COALESCE(cp.title,'') , CASE WHEN cp.title IS NULL THEN '' ELSE ' > ' END , c.title) as title, c.status, c.parentid from categories c left outer join categories cp on cp.id = c.parentid where c.id = %d", $id));
}
public function getSizeRangeById($id)
{
$res = $this->pdo->queryOneRow(sprintf("SELECT c.minsizetoformrelease, c.maxsizetoformrelease, cp.minsizetoformrelease as p_minsizetoformrelease, cp.maxsizetoformrelease as p_maxsizetoformrelease" .
" from category c left outer join category cp on cp.id = c.parentid where c.id = %d", $id
" from categories c left outer join categories cp on cp.id = c.parentid where c.id = %d", $id
)
);
if (!$res)
@@ -316,8 +316,8 @@ class Category
return $this->pdo->query(
sprintf(
"SELECT CONCAT(cp.title, ' > ',c.title) AS title
FROM category c
INNER JOIN category cp ON cp.id = c.parentid
FROM categories c
INNER JOIN categories cp ON cp.id = c.parentid
WHERE c.id IN (%s)", implode(',', $ids)
), true, NN_CACHE_EXPIRY_LONG
);
@@ -328,8 +328,8 @@ class Category
public function getNameByID($ID)
{
$parent = $this->pdo->queryOneRow(sprintf("SELECT title FROM category WHERE id = %d", substr($ID, 0, 1) . "000"));
$cat = $this->pdo->queryOneRow(sprintf("SELECT title FROM category WHERE id = %d", $ID));
$parent = $this->pdo->queryOneRow(sprintf("SELECT title FROM categories WHERE id = %d", substr($ID, 0, 1) . "000"));
$cat = $this->pdo->queryOneRow(sprintf("SELECT title FROM categories WHERE id = %d", $ID));
return $parent["title"] . " " . $cat["title"];
}
@@ -348,7 +348,7 @@ class Category
*/
public function update($id, $status, $desc, $disablepreview, $minsize, $maxsize)
{
return $this->pdo->queryExec(sprintf("update category set disablepreview = %d, status = %d, minsizetoformrelease = %d, maxsizetoformrelease = %d, description = %s where id = %d", $disablepreview, $status, $minsize, $maxsize, $this->pdo->escapeString($desc), $id));
return $this->pdo->queryExec(sprintf("update categories set disablepreview = %d, status = %d, minsizetoformrelease = %d, maxsizetoformrelease = %d, description = %s where id = %d", $disablepreview, $status, $minsize, $maxsize, $this->pdo->escapeString($desc), $id));
}
/**
@@ -366,7 +366,7 @@ class Category
}
$arr = $this->pdo->query(
sprintf('SELECT * FROM category WHERE status = %d %s', Category::STATUS_ACTIVE, $exccatlist),
sprintf('SELECT * FROM categories WHERE status = %d %s', Category::STATUS_ACTIVE, $exccatlist),
true, NN_CACHE_EXPIRY_LONG
);
foreach ($arr as $a) {
@@ -429,8 +429,8 @@ class Category
{
return $this->pdo->query(
"SELECT c.id, CONCAT(cp.title, ' > ',c.title) AS title, cp.id AS parentid, c.status
FROM category c
INNER JOIN category cp ON cp.id = c.parentid " .
FROM categories c
INNER JOIN categories cp ON cp.id = c.parentid " .
($activeonly ?
sprintf(
" WHERE c.status = %d %s ",
+3 -3
View File
@@ -97,7 +97,7 @@ class Console
$this->renamed = 'AND isrenamed = 1';
}
//$this->cleanconsole = ($this->pdo->getSetting('lookupgames') == 2) ? 'AND isrenamed = 1' : '';
$this->catWhere = "AND categoryid BETWEEN " . Category::GAME_ROOT . " AND " . Category::GAME_OTHER;
$this->catWhere = "AND categories_id BETWEEN " . Category::GAME_ROOT . " AND " . Category::GAME_OTHER;
$this->failCache =[];
}
@@ -175,7 +175,7 @@ class Console
$exccatlist = "";
if (count($excludedcats) > 0) {
$exccatlist = " AND r.categoryid NOT IN (" . implode(",", $excludedcats) . ")";
$exccatlist = " AND r.categories_id NOT IN (" . implode(",", $excludedcats) . ")";
}
$order = $this->getConsoleOrder($orderby);
@@ -909,7 +909,7 @@ class Console
array_map("trim", $result);
/* Make sure we got a title and platform otherwise the resulting lookup will probably be shit.
Other option is to pass the $release->categoryid here if we don't find a platform but that
Other option is to pass the $release->categories_id here if we don't find a platform but that
would require an extra lookup to determine the name. In either case we should have a title at the minimum. */
return (isset($result['title']) && !empty($result['title']) && isset($result['platform'])) ? $result : false;
+5 -5
View File
@@ -89,8 +89,8 @@ class DnzbFailures
SELECT r.*, CONCAT(cp.title, ' > ', c.title) AS category_name
FROM releases r
RIGHT JOIN dnzb_failures df ON df.release_id = r.id
LEFT OUTER JOIN category c ON c.id = r.categoryid
LEFT OUTER JOIN category cp ON cp.id = c.parentid
LEFT OUTER JOIN categories c ON c.id = r.categories_id
LEFT OUTER JOIN categories cp ON cp.id = c.parentid
ORDER BY postdate DESC" . $limit
);
}
@@ -106,7 +106,7 @@ class DnzbFailures
{
$rel = $this->pdo->queryOneRow(
sprintf('
SELECT id, searchname, categoryid
SELECT id, searchname, categories_id
FROM releases
WHERE guid = %s',
$this->pdo->escapeString($guid)
@@ -138,11 +138,11 @@ class DnzbFailures
LEFT JOIN dnzb_failures df ON r.id = df.release_id
WHERE r.searchname %s
AND df.release_id IS NULL
AND r.categoryid = %d
AND r.categories_id = %d
AND r.id != %d
ORDER BY r.postdate DESC',
$this->pdo->likeString($rel['searchname'], true, true),
$rel['categoryid'],
$rel['categories_id'],
$rel['id']
)
);
+2 -2
View File
@@ -118,7 +118,7 @@ class Games
if ($this->pdo->getSetting('lookupgames') == 2) {
$this->renamed = 'AND isrenamed = 1';
}
$this->catWhere = 'AND categoryid = ' . Category::PC_GAMES . ' ';
$this->catWhere = 'AND categories_id = ' . Category::PC_GAMES . ' ';
//$this->cleangames = ($this->pdo->getSetting('('lookupgames') == 2) ? 'AND isrenamed = 1' : '';
}
@@ -190,7 +190,7 @@ class Games
$exccatlist = "";
if (count($excludedcats) > 0) {
$exccatlist = " AND r.categoryid NOT IN (" . implode(",", $excludedcats) . ")";
$exccatlist = " AND r.categories_id NOT IN (" . implode(",", $excludedcats) . ")";
}
$order = $this->getGamesOrder($orderby);
+2 -2
View File
@@ -63,7 +63,7 @@ class MiscSorter
public function nfosorter($category = 0, $id = 0)
{
$idarr = ($id != 0 ? sprintf('AND r.id = %d', $id) : '');
$cat = ($category = 0 ? sprintf('AND r.categoryid = %d', Category::OTHER_MISC) : sprintf('AND r.categoryid = %d', $category));
$cat = ($category = 0 ? sprintf('AND r.categories_id = %d', Category::OTHER_MISC) : sprintf('AND r.categories_id = %d', $category));
$res = $this->pdo->queryDirect(
sprintf("
@@ -238,7 +238,7 @@ class MiscSorter
$release = $this->pdo->queryOneRow(
sprintf("
SELECT r.id AS releaseid, r.searchname AS searchname,
r.name AS name, r.categoryid, r.groupid
r.name AS name, r.categories_id, r.groupid
FROM releases r
WHERE r.id = %d",
$id
+4 -4
View File
@@ -167,7 +167,7 @@ class Movie
$this->echooutput = ($options['Echo'] && NN_ECHOCLI && $this->pdo->cli);
$this->imgSavePath = NN_COVERS . 'movies' . DS;
$this->service = '';
$this->catWhere = 'AND categoryid BETWEEN ' . Category::MOVIE_ROOT . ' AND ' . Category::MOVIE_OTHER;
$this->catWhere = 'AND categories_id BETWEEN ' . Category::MOVIE_ROOT . ' AND ' . Category::MOVIE_OTHER;
if (NN_DEBUG || NN_LOGGING) {
$this->debug = true;
@@ -292,7 +292,7 @@ class Movie
? 'AND r.postdate > NOW() - INTERVAL ' . $maxAge . 'DAY '
: ''
),
(count($excludedCats) > 0 ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : ''),
(count($excludedCats) > 0 ? ' AND r.categories_id NOT IN (' . implode(',', $excludedCats) . ')' : ''),
$order[0],
$order[1],
($start === false ? '' : ' LIMIT ' . $num . ' OFFSET ' . $start)
@@ -332,8 +332,8 @@ class Movie
LEFT OUTER JOIN groups g ON g.id = r.groupid
LEFT OUTER JOIN release_nfos rn ON rn.releaseid = r.id
LEFT OUTER JOIN dnzb_failures df ON df.release_id = r.id
LEFT OUTER JOIN category c ON c.id = r.categoryid
LEFT OUTER JOIN category cp ON cp.id = c.parentid
LEFT OUTER JOIN categories c ON c.id = r.categories_id
LEFT OUTER JOIN categories cp ON cp.id = c.parentid
INNER JOIN movieinfo m ON m.imdbid = r.imdbid
WHERE m.imdbid IN (%s)
AND r.id IN (%s) %s
+2 -2
View File
@@ -189,7 +189,7 @@ class Music
$exccatlist = "";
if (count($excludedcats) > 0) {
$exccatlist = " AND r.categoryid NOT IN (" . implode(",", $excludedcats) . ")";
$exccatlist = " AND r.categories_id NOT IN (" . implode(",", $excludedcats) . ")";
}
$order = $this->getMusicOrder($orderby);
@@ -681,7 +681,7 @@ class Music
FROM releases
WHERE musicinfoid IS NULL
AND nzbstatus = 1 %s
AND categoryid IN (%s, %s, %s)
AND categories_id IN (%s, %s, %s)
ORDER BY postdate DESC
LIMIT %d',
$this->renamed,
+1 -1
View File
@@ -420,7 +420,7 @@ class NZBImport
'postdate' => $this->pdo->escapeString($nzbDetails['postDate']),
'fromname' => $escapedFromName,
'size' => $this->pdo->escapeString($nzbDetails['totalSize']),
'categoryid' => $this->category->determineCategory($nzbDetails['group_id'], $cleanName),
'categories_id' => $this->category->determineCategory($nzbDetails['group_id'], $cleanName),
'isrenamed' => $renamed,
'reqidstatus' => 0,
'preid' => 0,
+13 -13
View File
@@ -157,9 +157,9 @@ class NameFixer
$this->relid = $this->fixed = $this->checked = 0;
$this->pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings());
$this->othercats = implode(",", Category::OTHERS_GROUP);
$this->timeother = sprintf(' AND rel.adddate > (NOW() - INTERVAL 6 HOUR) AND rel.categoryid IN (%s) GROUP BY rel.id ORDER BY postdate DESC', $this->othercats);
$this->timeother = sprintf(' AND rel.adddate > (NOW() - INTERVAL 6 HOUR) AND rel.categories_id IN (%s) GROUP BY rel.id ORDER BY postdate DESC', $this->othercats);
$this->timeall = ' AND rel.adddate > (NOW() - INTERVAL 6 HOUR) GROUP BY rel.id ORDER BY postdate DESC';
$this->fullother = sprintf(' AND rel.categoryid IN (%s) GROUP BY rel.id', $this->othercats);
$this->fullother = sprintf(' AND rel.categories_id IN (%s) GROUP BY rel.id', $this->othercats);
$this->fullall = '';
$this->_fileName = '';
$this->done = $this->matched = false;
@@ -202,7 +202,7 @@ class NameFixer
SELECT rel.id AS releaseid
FROM releases rel
INNER JOIN release_nfos nfo ON (nfo.releaseid = rel.id)
WHERE (rel.isrenamed = %d OR rel.categoryid = %d)
WHERE (rel.isrenamed = %d OR rel.categories_id = %d)
AND rel.proc_nfo = %d',
self::IS_RENAMED_NONE,
Category::OTHER_MISC,
@@ -222,7 +222,7 @@ class NameFixer
foreach ($releases as $rel) {
$releaseRow = $this->pdo->queryOneRow(
sprintf('
SELECT nfo.releaseid AS nfoid, rel.groupid, rel.categoryid, rel.name, rel.searchname,
SELECT nfo.releaseid AS nfoid, rel.groupid, rel.categories_id, rel.name, rel.searchname,
UNCOMPRESS(nfo) AS textstring, rel.id AS releaseid
FROM releases rel
INNER JOIN release_nfos nfo ON (nfo.releaseid = rel.id)
@@ -279,7 +279,7 @@ class NameFixer
$preId = false;
if ($cats === 3) {
$query = sprintf('
SELECT rf.name AS textstring, rel.categoryid, rel.name, rel.searchname, rel.groupid,
SELECT rf.name AS textstring, rel.categories_id, rel.name, rel.searchname, rel.groupid,
rf.releaseid AS fileid, rel.id AS releaseid
FROM releases rel
INNER JOIN release_files rf ON (rf.releaseid = rel.id)
@@ -291,11 +291,11 @@ class NameFixer
$preId = true;
} else {
$query = sprintf('
SELECT rf.name AS textstring, rel.categoryid, rel.name, rel.searchname, rel.groupid,
SELECT rf.name AS textstring, rel.categories_id, rel.name, rel.searchname, rel.groupid,
rf.releaseid AS fileid, rel.id AS releaseid
FROM releases rel
INNER JOIN release_files rf ON (rf.releaseid = rel.id)
WHERE (rel.isrenamed = %d OR rel.categoryid IN (%s))
WHERE (rel.isrenamed = %d OR rel.categories_id IN (%s))
AND rel.preid = 0
AND rel.proc_files = %d
%s %s',
@@ -360,7 +360,7 @@ class NameFixer
$query = sprintf('
SELECT rel.id AS releaseid, rel.guid, rel.groupid
FROM releases rel
WHERE (rel.isrenamed = %d OR rel.categoryid IN (%s))
WHERE (rel.isrenamed = %d OR rel.categories_id IN (%s))
AND preid = 0
AND proc_srr = %d',
self::IS_RENAMED_NONE,
@@ -622,7 +622,7 @@ class NameFixer
if ($this->echooutput === true && $show === 1) {
$groupName = $this->_groups->getByNameByID($release['groupid']);
$oldCatName = $this->category->getNameByID($release['categoryid']);
$oldCatName = $this->category->getNameByID($release['categories_id']);
$newCatName = $this->category->getNameByID($determinedCategory);
if ($type === "PAR2, ") {
@@ -692,7 +692,7 @@ class NameFixer
UPDATE releases
SET videos_id = 0, tv_episodes_id = 0, imdbid = NULL, musicinfoid = NULL,
consoleinfoid = NULL, bookinfoid = NULL, anidbid = NULL, preid = %d,
searchname = %s, %s categoryid = %d
searchname = %s, %s categories_id = %d
WHERE id = %d',
$preId,
$newTitle,
@@ -709,7 +709,7 @@ class NameFixer
UPDATE releases
SET videos_id = 0, tv_episodes_id = 0, imdbid = NULL, musicinfoid = NULL,
consoleinfoid = NULL, bookinfoid = NULL, anidbid = NULL, preid = %d,
searchname = %s, iscategorized = 1, categoryid = %d
searchname = %s, iscategorized = 1, categories_id = %d
WHERE id = %d',
$preId,
$newTitle,
@@ -777,7 +777,7 @@ class NameFixer
$res = $this->pdo->queryDirect(
sprintf("
SELECT r.id AS releaseid, r.name, r.searchname,
r.groupid, r.categoryid
r.groupid, r.categories_id
FROM releases r
%1\$s
AND (r.name %2\$s OR r.searchname %2\$s)
@@ -856,7 +856,7 @@ class NameFixer
$query = $this->pdo->queryDirect(
sprintf('
SELECT r.id AS releaseid, r.name, r.searchname,
r.groupid, r.categoryid,
r.groupid, r.categories_id,
rf.name AS filename
FROM releases r
INNER JOIN release_files rf ON r.id = rf.releaseid
+3 -3
View File
@@ -174,7 +174,7 @@ Class PreDb
}
$ct = '';
if ($cats == 1) {
$ct = sprintf('AND r.categoryid IN (%s)', $othercats);
$ct = sprintf('AND r.categories_id IN (%s)', $othercats);
}
if ($this->echooutput) {
@@ -187,12 +187,12 @@ Class PreDb
$regex = "AND (r.ishashed = 1 OR rf.ishashed = 1)";
if ($cats === 3) {
$query = sprintf('SELECT r.id AS releaseid, r.name, r.searchname, r.categoryid, r.groupid, '
$query = sprintf('SELECT r.id AS releaseid, r.name, r.searchname, r.categories_id, r.groupid, '
. 'dehashstatus, rf.name AS filename FROM releases r '
. 'LEFT OUTER JOIN release_files rf ON r.id = rf.releaseid '
. 'WHERE nzbstatus = 1 AND dehashstatus BETWEEN -6 AND 0 AND preid = 0 %s', $regex);
} else {
$query = sprintf('SELECT r.id AS releaseid, r.name, r.searchname, r.categoryid, r.groupid, '
$query = sprintf('SELECT r.id AS releaseid, r.name, r.searchname, r.categories_id, r.groupid, '
. 'dehashstatus, rf.name AS filename FROM releases r '
. 'LEFT OUTER JOIN release_files rf ON r.id = rf.releaseid '
. 'WHERE nzbstatus = 1 AND isrenamed = 0 AND dehashstatus BETWEEN -6 AND 0 %s %s %s', $regex, $ct, $tq);
+13 -13
View File
@@ -53,7 +53,7 @@ Class RSS
{
$catSearch = $cartSearch = '';
$catLimit = "AND r.categoryid BETWEEN ' . Category::MOVIE_ROOT . ' AND ' . Category::MOVIE_OTHER . '";
$catLimit = "AND r.categories_id BETWEEN ' . Category::MOVIE_ROOT . ' AND ' . Category::MOVIE_OTHER . '";
if (count($cat)) {
if ($cat[0] == -2) {
@@ -77,8 +77,8 @@ Class RSS
co.publisher AS co_publisher, co.releasedate AS co_releasedate,
co.review AS co_review, co.cover AS co_cover, cog.title AS co_genre
FROM releases r
INNER JOIN category c ON c.id = r.categoryid
INNER JOIN category cp ON cp.id = c.parentid
INNER JOIN categories c ON c.id = r.categories_id
INNER JOIN categories cp ON cp.id = c.parentid
INNER JOIN groups g ON g.id = r.groupid
LEFT OUTER JOIN movieinfo m ON m.imdbid = r.imdbid AND m.title != ''
LEFT OUTER JOIN musicinfo mu ON mu.id = r.musicinfoid
@@ -123,20 +123,20 @@ Class RSS
%s AS category_ids,
COALESCE(cp.id,0) AS parentCategoryid
FROM releases r
INNER JOIN category c ON c.id = r.categoryid
INNER JOIN category cp ON cp.id = c.parentid
INNER JOIN categories c ON c.id = r.categories_id
INNER JOIN categories cp ON cp.id = c.parentid
INNER JOIN groups g ON g.id = r.groupid
LEFT OUTER JOIN videos v ON v.id = r.videos_id
LEFT OUTER JOIN tv_episodes tve ON tve.id = r.tv_episodes_id
WHERE %s %s %s
AND r.nzbstatus = %d
AND r.categoryid BETWEEN %d AND %d
AND r.categories_id BETWEEN %d AND %d
AND r.passwordstatus %s
ORDER BY postdate DESC %s",
$this->releases->getConcatenatedCategoryIDs(),
$this->releases->uSQL($this->pdo->query(sprintf('SELECT videos_id, categoryid FROM user_series WHERE userid = %d', $userID), true), 'videos_id'),
(count($excludedCats) ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : ''),
$this->releases->uSQL($this->pdo->query(sprintf('SELECT videos_id, categories_id FROM user_series WHERE userid = %d', $userID), true), 'videos_id'),
(count($excludedCats) ? ' AND r.categories_id NOT IN (' . implode(',', $excludedCats) . ')' : ''),
($airDate > -1 ? sprintf(' AND tve.firstaired >= DATE_SUB(CURDATE(), INTERVAL %d DAY) ', $airDate) : ''),
NZB::NZB_ADDED,
Category::TV_ROOT,
@@ -166,18 +166,18 @@ Class RSS
%s AS category_ids,
COALESCE(cp.id,0) AS parentCategoryid
FROM releases r
INNER JOIN category c ON c.id = r.categoryid
INNER JOIN category cp ON cp.id = c.parentid
INNER JOIN categories c ON c.id = r.categories_id
INNER JOIN categories cp ON cp.id = c.parentid
INNER JOIN groups g ON g.id = r.groupid
LEFT OUTER JOIN movieinfo mi ON mi.imdbid = r.imdbid
WHERE %s %s
AND r.nzbstatus = %d
AND r.categoryid BETWEEN ' . Category::MOVIE_ROOT . ' AND ' . Category::MOVIE_OTHER . '
AND r.categories_id BETWEEN ' . Category::MOVIE_ROOT . ' AND ' . Category::MOVIE_OTHER . '
AND r.passwordstatus %s
ORDER BY postdate DESC %s",
$this->releases->getConcatenatedCategoryIDs(),
$this->releases->uSQL($this->pdo->query(sprintf('SELECT imdbid, categoryid FROM user_movies WHERE userid = %d', $userID), true), 'imdbid'),
(count($excludedCats) ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : ''),
$this->releases->uSQL($this->pdo->query(sprintf('SELECT imdbid, categories_id FROM user_movies WHERE userid = %d', $userID), true), 'imdbid'),
(count($excludedCats) ? ' AND r.categories_id NOT IN (' . implode(',', $excludedCats) . ')' : ''),
NZB::NZB_ADDED,
$this->releases->showPasswords,
(' LIMIT ' . ($limit > 100 ? 100 : $limit) . ' OFFSET 0')
+10 -10
View File
@@ -347,7 +347,7 @@ class ReleaseRemover
WHERE r.nfostatus = 0
AND r.iscategorized = 1
AND r.rarinnerfilecount = 0
AND r.categoryid NOT IN (%d)
AND r.categories_id NOT IN (%d)
AND r.searchname REGEXP '^[a-zA-Z0-9]{15,}$'
%s",
Category::OTHER_HASHED,
@@ -375,7 +375,7 @@ class ReleaseRemover
WHERE r.nfostatus = 0
AND r.iscategorized = 1
AND r.rarinnerfilecount = 0
AND r.categoryid NOT IN (%d, %d)
AND r.categories_id NOT IN (%d, %d)
AND r.searchname REGEXP '[a-zA-Z0-9]{25,}'
%s",
Category::OTHER_MISC, Category::OTHER_HASHED, $this->crapTime
@@ -402,7 +402,7 @@ class ReleaseRemover
WHERE r.nfostatus = 0
AND r.iscategorized = 1
AND r.rarinnerfilecount = 0
AND r.categoryid NOT IN (%d)
AND r.categories_id NOT IN (%d)
AND r.searchname REGEXP '^[a-zA-Z0-9]{0,5}$'
%s",
Category::OTHER_MISC, $this->crapTime
@@ -449,7 +449,7 @@ class ReleaseRemover
STRAIGHT_JOIN release_files rf ON r.id = rf.releaseid
WHERE r.searchname NOT REGEXP %s
AND rf.name %s
AND r.categoryid NOT IN (%d, %d, %d, %d, %d, %d) %s %s",
AND r.categories_id NOT IN (%d, %d, %d, %d, %d, %d) %s %s",
$ftJoin,
$this->pdo->escapeString('\.exe[sc]'),
$this->pdo->likeString('.exe', true, false),
@@ -577,7 +577,7 @@ class ReleaseRemover
AND r.searchname NOT %s
AND r.searchname NOT %s
AND r.nzbstatus = 1
AND r.categoryid NOT IN (%d, %d, %d, %d, %d, %d, %d, %d, %d) %s %s",
AND r.categories_id NOT IN (%d, %d, %d, %d, %d, %d, %d, %d, %d) %s %s",
// Matches passwort / passworded / etc also.
$ftJoin,
$this->pdo->likeString('passwor', true, true),
@@ -620,7 +620,7 @@ class ReleaseRemover
FROM releases r
WHERE r.totalpart = 1
AND r.size < 2097152
AND r.categoryid NOT IN (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d) %s",
AND r.categories_id NOT IN (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d) %s",
Category::MUSIC_MP3,
Category::BOOKS_COMICS,
Category::BOOKS_EBOOK,
@@ -691,7 +691,7 @@ class ReleaseRemover
WHERE r.totalpart > 1
AND r.size < 40000000
AND r.name %s
AND r.categoryid IN (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d) %s %s",
AND r.categories_id IN (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d) %s %s",
$ftJoin,
$this->pdo->likeString('sample', true, true),
Category::TV_ANIME,
@@ -1013,7 +1013,7 @@ class ReleaseRemover
SELECT r.guid, r.searchname
FROM releases r
LEFT JOIN release_files rf ON (r.id = rf.releaseid)
WHERE r.categoryid BETWEEN ' . Category::TV_ROOT . ' AND ' . Category::TV_OTHER . '
WHERE r.categories_id BETWEEN ' . Category::TV_ROOT . ' AND ' . Category::TV_OTHER . '
AND rf.name REGEXP 'x264.*\.wmv$'
GROUP BY r.id"
;
@@ -1033,7 +1033,7 @@ class ReleaseRemover
*/
protected function removeCodecPoster()
{
$categories = sprintf("r.categoryid IN (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)",
$categories = sprintf("r.categories_id IN (%d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)",
Category::MOVIE_3D,
Category::MOVIE_BLURAY,
Category::MOVIE_DVD,
@@ -1157,7 +1157,7 @@ class ReleaseRemover
$args[1] = $this->cleanSpaces($args[1]);
$args[2] = $this->cleanSpaces($args[2]);
switch ($args[0]) {
case 'categoryid':
case 'categories_id':
switch ($args[1]) {
case 'equals':
return ' AND categoryID = ' . $args[2];
+69 -69
View File
@@ -78,7 +78,7 @@ class Releases
sprintf(
"INSERT INTO releases
(name, searchname, totalpart, groupid, adddate, guid, postdate, fromname,
size, passwordstatus, haspreview, categoryid, nfostatus, nzbstatus,
size, passwordstatus, haspreview, categories_id, nfostatus, nzbstatus,
isrenamed, iscategorized, reqidstatus, preid)
VALUES (%s, %s, %d, %d, NOW(), %s, %s, %s, %s, %d, -1, %d, -1, %d, %d, 1, %d, %d)",
$parameters['name'],
@@ -90,7 +90,7 @@ class Releases
$parameters['fromname'],
$parameters['size'],
$this->passwordStatus,
$parameters['categoryid'],
$parameters['categories_id'],
$parameters['nzbstatus'],
$parameters['isrenamed'],
$parameters['reqidstatus'],
@@ -119,7 +119,7 @@ class Releases
sprintf(
'SELECT r.*, g.name AS group_name, c.title AS category_name
FROM releases r
INNER JOIN category c ON c.id = r.categoryid
INNER JOIN categories c ON c.id = r.categories_id
INNER JOIN groups g ON g.id = r.groupid
WHERE r.nzbstatus = %d',
NZB::NZB_ADDED
@@ -141,8 +141,8 @@ class Releases
sprintf(
"SELECT r.*, CONCAT(cp.title, ' > ', c.title) AS category_name
FROM releases r
INNER JOIN category c ON c.id = r.categoryid
INNER JOIN category cp ON cp.id = c.parentid
INNER JOIN categories c ON c.id = r.categories_id
INNER JOIN categories cp ON cp.id = c.parentid
WHERE r.nzbstatus = %d
ORDER BY r.postdate DESC %s",
NZB::NZB_ADDED,
@@ -177,7 +177,7 @@ class Releases
($groupName != '' ? sprintf(' AND g.name = %s', $this->pdo->escapeString($groupName)) : ''),
$this->categorySQL($cat),
($maxAge > 0 ? (' AND r.postdate > NOW() - INTERVAL ' . $maxAge . ' DAY ') : ''),
(count($excludedCats) ? (' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')') : '')
(count($excludedCats) ? (' AND r.categories_id NOT IN (' . implode(',', $excludedCats) . ')') : '')
)
);
}
@@ -218,8 +218,8 @@ class Releases
%s %s %s %s
ORDER BY %s %s %s
) r
INNER JOIN category c ON c.id = r.categoryid
INNER JOIN category cp ON cp.id = c.parentid
INNER JOIN categories c ON c.id = r.categories_id
INNER JOIN categories cp ON cp.id = c.parentid
LEFT OUTER JOIN videos v ON r.videos_id = v.id
LEFT OUTER JOIN tv_episodes tve ON r.tv_episodes_id = tve.id
LEFT OUTER JOIN video_data re ON re.releaseid = r.id
@@ -231,7 +231,7 @@ class Releases
$this->showPasswords,
$this->categorySQL($cat),
($maxAge > 0 ? (" AND postdate > NOW() - INTERVAL " . $maxAge . ' DAY ') : ''),
(count($excludedCats) ? (' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')') : ''),
(count($excludedCats) ? (' AND r.categories_id NOT IN (' . implode(',', $excludedCats) . ')') : ''),
($groupName != '' ? sprintf(' AND g.name = %s ', $this->pdo->escapeString($groupName)) : ''),
$orderBy[0],
$orderBy[1],
@@ -279,7 +279,7 @@ class Releases
$orderArr = explode('_', ($orderBy == '' ? 'posted_desc' : $orderBy));
switch ($orderArr[0]) {
case 'cat':
$orderField = 'categoryid';
$orderField = 'categories_id';
break;
case 'name':
$orderField = 'searchname';
@@ -337,11 +337,11 @@ class Releases
{
return $this->pdo->query(
sprintf(
"SELECT searchname, guid, groups.name AS gname, CONCAT(cp.title,'_',category.title) AS catName
"SELECT searchname, guid, groups.name AS gname, CONCAT(cp.title,'_',categories.title) AS catName
FROM releases r
INNER JOIN category ON r.categoryid = category.id
INNER JOIN categories ON r.categories_id = categories.id
INNER JOIN groups ON r.groupid = groups.id
INNER JOIN category cp ON cp.id = category.parentid
INNER JOIN categories cp ON cp.id = categories.parentid
WHERE r.nzbstatus = %d
%s %s %s",
NZB::NZB_ADDED,
@@ -448,7 +448,7 @@ class Releases
{
if (is_null($this->concatenatedCategoryIDsCache)) {
$result = $this->pdo->query(
"SELECT CONCAT(cp.id, ',', c.id) AS category_ids FROM category c INNER JOIN category cp ON cp.id = c.parentid",
"SELECT CONCAT(cp.id, ',', c.id) AS category_ids FROM categories c INNER JOIN categories cp ON cp.id = c.parentid",
true, NN_CACHE_EXPIRY_LONG
);
if (isset($result[0]['category_ids'])) {
@@ -487,19 +487,19 @@ class Releases
INNER JOIN groups ON groups.id = r.groupid
LEFT OUTER JOIN release_nfos rn ON rn.releaseid = r.id
LEFT OUTER JOIN tv_episodes tve ON tve.videos_id = r.videos_id
INNER JOIN category c ON c.id = r.categoryid
INNER JOIN category cp ON cp.id = c.parentid
INNER JOIN categories c ON c.id = r.categories_id
INNER JOIN categories cp ON cp.id = c.parentid
LEFT OUTER JOIN dnzb_failures df ON df.release_id = r.id
WHERE %s %s
AND r.nzbstatus = %d
AND r.categoryid BETWEEN " . Category::TV_ROOT . " AND " . Category::TV_OTHER . "
AND r.categories_id BETWEEN " . Category::TV_ROOT . " AND " . Category::TV_OTHER . "
AND r.passwordstatus %s
%s
GROUP BY r.id
ORDER BY %s %s %s",
$this->getConcatenatedCategoryIDs(),
$this->uSQL($userShows, 'videos_id'),
(count($excludedCats) ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : ''),
(count($excludedCats) ? ' AND r.categories_id NOT IN (' . implode(',', $excludedCats) . ')' : ''),
NZB::NZB_ADDED,
$this->showPasswords,
($maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : ''),
@@ -527,11 +527,11 @@ class Releases
FROM releases r
WHERE %s %s
AND r.nzbstatus = %d
AND r.categoryid BETWEEN " . Category::TV_ROOT . " AND " . Category::TV_OTHER . "
AND r.categories_id BETWEEN " . Category::TV_ROOT . " AND " . Category::TV_OTHER . "
AND r.passwordstatus %s
%s',
$this->uSQL($userShows, 'videos_id'),
(count($excludedCats) ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : ''),
(count($excludedCats) ? ' AND r.categories_id NOT IN (' . implode(',', $excludedCats) . ')' : ''),
NZB::NZB_ADDED,
$this->showPasswords,
($maxAge > 0 ? sprintf(' AND r.postdate > NOW() - INTERVAL %d DAY ', $maxAge) : '')
@@ -644,7 +644,7 @@ class Releases
$this->pdo->queryExec(
sprintf(
'UPDATE releases
SET name = %s, searchname = %s, fromname = %s, categoryid = %d,
SET name = %s, searchname = %s, fromname = %s, categories_id = %d,
totalpart = %d, grabs = %d, size = %s, postdate = %s, adddate = %s, videos_id = %d,
tv_episodes_id = %s, imdbid = %d, anidbid = %d
WHERE id = %d',
@@ -685,7 +685,7 @@ class Releases
}
$update = [
'categoryid' => (($category == '-1') ? 'categoryid' : $category),
'categories_id' => (($category == '-1') ? 'categories_id' : $category),
'grabs' => $grabs,
'videos_id' => $videoId,
'tv_episodes_id' => $episodeId,
@@ -731,12 +731,12 @@ class Releases
$sql = '(1=2 ';
foreach ($userQuery as $query) {
$sql .= sprintf('OR (r.%s = %d', $type, $query[$type]);
if ($query['categoryid'] != '') {
$catsArr = explode('|', $query['categoryid']);
if ($query['categories_id'] != '') {
$catsArr = explode('|', $query['categories_id']);
if (count($catsArr) > 1) {
$sql .= sprintf(' AND r.categoryid IN (%s)', implode(',', $catsArr));
$sql .= sprintf(' AND r.categories_id IN (%s)', implode(',', $catsArr));
} else {
$sql .= sprintf(' AND r.categoryid = %d', $catsArr[0]);
$sql .= sprintf(' AND r.categories_id = %d', $catsArr[0]);
}
}
$sql .= ') ';
@@ -769,10 +769,10 @@ class Releases
}
if ($childList != '-99') {
$sql .= ' r.categoryid IN (' . $childList . ') OR ';
$sql .= ' r.categories_id IN (' . $childList . ') OR ';
}
} else {
$sql .= sprintf(' r.categoryid = %d OR ', $category);
$sql .= sprintf(' r.categories_id = %d OR ', $category);
}
}
}
@@ -874,10 +874,10 @@ class Releases
(array_key_exists($sizeTo, $sizeRange) ? ' AND r.size < ' . (string)(104857600 * (int)$sizeRange[$sizeTo]) . ' ' : ''),
($hasNfo != 0 ? ' AND r.nfostatus = 1 ' : ''),
($hasComments != 0 ? ' AND r.comments > 0 ' : ''),
($type !== 'advanced' ? $this->categorySQL($cat) : ($cat[0] != '-1' ? sprintf(' AND (r.categoryid = %d) ', $cat[0]) : '')),
($type !== 'advanced' ? $this->categorySQL($cat) : ($cat[0] != '-1' ? sprintf(' AND (r.categories_id = %d) ', $cat[0]) : '')),
($daysNew != -1 ? sprintf(' AND r.postdate < (NOW() - INTERVAL %d DAY) ', $daysNew) : ''),
($daysOld != -1 ? sprintf(' AND r.postdate > (NOW() - INTERVAL %d DAY) ', $daysOld) : ''),
(count($excludedCats) > 0 ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : ''),
(count($excludedCats) > 0 ? ' AND r.categories_id NOT IN (' . implode(',', $excludedCats) . ')' : ''),
(count($searchOptions) > 0 ? $this->releaseSearch->getSearchSQL($searchOptions) : '')
);
@@ -898,8 +898,8 @@ class Releases
LEFT OUTER JOIN tv_episodes tve ON r.tv_episodes_id = tve.id
LEFT OUTER JOIN release_nfos rn ON rn.releaseid = r.id
INNER JOIN groups ON groups.id = r.groupid
INNER JOIN category c ON c.id = r.categoryid
INNER JOIN category cp ON cp.id = c.parentid
INNER JOIN categories c ON c.id = r.categories_id
INNER JOIN categories cp ON cp.id = c.parentid
LEFT OUTER JOIN dnzb_failures df ON df.release_id = r.id
%s",
$this->getConcatenatedCategoryIDs(),
@@ -955,7 +955,7 @@ class Releases
$whereSql = sprintf(
"%s
WHERE r.categoryid BETWEEN " . Category::TV_ROOT . " AND " . Category::TV_OTHER . "
WHERE r.categories_id BETWEEN " . Category::TV_ROOT . " AND " . Category::TV_OTHER . "
AND v.type = 0
AND r.nzbstatus = %d
AND r.passwordstatus %s
@@ -988,11 +988,11 @@ class Releases
LEFT OUTER JOIN videos v ON r.videos_id = v.id
LEFT OUTER JOIN tv_info tvi ON v.id = tvi.videos_id
LEFT OUTER JOIN tv_episodes tve ON r.tv_episodes_id = tve.id
INNER JOIN category c ON c.id = r.categoryid
INNER JOIN categories c ON c.id = r.categories_id
INNER JOIN groups ON groups.id = r.groupid
LEFT OUTER JOIN video_data re ON re.releaseid = r.id
LEFT OUTER JOIN release_nfos rn ON rn.releaseid = r.id
INNER JOIN category cp ON cp.id = c.parentid
INNER JOIN categories cp ON cp.id = c.parentid
%s",
$this->getConcatenatedCategoryIDs(),
$whereSql
@@ -1046,11 +1046,11 @@ class Releases
rn.id AS nfoid,
re.releaseid AS reid
FROM releases r
INNER JOIN category c ON c.id = r.categoryid
INNER JOIN categories c ON c.id = r.categories_id
INNER JOIN groups ON groups.id = r.groupid
LEFT OUTER JOIN release_nfos rn ON rn.releaseid = r.id
LEFT OUTER JOIN releaseextrafull re ON re.releaseid = r.id
INNER JOIN category cp ON cp.id = c.parentid
INNER JOIN categories cp ON cp.id = c.parentid
%s",
$this->getConcatenatedCategoryIDs(),
$whereSql
@@ -1083,7 +1083,7 @@ class Releases
{
$whereSql = sprintf(
"%s
WHERE r.categoryid BETWEEN " . Category::MOVIE_ROOT . " AND " . Category::MOVIE_OTHER . "
WHERE r.categories_id BETWEEN " . Category::MOVIE_ROOT . " AND " . Category::MOVIE_OTHER . "
AND r.nzbstatus = %d
AND r.passwordstatus %s
%s %s %s %s",
@@ -1104,9 +1104,9 @@ class Releases
rn.id AS nfoid
FROM releases r
INNER JOIN groups g ON g.id = r.groupid
INNER JOIN category c ON c.id = r.categoryid
INNER JOIN categories c ON c.id = r.categories_id
LEFT OUTER JOIN release_nfos rn ON rn.releaseid = r.id
INNER JOIN category cp ON cp.id = c.parentid
INNER JOIN categories cp ON cp.id = c.parentid
%s",
$this->getConcatenatedCategoryIDs(),
$whereSql
@@ -1156,7 +1156,7 @@ class Releases
{
// Get the category for the parent of this release.
$currRow = $this->getById($currentID);
$catRow = (new Category(['Settings' => $this->pdo]))->getById($currRow['categoryid']);
$catRow = (new Category(['Settings' => $this->pdo]))->getById($currRow['categories_id']);
$parentCat = $catRow['parentid'];
$results = $this->search(
@@ -1211,8 +1211,8 @@ class Releases
tve.title, tve.firstaired, tve.se_complete
FROM releases r
INNER JOIN groups g ON g.id = r.groupid
INNER JOIN category c ON c.id = r.categoryid
INNER JOIN category cp ON cp.id = c.parentid
INNER JOIN categories c ON c.id = r.categories_id
INNER JOIN categories cp ON cp.id = c.parentid
LEFT OUTER JOIN videos v ON r.videos_id = v.id
LEFT OUTER JOIN tv_info tvi ON r.videos_id = tvi.videos_id
LEFT OUTER JOIN tv_episodes tve ON r.tv_episodes_id = tve.id
@@ -1285,9 +1285,9 @@ class Releases
groups.name AS group_name
FROM releases r
INNER JOIN groups ON groups.id = r.groupid
INNER JOIN category c ON c.id = r.categoryid
INNER JOIN category cp ON cp.id = c.parentid
WHERE r.categoryid BETWEEN " . Category::TV_ROOT . " AND " . Category::TV_OTHER . "
INNER JOIN categories c ON c.id = r.categories_id
INNER JOIN categories cp ON cp.id = c.parentid
WHERE r.categories_id BETWEEN " . Category::TV_ROOT . " AND " . Category::TV_OTHER . "
AND r.passwordstatus %s
AND videos_id = %d %s %s",
$this->showPasswords,
@@ -1416,12 +1416,12 @@ class Releases
public function getRecentlyAdded()
{
return $this->pdo->query(
"SELECT CONCAT(cp.title, ' > ', category.title) AS title, COUNT(r.id) AS count
FROM category
INNER JOIN category cp ON cp.id = category.parentid
INNER JOIN releases r ON r.categoryid = category.id
"SELECT CONCAT(cp.title, ' > ', categories.title) AS title, COUNT(r.id) AS count
FROM categories
INNER JOIN categories cp ON cp.id = categories.parentid
INNER JOIN releases r ON r.categories_id = categories.id
WHERE r.adddate > NOW() - INTERVAL 1 WEEK
GROUP BY CONCAT(cp.title, ' > ', category.title)
GROUP BY CONCAT(cp.title, ' > ', categories.title)
ORDER BY count DESC", true, NN_CACHE_EXPIRY_MEDIUM
);
}
@@ -1435,11 +1435,11 @@ class Releases
{
return $this->pdo->query(
"SELECT r.imdbid, r.guid, r.name, r.searchname, r.size, r.completion,
postdate, categoryid, comments, grabs,
postdate, categories_id, comments, grabs,
m.cover
FROM releases r
INNER JOIN movieinfo m USING (imdbid)
WHERE r.categoryid BETWEEN " . Category::MOVIE_ROOT . " AND " . Category::MOVIE_OTHER . "
WHERE r.categories_id BETWEEN " . Category::MOVIE_ROOT . " AND " . Category::MOVIE_OTHER . "
AND m.imdbid > 0
AND m.cover = 1
AND r.id in (select max(id) from releases where imdbid > 0 group by imdbid)
@@ -1457,11 +1457,11 @@ class Releases
{
return $this->pdo->query(
"SELECT r.xxxinfo_id, r.guid, r.name, r.searchname, r.size, r.completion,
r.postdate, r.categoryid, r.comments, r.grabs,
r.postdate, r.categories_id, r.comments, r.grabs,
xxx.cover, xxx.title
FROM releases r
INNER JOIN xxxinfo xxx ON r.xxxinfo_id = xxx.id
WHERE r.categoryid BETWEEN " . Category::XXX_ROOT . " AND " . Category::XXX_OTHER . "
WHERE r.categories_id BETWEEN " . Category::XXX_ROOT . " AND " . Category::XXX_OTHER . "
AND xxx.id > 0
AND xxx.cover = 1
AND r.id in (select max(id) from releases where xxxinfo_id > 0 group by xxxinfo_id)
@@ -1479,11 +1479,11 @@ class Releases
{
return $this->pdo->query(
"SELECT r.consoleinfoid, r.guid, r.name, r.searchname, r.size, r.completion,
r.postdate, r.categoryid, r.comments, r.grabs,
r.postdate, r.categories_id, r.comments, r.grabs,
con.cover
FROM releases r
INNER JOIN consoleinfo con ON r.consoleinfoid = con.id
WHERE r.categoryid BETWEEN " . Category::GAME_ROOT . " AND " . Category::GAME_OTHER . "
WHERE r.categories_id BETWEEN " . Category::GAME_ROOT . " AND " . Category::GAME_OTHER . "
AND con.id > 0
AND con.cover > 0
AND r.id in (select max(id) from releases where consoleinfoid > 0 group by consoleinfoid)
@@ -1501,11 +1501,11 @@ class Releases
{
return $this->pdo->query(
"SELECT r.gamesinfo_id, r.guid, r.name, r.searchname, r.size, r.completion,
r.postdate, r.categoryid, r.comments, r.grabs,
r.postdate, r.categories_id, r.comments, r.grabs,
gi.cover
FROM releases r
INNER JOIN gamesinfo gi ON r.gamesinfo_id = gi.id
WHERE r.categoryid = 4050
WHERE r.categories_id = 4050
AND gi.id > 0
AND gi.cover > 0
AND r.id in (select max(id) from releases where gamesinfo_id > 0 group by gamesinfo_id)
@@ -1523,12 +1523,12 @@ class Releases
{
return $this->pdo->query(
"SELECT r.musicinfoid, r.guid, r.name, r.searchname, r.size, r.completion,
r.postdate, r.categoryid, r.comments, r.grabs,
r.postdate, r.categories_id, r.comments, r.grabs,
m.cover
FROM releases r
INNER JOIN musicinfo m ON r.musicinfoid = m.id
WHERE r.categoryid BETWEEN " . Category::MUSIC_ROOT . " AND " . Category::MUSIC_OTHER . "
AND r.categoryid != " . Category::MUSIC_AUDIOBOOK ."
WHERE r.categories_id BETWEEN " . Category::MUSIC_ROOT . " AND " . Category::MUSIC_OTHER . "
AND r.categories_id != " . Category::MUSIC_AUDIOBOOK ."
AND m.id > 0
AND m.cover > 0
AND r.id in (select max(id) from releases where musicinfoid > 0 group by musicinfoid)
@@ -1546,12 +1546,12 @@ class Releases
{
return $this->pdo->query(
"SELECT r.bookinfoid, r.guid, r.name, r.searchname, r.size, r.completion,
r.postdate, r.categoryid, r.comments, r.grabs,
r.postdate, r.categories_id, r.comments, r.grabs,
b.url, b.cover, b.title as booktitle, b.author
FROM releases r
INNER JOIN bookinfo b ON r.bookinfoid = b.id
WHERE r.categoryid BETWEEN " . Category::BOOKS_ROOT . " AND " . Category::BOOKS_UNKNOWN . "
OR r.categoryid = " . Category::MUSIC_AUDIOBOOK ."
WHERE r.categories_id BETWEEN " . Category::BOOKS_ROOT . " AND " . Category::BOOKS_UNKNOWN . "
OR r.categories_id = " . Category::MUSIC_AUDIOBOOK ."
AND b.id > 0
AND b.cover > 0
AND r.id in (select max(id) from releases where bookinfoid > 0 group by bookinfoid)
@@ -1569,13 +1569,13 @@ class Releases
{
return $this->pdo->query(
"SELECT r.videos_id, r.guid, r.name, r.searchname, r.size, r.completion,
r.postdate, r.categoryid, r.comments, r.grabs,
r.postdate, r.categories_id, r.comments, r.grabs,
v.id AS tvid, v.title AS tvtitle, v.tvdb, v.trakt, v.tvrage, v.tvmaze, v.imdb, v.tmdb,
tvi.image
FROM releases r
INNER JOIN videos v ON r.videos_id = v.id
INNER JOIN tv_info tvi ON r.videos_id = tvi.videos_id
WHERE r.categoryid BETWEEN " . Category::TV_ROOT . " AND " . Category::TV_OTHER . "
WHERE r.categories_id BETWEEN " . Category::TV_ROOT . " AND " . Category::TV_OTHER . "
AND v.id > 0
AND v.type = 0
AND tvi.image = 1
@@ -1594,11 +1594,11 @@ class Releases
{
return $this->pdo->query(
"SELECT r.anidbid, r.guid, r.name, r.searchname, r.size, r.completion,
r.postdate, r.categoryid, r.comments, r.grabs, at.title
r.postdate, r.categories_id, r.comments, r.grabs, at.title
FROM releases r
INNER JOIN anidb_titles at USING (anidbid)
INNER JOIN anidb_info ai USING (anidbid)
WHERE r.categoryid = 5070
WHERE r.categories_id = 5070
AND at.anidbid > 0
AND at.lang = 'en'
AND ai.picture != ''
+4 -4
View File
@@ -23,7 +23,7 @@ class RequestIDLocal extends RequestID
protected function _getReleases()
{
$query = (
'SELECT r.id, r.name, r.categoryid, r.reqidstatus, g.name AS groupname, g.id as gid
'SELECT r.id, r.name, r.categories_id, r.reqidstatus, g.name AS groupname, g.id as gid
FROM releases r
INNER JOIN groups g ON r.groupid = g.id
WHERE r.nzbstatus = 1
@@ -254,7 +254,7 @@ class RequestIDLocal extends RequestID
protected function _updateRelease()
{
$determinedCat = $this->category->determineCategory($this->_release['gid'], $this->_newTitle['title']);
if ($determinedCat == $this->_release['categoryid']) {
if ($determinedCat == $this->_release['categories_id']) {
$newTitle = $this->pdo->escapeString($this->_newTitle['title']);
$this->pdo->queryExec(
sprintf('
@@ -275,7 +275,7 @@ class RequestIDLocal extends RequestID
UPDATE releases SET
videos_id = 0, tv_episodes_id = 0, imdbid = NULL, musicinfoid = NULL, consoleinfoid = NULL,
bookinfoid = NULL, anidbid = NULL, preid = %d, reqidstatus = %d, isrenamed = 1,
iscategorized = 1, searchname = %s, categoryid = %d
iscategorized = 1, searchname = %s, categories_id = %d
WHERE id = %d',
$this->_newTitle['id'],
self::REQID_FOUND,
@@ -293,7 +293,7 @@ class RequestIDLocal extends RequestID
'new_name' => $this->_newTitle['title'],
'old_name' => $this->_release['name'],
'new_category' => $this->category->getNameByID($determinedCat),
'old_category' => $this->category->getNameByID($this->_release['categoryid']),
'old_category' => $this->category->getNameByID($this->_release['categories_id']),
'group' => $this->_release['groupname'],
'release_id' => $this->_release['id'],
'method' => 'RequestIDLocal'
+2 -2
View File
@@ -42,7 +42,7 @@ class RequestIDWeb extends RequestID
{
$this->_releases = $this->pdo->queryDirect(
sprintf ('
SELECT r.id, r.name, r.searchname, g.name AS groupname, r.groupid, r.categoryid
SELECT r.id, r.name, r.searchname, g.name AS groupname, r.groupid, r.categories_id
FROM releases r
INNER JOIN groups g ON r.groupid = g.id
WHERE r.nzbstatus = 1
@@ -290,7 +290,7 @@ class RequestIDWeb extends RequestID
sprintf('
UPDATE releases
SET videos_id = 0, tv_episodes_id = 0, imdbid = NULL, musicinfoid = NULL, consoleinfoid = NULL, bookinfoid = NULL, anidbid = NULL,
reqidstatus = %d, isrenamed = 1, proc_files = 1, searchname = %s, categoryid = %d,
reqidstatus = %d, isrenamed = 1, proc_files = 1, searchname = %s, categories_id = %d,
preid = %d
WHERE id = %d',
self::REQID_FOUND,
+9 -9
View File
@@ -385,16 +385,16 @@ class Tmux
case 1:
case 1:
return sprintf("SELECT
SUM(IF(nzbstatus = 1 AND categoryid BETWEEN %d AND %d AND categoryid != %d AND videos_id = 0
SUM(IF(nzbstatus = 1 AND categories_id BETWEEN %d AND %d AND categories_id != %d AND videos_id = 0
AND tv_episodes_id BETWEEN -3 AND 0 AND size > 1048576,1,0)) AS processtv,
SUM(IF(nzbstatus = 1 AND categoryid = %d AND anidbid IS NULL,1,0)) AS processanime,
SUM(IF(nzbstatus = 1 AND categoryid BETWEEN %d AND %d AND imdbid IS NULL,1,0)) AS processmovies,
SUM(IF(nzbstatus = 1 AND categoryid IN (%d, %d, %d) AND musicinfoid IS NULL,1,0)) AS processmusic,
SUM(IF(nzbstatus = 1 AND categoryid BETWEEN %d AND %d AND consoleinfoid IS
SUM(IF(nzbstatus = 1 AND categories_id = %d AND anidbid IS NULL,1,0)) AS processanime,
SUM(IF(nzbstatus = 1 AND categories_id BETWEEN %d AND %d AND imdbid IS NULL,1,0)) AS processmovies,
SUM(IF(nzbstatus = 1 AND categories_id IN (%d, %d, %d) AND musicinfoid IS NULL,1,0)) AS processmusic,
SUM(IF(nzbstatus = 1 AND categories_id BETWEEN %d AND %d AND consoleinfoid IS
NULL,1,0)) AS processconsole,
SUM(IF(nzbstatus = 1 AND categoryid IN (%s) AND bookinfoid IS NULL,1,0)) AS processbooks,
SUM(IF(nzbstatus = 1 AND categoryid = %d AND gamesinfo_id = 0,1,0)) AS processgames,
SUM(IF(nzbstatus = 1 AND categoryid BETWEEN %d AND %d AND xxxinfo_id = 0,1,0)) AS processxxx,
SUM(IF(nzbstatus = 1 AND categories_id IN (%s) AND bookinfoid IS NULL,1,0)) AS processbooks,
SUM(IF(nzbstatus = 1 AND categories_id = %d AND gamesinfo_id = 0,1,0)) AS processgames,
SUM(IF(nzbstatus = 1 AND categories_id BETWEEN %d AND %d AND xxxinfo_id = 0,1,0)) AS processxxx,
SUM(IF(1=1 %s,1,0)) AS processnfo,
SUM(IF(nzbstatus = 1 AND nfostatus = 1,1,0)) AS nfo,
SUM(IF(nzbstatus = 1 AND isrequestid = 1 AND preid = 0 AND ((reqidstatus = 0) OR (reqidstatus = -1) OR (reqidstatus = -3 AND adddate > NOW() - INTERVAL %s HOUR)),1,0)) AS requestid_inprogress,
@@ -422,7 +422,7 @@ class Tmux
case 2:
return "SELECT
(SELECT COUNT(r.id) FROM releases r
INNER JOIN category c ON c.id = r.categoryid
INNER JOIN categories c ON c.id = r.categories_id
WHERE r.nzbstatus = 1
AND r.passwordstatus BETWEEN -6 AND -1 AND r.haspreview = -1 AND c.disablepreview = 0
) AS work,
+2 -2
View File
@@ -31,7 +31,7 @@ class UserMovies
$catid = (!empty($catid)) ? $this->pdo->escapeString(implode('|', $catid)) : "null";
return $this->pdo->queryInsert(sprintf("INSERT INTO user_movies (userid, imdbid, categoryid, createddate) VALUES (%d, %d, %s, now())", $uid, $imdbid, $catid));
return $this->pdo->queryInsert(sprintf("INSERT INTO user_movies (userid, imdbid, categories_id, createddate) VALUES (%d, %d, %s, now())", $uid, $imdbid, $catid));
}
public function getMovies($uid)
@@ -58,6 +58,6 @@ class UserMovies
{
$catid = (!empty($catid)) ? $this->pdo->escapeString(implode('|', $catid)) : "null";
$this->pdo->queryExec(sprintf("UPDATE user_movies SET categoryid = %s WHERE userid = %d AND imdbid = %d", $catid, $uid, $imdbid));
$this->pdo->queryExec(sprintf("UPDATE user_movies SET categories_id = %s WHERE userid = %d AND imdbid = %d", $catid, $uid, $imdbid));
}
}
+2 -2
View File
@@ -41,7 +41,7 @@ class UserSeries
{
return $this->pdo->queryInsert(
sprintf(
"INSERT INTO user_series (userid, videos_id, categoryid, createddate) VALUES (%d, %d, %s, NOW())",
"INSERT INTO user_series (userid, videos_id, categories_id, createddate) VALUES (%d, %d, %s, NOW())",
$uID,
$videoId,
(!empty($catID) ? $this->pdo->escapeString(implode('|', $catID)) : "NULL")
@@ -151,7 +151,7 @@ class UserSeries
{
$this->pdo->queryExec(
sprintf(
"UPDATE user_series SET categoryid = %s WHERE userid = %d AND videos_id = %d",
"UPDATE user_series SET categories_id = %s WHERE userid = %d AND videos_id = %d",
(!empty($catID) ? $this->pdo->escapeString(implode('|', $catID)) : "NULL"),
$uID,
$videoId
+7 -7
View File
@@ -772,7 +772,7 @@ class Users
$this->delUserCategoryExclusions($uid);
if (COUNT($catids) > 0) {
foreach ($catids as $catid) {
$this->pdo->queryInsert(sprintf("INSERT INTO user_excluded_categories (userid, categoryid, createddate) VALUES (%d, %d, now())", $uid, $catid));
$this->pdo->queryInsert(sprintf("INSERT INTO user_excluded_categories (userid, categories_id, createddate) VALUES (%d, %d, now())", $uid, $catid));
}
}
}
@@ -780,9 +780,9 @@ class Users
public function getRoleCategoryExclusion($role)
{
$ret = [];
$data = $this->pdo->query(sprintf("SELECT categoryid FROM roleexcat WHERE role = %d", $role));
$data = $this->pdo->query(sprintf("SELECT categories_id FROM roleexcat WHERE role = %d", $role));
foreach ($data as $d)
$ret[] = $d["categoryid"];
$ret[] = $d["categories_id"];
return $ret;
}
@@ -792,7 +792,7 @@ class Users
$this->delRoleCategoryExclusions($role);
if (COUNT($catids) > 0) {
foreach ($catids as $catid) {
$this->pdo->queryInsert(sprintf("INSERT INTO roleexcat (role, categoryid, createddate) VALUES (%d, %d, now())", $role, $catid));
$this->pdo->queryInsert(sprintf("INSERT INTO roleexcat (role, categories_id, createddate) VALUES (%d, %d, now())", $role, $catid));
}
}
}
@@ -812,9 +812,9 @@ class Users
public function getCategoryExclusion($userID)
{
$ret = [];
$categories = $this->pdo->query(sprintf("SELECT categoryid FROM user_excluded_categories WHERE userid = %d", $userID));
$categories = $this->pdo->query(sprintf("SELECT categories_id FROM user_excluded_categories WHERE userid = %d", $userID));
foreach ($categories as $category) {
$ret[] = $category["categoryid"];
$ret[] = $category["categories_id"];
}
return $ret;
@@ -843,7 +843,7 @@ class Users
public function delCategoryExclusion($uid, $catid)
{
$this->pdo->queryExec(sprintf("DELETE FROM user_excluded_categories WHERE userid = %d AND categoryid = %d", $uid, $catid));
$this->pdo->queryExec(sprintf("DELETE FROM user_excluded_categories WHERE userid = %d AND categories_id = %d", $uid, $catid));
}
public function sendInvite($sitetitle, $siteemail, $serverurl, $uid, $emailto)
+1 -1
View File
@@ -22,7 +22,7 @@ Class Videos
];
$options += $defaults;
$this->pdo = ($options['Settings'] instanceof Settings ? $options['Settings'] : new Settings());
$this->catWhere = "r.categoryid BETWEEN " . Category::TV_ROOT . " AND " . Category::TV_OTHER;
$this->catWhere = "r.categories_id BETWEEN " . Category::TV_ROOT . " AND " . Category::TV_OTHER;
}
/**
+5 -5
View File
@@ -79,7 +79,7 @@ class XXX
$this->echooutput = ($options['Echo'] && NN_ECHOCLI);
$this->imgSavePath = NN_COVERS . 'xxx' . DS;
$this->cookie = NN_TMP . 'xxx.cookie';
$this->catWhere = 'AND categoryid IN (' .
$this->catWhere = 'AND categories_id IN (' .
Category::XXX_DVD . ', ' .
Category::XXX_WMV . ', ' .
Category::XXX_XVID . ', ' .
@@ -184,7 +184,7 @@ class XXX
? 'AND r.postdate > NOW() - INTERVAL ' . $maxAge . 'DAY '
: ''
),
(count($excludedCats) > 0 ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : ''),
(count($excludedCats) > 0 ? ' AND r.categories_id NOT IN (' . implode(',', $excludedCats) . ')' : ''),
$order[0],
$order[1],
($start === false ? '' : ' LIMIT ' . $num . ' OFFSET ' . $start)
@@ -224,8 +224,8 @@ class XXX
LEFT OUTER JOIN groups g ON g.id = r.groupid
LEFT OUTER JOIN release_nfos rn ON rn.releaseid = r.id
LEFT OUTER JOIN dnzb_failures df ON df.release_id = r.id
LEFT OUTER JOIN category c ON c.id = r.categoryid
LEFT OUTER JOIN category cp ON cp.id = c.parentid
LEFT OUTER JOIN categories c ON c.id = r.categories_id
LEFT OUTER JOIN categories cp ON cp.id = c.parentid
INNER JOIN xxxinfo xxx ON xxx.id = r.xxxinfo_id
WHERE r.nzbstatus = 1
AND xxx.id IN (%s)
@@ -242,7 +242,7 @@ class XXX
? 'AND r.postdate > NOW() - INTERVAL ' . $maxAge . 'DAY '
: ''
),
(count($excludedCats) > 0 ? ' AND r.categoryid NOT IN (' . implode(',', $excludedCats) . ')' : ''),
(count($excludedCats) > 0 ? ' AND r.categories_id NOT IN (' . implode(',', $excludedCats) . ')' : ''),
$order[0],
$order[1]
);
+6 -6
View File
@@ -665,7 +665,7 @@ class Forking extends \fork_daemon
sprintf('
SELECT r.id
FROM releases r
LEFT JOIN category c ON c.id = r.categoryid
LEFT JOIN categories c ON c.id = r.categories_id
WHERE r.nzbstatus = %d
AND r.passwordstatus BETWEEN -6 AND -1
AND r.haspreview = -1
@@ -690,7 +690,7 @@ class Forking extends \fork_daemon
sprintf('
SELECT LEFT(r.guid, 1) AS id
FROM releases r
LEFT JOIN category c ON c.id = r.categoryid
LEFT JOIN categories c ON c.id = r.categories_id
WHERE r.nzbstatus = %d
AND r.passwordstatus BETWEEN -6 AND -1
AND r.haspreview = -1
@@ -765,7 +765,7 @@ class Forking extends \fork_daemon
FROM releases
WHERE nzbstatus = %d
AND imdbid IS NULL
AND categoryid BETWEEN ' . Category::MOVIE_ROOT . ' AND ' . Category::MOVIE_OTHER . '
AND categories_id BETWEEN ' . Category::MOVIE_ROOT . ' AND ' . Category::MOVIE_OTHER . '
%s %s
LIMIT 1',
NZB::NZB_ADDED,
@@ -790,7 +790,7 @@ class Forking extends \fork_daemon
FROM releases
WHERE nzbstatus = %d
AND imdbid IS NULL
AND categoryid BETWEEN ' . Category::MOVIE_ROOT . ' AND ' . Category::MOVIE_OTHER . '
AND categories_id BETWEEN ' . Category::MOVIE_ROOT . ' AND ' . Category::MOVIE_OTHER . '
%s %s
GROUP BY LEFT(guid, 1)
LIMIT 16',
@@ -820,7 +820,7 @@ class Forking extends \fork_daemon
WHERE nzbstatus = %d
AND size > 1048576
AND tv_episodes_id BETWEEN -2 AND 0
AND categoryid BETWEEN ' . Category::TV_ROOT . ' AND ' . Category::TV_OTHER . '
AND categories_id BETWEEN ' . Category::TV_ROOT . ' AND ' . Category::TV_OTHER . '
%s %s
LIMIT 1',
NZB::NZB_ADDED,
@@ -846,7 +846,7 @@ class Forking extends \fork_daemon
WHERE nzbstatus = %d
AND tv_episodes_id BETWEEN -2 AND 0
AND size > 1048576
AND categoryid BETWEEN ' . Category::TV_ROOT . ' AND ' . Category::TV_OTHER . '
AND categories_id BETWEEN ' . Category::TV_ROOT . ' AND ' . Category::TV_OTHER . '
%s %s
GROUP BY LEFT(guid, 1)
LIMIT 16',
+3 -3
View File
@@ -339,7 +339,7 @@ class PostProcess
$query = $this->pdo->queryOneRow(
sprintf('
SELECT id, groupid, categoryid, name, searchname, UNIX_TIMESTAMP(postdate) AS post_date, id AS releaseid
SELECT id, groupid, categories_id, name, searchname, UNIX_TIMESTAMP(postdate) AS post_date, id AS releaseid
FROM releases
WHERE isrenamed = 0
AND id = %d',
@@ -354,7 +354,7 @@ class PostProcess
// Only get a new name if the category is OTHER.
$foundName = true;
if (!in_array(
(int)$query['categoryid'],
(int)$query['categories_id'],
Category::OTHERS_GROUP
)
) {
@@ -470,7 +470,7 @@ class PostProcess
$query = $this->pdo->queryOneRow(
sprintf('
SELECT
r.id, r.groupid, r.categoryid, r.name, r.searchname,
r.id, r.groupid, r.categories_id, r.name, r.searchname,
UNIX_TIMESTAMP(r.postdate) AS post_date,
r.id AS releaseid,
g.name AS groupname
+13 -13
View File
@@ -256,7 +256,7 @@ class ProcessReleases
public function resetCategorize($where = '')
{
$this->pdo->queryExec(
sprintf('UPDATE releases SET categoryid = %d, iscategorized = 0 %s', \Category::OTHER_MISC, $where)
sprintf('UPDATE releases SET categories_id = %d, iscategorized = 0 %s', \Category::OTHER_MISC, $where)
);
}
@@ -279,7 +279,7 @@ class ProcessReleases
foreach ($releases as $release) {
$catId = $cat->determineCategory($release['groupid'], $release[$type]);
$this->pdo->queryExec(
sprintf('UPDATE releases SET categoryid = %d, iscategorized = 1 WHERE id = %d', $catId, $release['id'])
sprintf('UPDATE releases SET categories_id = %d, iscategorized = 1 WHERE id = %d', $catId, $release['id'])
);
$categorized++;
if ($this->echoCLI) {
@@ -616,7 +616,7 @@ class ProcessReleases
'postdate' => $this->pdo->escapeString($collection['date']),
'fromname' => $fromName,
'size' => $collection['filesize'],
'categoryid' => $categorize->determineCategory($collection['group_id'], $cleanedName),
'categories_id' => $categorize->determineCategory($collection['group_id'], $cleanedName),
'isrenamed' => ($properName === true ? 1 : 0),
'reqidstatus' => ($isReqID === true ? 1 : 0),
'preid' => ($preID === false ? 0 : $preID),
@@ -698,8 +698,8 @@ class ProcessReleases
SELECT SQL_NO_CACHE CONCAT(COALESCE(cp.title,'') , CASE WHEN cp.title IS NULL THEN '' ELSE ' > ' END , c.title) AS title,
r.name, r.id, r.guid
FROM releases r
INNER JOIN category c ON r.categoryid = c.id
INNER JOIN category cp ON cp.id = c.parentid
INNER JOIN categories c ON r.categories_id = c.id
INNER JOIN categories cp ON cp.id = c.parentid
WHERE %s nzbstatus = 0",
(!empty($groupID) ? ' r.groupid = ' . $groupID . ' AND ' : ' ')
)
@@ -820,8 +820,8 @@ class ProcessReleases
$this->categorizeRelease(
$type,
(!empty($groupID)
? 'WHERE categoryid = ' . Category::OTHER_MISC . ' AND iscategorized = 0 AND groupid = ' . $groupID
: 'WHERE categoryid = ' . Category::OTHER_MISC . ' AND iscategorized = 0')
? 'WHERE categories_id = ' . Category::OTHER_MISC . ' AND iscategorized = 0 AND groupid = ' . $groupID
: 'WHERE categories_id = ' . Category::OTHER_MISC . ' AND iscategorized = 0')
);
if ($this->echoCLI) {
@@ -1265,7 +1265,7 @@ class ProcessReleases
if (count($disabledCategories) > 0) {
foreach ($disabledCategories as $disabledCategory) {
$releases = $this->pdo->queryDirect(
sprintf('SELECT id, guid FROM releases WHERE categoryid = %d', $disabledCategory['id'])
sprintf('SELECT id, guid FROM releases WHERE categories_id = %d', $disabledCategory['id'])
);
if ($releases instanceof \Traversable) {
foreach ($releases as $release) {
@@ -1280,8 +1280,8 @@ class ProcessReleases
$categories = $this->pdo->queryDirect('
SELECT c.id AS id,
CASE WHEN c.minsizetoformrelease = 0 THEN cp.minsizetoformrelease ELSE c.minsizetoformrelease END AS minsize
FROM category c
INNER JOIN category cp ON cp.id = c.parentid
FROM categories c
INNER JOIN categories cp ON cp.id = c.parentid
WHERE c.parentid IS NOT NULL'
);
@@ -1292,7 +1292,7 @@ class ProcessReleases
sprintf('
SELECT r.id, r.guid
FROM releases r
WHERE r.categoryid = %d
WHERE r.categories_id = %d
AND r.size < %d LIMIT 1000',
$category['id'],
$category['minsize']
@@ -1336,7 +1336,7 @@ class ProcessReleases
sprintf('
SELECT id, guid
FROM releases
WHERE categoryid = %d
WHERE categories_id = %d
AND adddate <= NOW() - INTERVAL %d HOUR',
Category::OTHER_MISC,
$this->pdo->getSetting('miscotherretentionhours')
@@ -1356,7 +1356,7 @@ class ProcessReleases
sprintf('
SELECT id, guid
FROM releases
WHERE categoryid = %d
WHERE categories_id = %d
AND adddate <= NOW() - INTERVAL %d HOUR',
Category::OTHER_HASHED,
$this->pdo->getSetting('mischashedretentionhours')
+1 -1
View File
@@ -69,7 +69,7 @@ class AniDB
FROM releases
WHERE nzbstatus = %d
AND anidbid IS NULL
AND categoryid = %d
AND categories_id = %d
ORDER BY postdate DESC
LIMIT %d',
NZB::NZB_ADDED,
@@ -626,9 +626,9 @@ class ProcessAdditional
$this->_releases = $this->pdo->query(
sprintf(
'
SELECT r.id, r.guid, r.name, c.disablepreview, r.size, r.groupid, r.nfostatus, r.completion, r.categoryid, r.searchname, r.preid
SELECT r.id, r.guid, r.name, c.disablepreview, r.size, r.groupid, r.nfostatus, r.completion, r.categories_id, r.searchname, r.preid
FROM releases r
LEFT JOIN category c ON c.id = r.categoryid
LEFT JOIN categories c ON c.id = r.categories_id
WHERE r.nzbstatus = 1
%s %s %s %s
AND r.passwordstatus BETWEEN -6 AND -1
@@ -1354,7 +1354,7 @@ class ProcessAdditional
} // Check if it's alt.binaries.u4e file.
else if (in_array($this->_releaseGroupName, ['alt.binaries.u4e', 'alt.binaries.mom']) &&
preg_match('/Linux_2rename\.sh/i', $file) &&
($this->_release['categoryid'] == Category::OTHER_HASHED || $this->_release['categoryid'] == Category::OTHER_MISC)
($this->_release['categories_id'] == Category::OTHER_HASHED || $this->_release['categories_id'] == Category::OTHER_MISC)
) {
$this->_processU4ETitle($file);
}
@@ -1765,7 +1765,7 @@ class ProcessAdditional
// Make sure the category is music or other.
$rQuery = $this->pdo->queryOneRow(
sprintf(
'SELECT searchname, categoryid AS id, groupid FROM releases WHERE proc_pp = 0 AND id = %d',
'SELECT searchname, categories_id AS id, groupid FROM releases WHERE proc_pp = 0 AND id = %d',
$this->_release['id']
)
);
@@ -1831,7 +1831,7 @@ class ProcessAdditional
sprintf(
'
UPDATE releases
SET searchname = %s, categoryid = %d, iscategorized = 1, isrenamed = 1, proc_pp = 1
SET searchname = %s, categories_id = %d, iscategorized = 1, isrenamed = 1, proc_pp = 1
WHERE id = %d',
$newTitle,
$newCat,
@@ -2269,7 +2269,7 @@ class ProcessAdditional
if (NN_RENAME_PAR2 &&
$releaseInfo['proc_pp'] == 0 &&
in_array(
((int)$this->_release['categoryid']),
((int)$this->_release['categories_id']),
Category::OTHERS_GROUP
)
) {
@@ -2342,7 +2342,7 @@ class ProcessAdditional
$query = $this->pdo->queryOneRow(
sprintf('
SELECT
r.id, r.groupid, r.categoryid, r.name, r.searchname,
r.id, r.groupid, r.categories_id, r.name, r.searchname,
UNIX_TIMESTAMP(r.postdate) AS post_date,
r.id AS releaseid
FROM releases r
@@ -2472,7 +2472,7 @@ class ProcessAdditional
UPDATE releases
SET videos_id = 0, tv_episodes_id = 0, imdbid = NULL, musicinfoid = NULL,
consoleinfoid = NULL, bookinfoid = NULL, anidbid = NULL, preid = 0,
searchname = %s, isrenamed = 1, iscategorized = 1, proc_files = 1, categoryid = %d
searchname = %s, isrenamed = 1, iscategorized = 1, proc_files = 1, categories_id = %d
WHERE id = %d',
$newTitle,
$newCategory,
@@ -2488,7 +2488,7 @@ class ProcessAdditional
'new_name' => $newName,
'old_name' => $this->_release['searchname'],
'new_category' => $newCategory,
'old_category' => $this->_release['categoryid'],
'old_category' => $this->_release['categories_id'],
'group' => $this->_release['groupid'],
'release_id' => $this->_release['id'],
'method' => 'ProcessAdditional->_processU4ETitle'
+1 -1
View File
@@ -60,7 +60,7 @@ abstract class TV extends Videos
public function __construct(array $options = [])
{
parent::__construct($options);
$this->catWhere = "categoryid BETWEEN " . Category::TV_ROOT . " AND " . Category::TV_OTHER . " AND categoryid != " . Category::TV_ANIME;
$this->catWhere = "categories_id BETWEEN " . Category::TV_ROOT . " AND " . Category::TV_OTHER . " AND categories_id != " . Category::TV_ANIME;
$this->tvqty = ($this->pdo->getSetting('maxrageprocessed') != '') ? $this->pdo->getSetting('maxrageprocessed') : 75;
$this->imgSavePath = NN_COVERS . 'tvshows' . DS;
$this->siteColumns = ['tvdb', 'trakt', 'tvrage', 'tvmaze', 'imdb', 'tmdb'];
@@ -0,0 +1,2 @@
# Rename category to categories, to comply with lithium convention.
RENAME TABLE category TO categories;
@@ -0,0 +1,30 @@
# Note this patch does not change user_movies and user_series tables which appear to have
# incorrect column types. They will be handled later.
# Change references of categoryid to categories_id to comply with lithium conventions
ALTER TABLE category_regexes
CHANGE COLUMN category_id categories_id SMALLINT UNSIGNED NOT NULL DEFAULT '0010'
COMMENT 'Which category id to put the release in';
#ALTER TABLE category_regexes RENAME INDEX ix_category_regexes_category_id TO ix_category_regexes_categories_id;
ALTER TABLE releases
CHANGE COLUMN categoryid categories_id INT NOT NULL DEFAULT '0010',
COMMENT 'Which category id the release belongs to'
PARTITION BY RANGE (categories_id) (
PARTITION misc VALUES LESS THAN (1000),
PARTITION console VALUES LESS THAN (2000),
PARTITION movies VALUES LESS THAN (3000),
PARTITION audio VALUES LESS THAN (4000),
PARTITION pc VALUES LESS THAN (5000),
PARTITION tv VALUES LESS THAN (6000),
PARTITION xxx VALUES LESS THAN (7000),
PARTITION books VALUES LESS THAN (8000)
);
ALTER TABLE user_excluded_categories
CHANGE COLUMN categoryid categories_id INT NOT NULL,
COMMENT 'Which category id to exclude';
ALTER TABLE user_movies
CHANGE COLUMN categoryid categories_id INT NOT NULL,
COMMENT 'Which category id to exclude';
@@ -0,0 +1,2 @@
# Rename category to categories, to comply with lithium convention.
RENAME TABLE category TO categories;
@@ -0,0 +1,30 @@
# Note this patch does not change user_movies and user_series tables which appear to have
# incorrect column types. They will be handled later.
# Change references of categoryid to categories_id to comply with lithium conventions
ALTER TABLE category_regexes
CHANGE COLUMN category_id categories_id SMALLINT UNSIGNED NOT NULL DEFAULT '0010'
COMMENT 'Which category id to put the release in';
#ALTER TABLE category_regexes RENAME INDEX ix_category_regexes_category_id TO ix_category_regexes_categories_id;
ALTER TABLE releases
CHANGE COLUMN categoryid categories_id INT NOT NULL DEFAULT '0010',
COMMENT 'Which category id the release belongs to'
PARTITION BY RANGE (categories_id) (
PARTITION misc VALUES LESS THAN (1000),
PARTITION console VALUES LESS THAN (2000),
PARTITION movies VALUES LESS THAN (3000),
PARTITION audio VALUES LESS THAN (4000),
PARTITION pc VALUES LESS THAN (5000),
PARTITION tv VALUES LESS THAN (6000),
PARTITION xxx VALUES LESS THAN (7000),
PARTITION books VALUES LESS THAN (8000)
);
ALTER TABLE user_excluded_categories
CHANGE COLUMN categoryid categories_id INT NOT NULL,
COMMENT 'Which category id to exclude';
ALTER TABLE user_movies
CHANGE COLUMN categoryid categories_id INT NOT NULL,
COMMENT 'Which category id to exclude';
+9 -9
View File
@@ -2435,7 +2435,7 @@ CREATE TABLE IF NOT EXISTS releases (
guid VARCHAR(50) COLLATE utf8_unicode_ci NOT NULL,
fromname VARCHAR(255) COLLATE utf8_unicode_ci DEFAULT NULL,
completion FLOAT NOT NULL DEFAULT '0',
categoryid INT(11) NOT NULL DEFAULT '0',
categories_id INT(11) NOT NULL DEFAULT '0',
videos_id MEDIUMINT(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'FK to videos.id of the parent series.',
tv_episodes_id MEDIUMINT(11) NOT NULL DEFAULT '0' COMMENT 'FK to tv_episodes.id of the episode',
regexid INT(11) DEFAULT NULL,
@@ -2474,7 +2474,7 @@ CREATE TABLE IF NOT EXISTS releases (
xxxinfo_id INT(10) NOT NULL DEFAULT '0',
nzbstatus TINYINT(1) NOT NULL DEFAULT '0',
nzb_guid BINARY(16) DEFAULT NULL,
PRIMARY KEY (id,categoryid),
PRIMARY KEY (id,categories_id),
KEY ix_releases_name (name),
KEY ix_releases_group_id (groupid,passwordstatus),
KEY ix_releases_postdate_searchname (postdate,searchname),
@@ -2501,7 +2501,7 @@ CREATE TABLE IF NOT EXISTS releases (
DEFAULT CHARSET = utf8
COLLATE = utf8_unicode_ci
AUTO_INCREMENT = 1
PARTITION BY RANGE (categoryid)(
PARTITION BY RANGE (categories_id)(
PARTITION misc VALUES LESS THAN (1000),
PARTITION console VALUES LESS THAN (2000),
PARTITION movies VALUES LESS THAN (3000),
@@ -3821,10 +3821,10 @@ DROP TABLE IF EXISTS roleexcat;
CREATE TABLE IF NOT EXISTS roleexcat (
id INT(16) UNSIGNED NOT NULL AUTO_INCREMENT,
role INT(11) NOT NULL,
categoryid INT(11) DEFAULT NULL,
categories_id INT(11) DEFAULT NULL,
createddate DATETIME NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY ix_roleexcat_rolecat (role,categoryid)
UNIQUE KEY ix_roleexcat_rolecat (role,categories_id)
)
ENGINE = MyISAM
DEFAULT CHARSET = utf8
@@ -4366,10 +4366,10 @@ DROP TABLE IF EXISTS user_excluded_categories;
CREATE TABLE IF NOT EXISTS user_excluded_categories (
id INT(16) UNSIGNED NOT NULL AUTO_INCREMENT,
userid INT(11) DEFAULT NULL,
categoryid INT(11) DEFAULT NULL,
categories_id INT(11) DEFAULT NULL,
createddate DATETIME NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY ix_userexcat_usercat (userid,categoryid)
UNIQUE KEY ix_userexcat_usercat (userid,categories_id)
)
ENGINE = MyISAM
DEFAULT CHARSET = utf8
@@ -4394,7 +4394,7 @@ CREATE TABLE IF NOT EXISTS user_movies (
id INT(16) UNSIGNED NOT NULL AUTO_INCREMENT,
userid INT(16) DEFAULT NULL,
imdbid MEDIUMINT(7) UNSIGNED zerofill DEFAULT NULL,
categoryid VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT NULL,
categories_id VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT NULL,
createddate DATETIME NOT NULL,
PRIMARY KEY (id),
KEY ix_usermovies_userid (userid,imdbid)
@@ -4501,7 +4501,7 @@ CREATE TABLE IF NOT EXISTS user_series (
id INT(16) UNSIGNED NOT NULL AUTO_INCREMENT,
userid INT(16) DEFAULT NULL,
videos_id INT(16) NOT NULL COMMENT 'FK to videos.id',
categoryid VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT NULL,
categories_id VARCHAR(64) COLLATE utf8_unicode_ci DEFAULT NULL,
createddate DATETIME NOT NULL,
PRIMARY KEY (id),
KEY ix_userseries_videos_id (userid,videos_id)
+1 -1
View File
@@ -22,7 +22,7 @@ foreach ($tmpcats as $c) {
$movies = $um->getMovies($page->users->currentUserId());
$results = [];
foreach ($movies as $mov => $m) {
$movcats = explode('|', $m['categoryid']);
$movcats = explode('|', $m['categories_id']);
if (is_array($movcats) && sizeof($movcats) > 0) {
$catarr = [];
foreach ($movcats as $movcat) {
+2 -2
View File
@@ -101,7 +101,7 @@ switch ($action) {
$page->smarty->assign('type', 'edit');
$page->smarty->assign('cat_ids', array_keys($categories));
$page->smarty->assign('cat_names', $categories);
$page->smarty->assign('cat_selected', explode('|', $show['categoryid']));
$page->smarty->assign('cat_selected', explode('|', $show['categories_id']));
$page->smarty->assign('video', $videoId);
$page->smarty->assign('show', $show);
if (isset($_REQUEST['from'])) {
@@ -169,7 +169,7 @@ switch ($action) {
$shows = $us->getShows($page->users->currentUserId());
$results = [];
foreach ($shows as $showk => $show) {
$showcats = explode('|', $show['categoryid']);
$showcats = explode('|', $show['categories_id']);
if (is_array($showcats) && sizeof($showcats) > 0) {
$catarr = [];
foreach ($showcats as $scat) {
+1 -1
View File
@@ -289,7 +289,7 @@
</td>
<td class="category">
<a title="Browse {$result.category_name}"
href="{$smarty.const.WWW_TOP}/browse?t={$result.categoryid}">{$result.category_name}</a>
href="{$smarty.const.WWW_TOP}/browse?t={$result.categories_id}">{$result.category_name}</a>
</td>
<td class="posted" title="{$result.postdate}">
{$result.postdate|timeago}
+1 -1
View File
@@ -481,7 +481,7 @@
</th>
<td>
<a title="Browse by {$release.category_name}"
href="{$smarty.const.WWW_TOP}/browse?t={$release.categoryid}">{$release.category_name}</a>
href="{$smarty.const.WWW_TOP}/browse?t={$release.categories_id}">{$release.category_name}</a>
</td>
</tr>
<tr>
+1 -1
View File
@@ -167,7 +167,7 @@
</td>
<td class="less">
<a title="Browse {$result.category_name}" href="{$smarty.const.WWW_TOP}/browse?t={$result.categoryid}">{$result.category_name}</a>
<a title="Browse {$result.category_name}" href="{$smarty.const.WWW_TOP}/browse?t={$result.categories_id}">{$result.category_name}</a>
</td>
<td class="less mid" title="{$result.postdate}">{$result.postdate|timeago}</td>
+1 -1
View File
@@ -18,7 +18,7 @@
{foreach $shows as $show}
<tr class="{cycle values=",alt"}">
<td>
<a title="View details" href="{$smarty.const.WWW_TOP}/series/{$show.videos_id}{if $show.categoryid != ''}?t={$show.categoryid|replace:"|":","}{/if}"><h5>{$show.title|escape:"htmlall"|wordwrap:75:"\n":true}</h5></a>
<a title="View details" href="{$smarty.const.WWW_TOP}/series/{$show.videos_id}{if $show.categories_id != ''}?t={$show.categories_id|replace:"|":","}{/if}"><h5>{$show.title|escape:"htmlall"|wordwrap:75:"\n":true}</h5></a>
</td>
<td class="less">{if $show.categoryNames != ''}{$show.categoryNames|escape:"htmlall"}{else}All{/if}</td>
<td class="less" style="width:100px;" title="Added on {$show.createddate}">{$show.createddate|date_format}</td>
+1 -1
View File
@@ -244,7 +244,7 @@
</div>
</td>
<td width="100px" class="less">
<a title="Browse {$result.category_name}" href="{$smarty.const.WWW_TOP}/browse?t={$result.categoryid}">{$result.category_name}</a>
<a title="Browse {$result.category_name}" href="{$smarty.const.WWW_TOP}/browse?t={$result.categories_id}">{$result.category_name}</a>
</td>
<td class="less mid" title="{$result.postdate}">{$result.postdate|timeago}</td>
<td class="less right">
+1 -1
View File
@@ -60,7 +60,7 @@
{if $result.nfoid > 0}<a href="{$smarty.const.WWW_TOP}/nfo/{$result.guid}" title="View Nfo" class="modal_nfo rndbtn badge" rel="nfo">Nfo</a>{/if}
{if $result.haspreview == 1 && $userdata.canpreview == 1}<a href="{$smarty.const.WWW_TOP}/covers/preview/{$result.guid}_thumb.jpg" name="name{$mguid[$m@index]}" title="Screenshot" class="modal_prev rndbtn badge" rel="preview">Preview</a>{/if}
{if $result.reid > 0}<span class="mediainfo rndbtn badge" title="{$result.guid}">Media</span>{/if}
<td class="less"><a title="This anime in {$result.category_name}" href="{$smarty.const.WWW_TOP}/anime/{$result.anidbid}?t={$result.categoryid}">{$result.category_name}</a></td>
<td class="less"><a title="This anime in {$result.category_name}" href="{$smarty.const.WWW_TOP}/anime/{$result.anidbid}?t={$result.categories_id}">{$result.category_name}</a></td>
<td class="less mid" width="40" title="{$result.postdate}">{$result.postdate|timeago}</td>
<td width="40" class="less right">{$result.size|fsize_format:"MB"}</td>
<td class="icons style='width:100px;'>
+1 -1
View File
@@ -296,7 +296,7 @@
<dd><a title="Browse {$release.group_name}" href="{$smarty.const.WWW_TOP}/browse?g={$release.group_name}">{$release.group_name|replace:"alt.binaries":"a.b"}</a></dd>
<dt>Category</dt>
<dd><a title="Browse by {$release.category_name}" href="{$smarty.const.WWW_TOP}/browse?t={$release.categoryid}">{$release.category_name}</a></dd>
<dd><a title="Browse by {$release.category_name}" href="{$smarty.const.WWW_TOP}/browse?t={$release.categories_id}">{$release.category_name}</a></dd>
{if $nfo.releaseid|@count > 0}
<dt>Nfo</dt>
<dd><a href="{$smarty.const.WWW_TOP}/nfo/{$release.guid}" title="View Nfo">View Nfo</a></dd>
+1 -1
View File
@@ -203,7 +203,7 @@
</div>
</td>
<td class="check"><input id="chk{$result.guid|substr:0:7}" type="checkbox" class="nzb_check" name="{$seasonnum}" value="{$result.guid}" /></td>
<td class="less"><a title="This series in {$result.category_name}" href="{$smarty.const.WWW_TOP}/series/{$show.id}?t={$result.categoryid}">{$result.category_name}</a></td>
<td class="less"><a title="This series in {$result.category_name}" href="{$smarty.const.WWW_TOP}/series/{$show.id}?t={$result.categories_id}">{$result.category_name}</a></td>
<td class="less mid" width="40" title="{$result.postdate}">{$result.postdate|timeago}</td>
<td class="less right">
+1 -1
View File
@@ -308,7 +308,7 @@
</td>
<td class="category">
<a title="Browse {$result.category_name}"
href="{$smarty.const.WWW_TOP}/browse?t={$result.categoryid}">{$result.category_name}</a>
href="{$smarty.const.WWW_TOP}/browse?t={$result.categories_id}">{$result.category_name}</a>
</td>
<td class="posted" title="{$result.postdate}">
{$result.postdate|timeago}
+1 -1
View File
@@ -486,7 +486,7 @@
</th>
<td>
<a title="Browse by {$release.category_name}"
href="{$smarty.const.WWW_TOP}/browse?t={$release.categoryid}">{$release.category_name}</a>
href="{$smarty.const.WWW_TOP}/browse?t={$release.categories_id}">{$release.category_name}</a>
</td>
</tr>
<tr>
+1 -1
View File
@@ -289,7 +289,7 @@
</td>
<td class="category">
<a title="Browse {$result.category_name}"
href="{$smarty.const.WWW_TOP}/browse?t={$result.categoryid}">{$result.category_name}</a>
href="{$smarty.const.WWW_TOP}/browse?t={$result.categories_id}">{$result.category_name}</a>
</td>
<td class="posted" title="{$result.postdate}">
{$result.postdate|timeago}
+1 -1
View File
@@ -481,7 +481,7 @@
</th>
<td>
<a title="Browse by {$release.category_name}"
href="{$smarty.const.WWW_TOP}/browse?t={$release.categoryid}">{$release.category_name}</a>
href="{$smarty.const.WWW_TOP}/browse?t={$release.categories_id}">{$release.category_name}</a>
</td>
</tr>
<tr>
@@ -27,7 +27,7 @@
<tr>
<td><label for="category">Category:</label></td>
<td>
{html_options id="category" name=category options=$catlist selected=$release.categoryid}
{html_options id="category" name=category options=$catlist selected=$release.categories_id}
</td>
</tr>
<tr>
@@ -4,7 +4,7 @@
<p>
Export nzbs from the system into a folder. Specify the full file path to a folder.
<br/>
If you are exporting a large number of nzb files, run this script from the command line and pass in the folder path as the first argument. e.g. php scriptname outputpath from(optional) to(optional) groupid(optional use -1) categoryid(optional)<br/>
If you are exporting a large number of nzb files, run this script from the command line and pass in the folder path as the first argument. e.g. php scriptname outputpath from(optional) to(optional) groupid(optional use -1) categories_id(optional)<br/>
<span style="font-family:courier;display:block;padding:5px 0 15px 0;">
php admin/nzb-export.php /path/to/export/into 01/01/2008 01/01/2010 -1 1050
</span>
@@ -43,9 +43,9 @@ If you are exporting a large number of nzb files, run this script from the comma
</tr>
<tr>
<td><label for="categoryid">Category</label>:</td>
<td><label for="categories_id">Category</label>:</td>
<td>
{html_options id="categoryid" name='categoryid' options=$catlist selected=$cat}
{html_options id="categories_id" name='categories_id' options=$catlist selected=$cat}
<div class="hint">Posted to this category</div>
</td>
</tr>
@@ -64,4 +64,4 @@ If you are exporting a large number of nzb files, run this script from the comma
<div>
{$output}
</div>
</div>
</div>
@@ -25,7 +25,7 @@
<tr>
<td><label for="category">Category:</label></td>
<td>
{html_options id="category" name=category options=$catlist selected=$release.categoryid}
{html_options id="category" name=category options=$catlist selected=$release.categories_id}
</td>
</tr>
<tr>
+1 -1
View File
@@ -51,7 +51,7 @@
<li>Name: {$release.searchname}</li>
<li>Size: {$release.size|fsize_format:"MB"} </li>
<li>Attributes: Category - <a
href="{$serverroot}browse?t={$release.categoryid}">{$release.category_name}</a>
href="{$serverroot}browse?t={$release.categories_id}">{$release.category_name}</a>
</li>
<li>Groups: <a href="{$serverroot}browse?g={$release.group_name}">{$release.group_name}</a>
</li>