mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 03:01:34 +00:00
Change leftover category numbers to constants.
This commit is contained in:
+5
-4
@@ -114,6 +114,7 @@ class Games
|
||||
if ($this->pdo->getSetting('lookupgames') == 2) {
|
||||
$this->renamed = 'AND isrenamed = 1';
|
||||
}
|
||||
$this->catWhere = 'AND categoryid = ' . Category::PC_GAMES . ' ';
|
||||
//$this->cleangames = ($this->pdo->getSetting('('lookupgames') == 2) ? 'AND isrenamed = 1' : '';
|
||||
}
|
||||
|
||||
@@ -825,11 +826,11 @@ class Games
|
||||
SELECT searchname, id
|
||||
FROM releases
|
||||
WHERE nzbstatus = 1 %s
|
||||
AND gamesinfo_id = 0
|
||||
AND categoryid = 4050
|
||||
AND gamesinfo_id = 0 %s
|
||||
ORDER BY postdate DESC
|
||||
LIMIT %d',
|
||||
$this->renamed,
|
||||
$this->catWhere,
|
||||
$this->gameQty
|
||||
)
|
||||
);
|
||||
@@ -874,10 +875,10 @@ class Games
|
||||
$gameId = $gameCheck['id'];
|
||||
}
|
||||
// Update release.
|
||||
$this->pdo->queryExec(sprintf('UPDATE releases SET gamesinfo_id = %d WHERE id = %d', $gameId, $arr['id']));
|
||||
$this->pdo->queryExec(sprintf('UPDATE releases SET gamesinfo_id = %d WHERE id = %d %s', $gameId, $arr['id'], $this->catWhere));
|
||||
} else {
|
||||
// Could not parse release title.
|
||||
$this->pdo->queryExec(sprintf('UPDATE releases SET gamesinfo_id = %d WHERE id = %d', -2, $arr['id']));
|
||||
$this->pdo->queryExec(sprintf('UPDATE releases SET gamesinfo_id = %d WHERE id = %d %s', -2, $arr['id'], $this->catWhere));
|
||||
|
||||
if ($this->echoOutput) {
|
||||
echo '.';
|
||||
|
||||
+17
-2
@@ -796,12 +796,27 @@ class Music
|
||||
public function getGenres($activeOnly = false)
|
||||
{
|
||||
if ($activeOnly) {
|
||||
return $this->pdo->query("SELECT musicgenre.* FROM musicgenre INNER JOIN (SELECT DISTINCT musicgenreid FROM musicinfo) x ON x.musicgenreID = musicgenre.id ORDER BY title");
|
||||
return $this->pdo->query("
|
||||
SELECT ge.*
|
||||
FROM genres ge
|
||||
INNER JOIN
|
||||
(
|
||||
SELECT DISTINCT musicgenreid
|
||||
FROM musicinfo
|
||||
) x ON x.genreid = ge.id
|
||||
WHERE ge.type = " . Category::MUSIC_ROOT . "
|
||||
ORDER BY title"
|
||||
);
|
||||
} else {
|
||||
return $this->pdo->query("SELECT * FROM musicgenre ORDER BY title");
|
||||
return $this->pdo->query("
|
||||
SELECT * FROM genres
|
||||
WHERE type = " . Category::MUSIC_ROOT . "
|
||||
ORDER BY title"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $nodeId
|
||||
*
|
||||
|
||||
+23
-12
@@ -74,6 +74,13 @@ 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 (' .
|
||||
Category::XXX_DVD . ', ' .
|
||||
Category::XXX_WMV . ', ' .
|
||||
Category::XXX_XVID . ', ' .
|
||||
Category::XXX_X264 . ', ' .
|
||||
Category::XXX_SD . ', ' .
|
||||
Category::XXX_WEBDL . ') ';
|
||||
|
||||
if (NN_DEBUG || NN_LOGGING) {
|
||||
$this->debug = true;
|
||||
@@ -567,8 +574,9 @@ class XXX
|
||||
FROM releases r
|
||||
WHERE r.nzbstatus = 1
|
||||
AND r.xxxinfo_id = 0
|
||||
AND r.categoryid IN (6010, 6020, 6030, 6040, 6041, 6042, 6080, 6090)
|
||||
%s
|
||||
LIMIT %d",
|
||||
$this->catWhere,
|
||||
$this->movieqty
|
||||
)
|
||||
);
|
||||
@@ -605,7 +613,7 @@ class XXX
|
||||
} else {
|
||||
$this->pdo->log->doEcho(".", true);
|
||||
}
|
||||
$this->pdo->queryExec(sprintf('UPDATE releases SET xxxinfo_id = %d WHERE id = %d', $idcheck, $arr['id']));
|
||||
$this->pdo->queryExec(sprintf('UPDATE releases SET xxxinfo_id = %d WHERE id = %d %s', $idcheck, $arr['id'], $this->catWhere));
|
||||
}
|
||||
} elseif ($this->echooutput) {
|
||||
$this->pdo->log->doEcho($this->pdo->log->header('No xxx releases to process.'));
|
||||
@@ -673,13 +681,16 @@ class XXX
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function getAllGenres($activeOnly = false) {
|
||||
$res = $ret = null;
|
||||
public function getAllGenres($activeOnly = false)
|
||||
{
|
||||
$ret = null;
|
||||
|
||||
if ($activeOnly) {
|
||||
$res = $this->pdo->query("SELECT title FROM genres WHERE disabled = 0 AND type = 6000 ORDER BY title");
|
||||
$res = $this->pdo->query("SELECT title FROM genres WHERE disabled = 0 AND type = " .
|
||||
Category::XXX_ROOT . " ORDER BY title");
|
||||
} else {
|
||||
$res = $this->pdo->query("SELECT title FROM genres WHERE disabled = 1 AND type = 6000 ORDER BY title");
|
||||
$res = $this->pdo->query("SELECT title FROM genres WHERE disabled = 1 AND type = " .
|
||||
Category::XXX_ROOT . " ORDER BY title");
|
||||
}
|
||||
|
||||
foreach ($res as $arr => $value) {
|
||||
@@ -689,7 +700,7 @@ class XXX
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Genres for activeonly and/or an id
|
||||
* Get Genres for activeonly and/or an ID
|
||||
*
|
||||
* @param bool $activeOnly
|
||||
* @param null $gid
|
||||
@@ -699,15 +710,15 @@ class XXX
|
||||
public function getGenres($activeOnly = false, $gid = null)
|
||||
{
|
||||
if (isset($gid)) {
|
||||
$gid = " AND id = ". $this->pdo->escapeString($gid) . " ORDER BY title";
|
||||
$gid = " AND id = " . $this->pdo->escapeString($gid) . " ORDER BY title";
|
||||
} else {
|
||||
$gid = " ORDER BY title";
|
||||
}
|
||||
|
||||
if ($activeOnly) {
|
||||
return $this->pdo->queryOneRow("SELECT title FROM genres WHERE disabled = 0 AND type = 6000" . $gid);
|
||||
return $this->pdo->queryOneRow("SELECT title FROM genres WHERE disabled = 0 AND type = " . Category::XXX_ROOT . $gid);
|
||||
} else {
|
||||
return $this->pdo->queryOneRow("SELECT title FROM genres WHERE disabled = 1 AND type = 6000" . $gid);
|
||||
return $this->pdo->queryOneRow("SELECT title FROM genres WHERE disabled = 1 AND type = " . Category::XXX_ROOT . $gid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -743,7 +754,7 @@ class XXX
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts Genre and returns last affected row (Genre id)
|
||||
* Inserts Genre and returns last affected row (Genre ID)
|
||||
*
|
||||
* @param $genre
|
||||
*
|
||||
@@ -753,7 +764,7 @@ class XXX
|
||||
{
|
||||
$res = '';
|
||||
if (isset($genre)) {
|
||||
$res = $this->pdo->queryInsert(sprintf("INSERT INTO genres (title, type, disabled) VALUES (%s ,%d ,%d)",$this->pdo->escapeString($genre), 6000, 0));
|
||||
$res = $this->pdo->queryInsert(sprintf("INSERT INTO genres (title, type, disabled) VALUES (%s ,%d ,%d)", $this->pdo->escapeString($genre), Category::XXX_ROOT, 0));
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
use libs\Tmdb\TMDB;
|
||||
|
||||
use newznab\Category;
|
||||
use libs\Tmdb\TmdbAPI;
|
||||
use newznab\UserMovies;
|
||||
use newznab\Movie;
|
||||
|
||||
@@ -15,8 +17,8 @@ if (isset($_REQUEST['del'])) {
|
||||
} else if (isset($_REQUEST['add'])) {
|
||||
// Derive cats from user preferences.
|
||||
$cats = [];
|
||||
$cats[] = '2030';
|
||||
$cats[] = '2040';
|
||||
$cats[] = Category::MOVIE_SD;
|
||||
$cats[] = Category::MOVIE_HD;
|
||||
|
||||
$m = new Movie(['Settings' => $page->settings]);
|
||||
$mi = $m->getMovieInfo($_REQUEST['add']);
|
||||
@@ -30,7 +32,7 @@ if (isset($_REQUEST['del'])) {
|
||||
$page->show404();
|
||||
}
|
||||
|
||||
$tmdb = new TMDB($page->settings->getSetting('tmdbkey'), $page->settings->getSetting('imdblanguage'));
|
||||
$tmdb = new TmdbAPI($page->settings->getSetting('tmdbkey'), $page->settings->getSetting('imdblanguage'));
|
||||
$m = new Movie(['Settings' => $page->settings, 'TMDb' => $tmdb]);
|
||||
|
||||
if (is_numeric($_REQUEST['id'])) {
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@ $AniDB = new AniDB(['Settings' => $page->settings]);
|
||||
|
||||
if (isset($_GET['id']) && ctype_digit($_GET['id'])) {
|
||||
|
||||
# force the category to 5070 as it should be for anime, as $catarray was NULL and we know the category for sure for anime
|
||||
$releases = $Releases->searchbyAnidbId($_GET['id'], 0, 1000, '', ['5070'], -1);
|
||||
# force the category to TV_ANIME as it should be for anime, as $catarray was NULL and we know the category for sure for anime
|
||||
$releases = $Releases->searchbyAnidbId($_GET['id'], 0, 1000, '', [Category::TV_ANIME], -1);
|
||||
$anidb = $AniDB->getAnimeInfo($_GET['id']);
|
||||
|
||||
if (!$releases && !$anidb) {
|
||||
|
||||
Reference in New Issue
Block a user