mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-09-02 11:18:56 +00:00
Small improvements in additional processing.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
2016-05-09 DariusIII
|
||||
* Upd: Small improvements in additional processing
|
||||
* Fix: Wrong class in Movie.php
|
||||
* Chg: Replace/remove refferences to python scripts where possible.
|
||||
* Fix: Change TIME() to lowercase time()
|
||||
|
||||
+16
-5
@@ -326,12 +326,24 @@ class Category
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the parent and category name from the supplied categoryID.
|
||||
* @param $ID
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNameByID($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"];
|
||||
$cat = $this->pdo->queryOneRow(
|
||||
sprintf("
|
||||
SELECT c.title AS ctitle, cp.title AS ptitle
|
||||
FROM categories c
|
||||
INNER JOIN categories cp ON c.parentid = cp.id
|
||||
WHERE c.id = %d",
|
||||
$ID
|
||||
)
|
||||
);
|
||||
return $cat["ptitle"] . " -> " . $cat["ctitle"];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -441,5 +453,4 @@ class Category
|
||||
" ORDER BY c.id"
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -686,6 +686,9 @@ class NameFixer
|
||||
case "Extension, ":
|
||||
$status = "isrenamed = 1, iscategorized = 1,";
|
||||
break;
|
||||
case "CRC/OSO, ":
|
||||
$status = "isrenamed = 1, iscategorized = 1,";
|
||||
break;
|
||||
}
|
||||
$this->pdo->queryExec(
|
||||
sprintf('
|
||||
|
||||
+6
-4
@@ -74,10 +74,12 @@ Class PreDb
|
||||
|
||||
$res = $this->pdo->queryDirect(
|
||||
sprintf('
|
||||
SELECT p.id AS preid, r.id AS releaseid
|
||||
FROM predb p
|
||||
INNER JOIN releases r ON p.title = r.searchname
|
||||
WHERE r.preid < 1 %s',
|
||||
SELECT p.id AS preid, r.id AS releaseid
|
||||
FROM predb p
|
||||
INNER JOIN releases r
|
||||
FORCE INDEX (ix_releases_preid_searchname)
|
||||
ON p.title = r.searchname
|
||||
WHERE r.preid < 1 %s',
|
||||
$datesql
|
||||
)
|
||||
);
|
||||
|
||||
@@ -209,6 +209,11 @@ class ProcessAdditional
|
||||
*/
|
||||
protected $_nfo;
|
||||
|
||||
/**
|
||||
* @var \newznab\processing\post\CRC
|
||||
*/
|
||||
protected $_crc;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
@@ -381,6 +386,17 @@ class ProcessAdditional
|
||||
*/
|
||||
protected $_compressedFilesChecked;
|
||||
|
||||
/**
|
||||
* Should we download the last rar?
|
||||
* @var bool
|
||||
*/
|
||||
protected $_fetchLastFiles;
|
||||
/**
|
||||
* Are we downloading the last rar?
|
||||
* @var bool
|
||||
*/
|
||||
protected $_reverse;
|
||||
|
||||
/**
|
||||
* @param array $options Class instances / echo to cli.
|
||||
*/
|
||||
@@ -420,10 +436,14 @@ class ProcessAdditional
|
||||
$this->_srrInfo = new \SrrInfo();
|
||||
$this->_nfo = ($options['Nfo'] instanceof Nfo ? $options['Nfo'] : new Nfo(['Echo' => $this->_echoCLI, 'Settings' => $this->pdo]));
|
||||
$this->sphinx = ($options['SphinxSearch'] instanceof SphinxSearch ? $options['SphinxSearch'] : new SphinxSearch());
|
||||
if (class_exists('newznab\processing\post\CRC')) {
|
||||
$this->_crc = new CRC(['Settings' => $this->pdo, 'Echo' => $this->_echoCLI, 'NameFixer' => $this->_nameFixer]);
|
||||
}
|
||||
|
||||
$this->_innerFileBlacklist = ($this->pdo->getSetting('innerfileblacklist') == '' ? false : $this->pdo->getSetting('innerfileblacklist'));
|
||||
$this->_maxNestedLevels = ($this->pdo->getSetting('maxnestedlevels') == 0 ? 3 : $this->pdo->getSetting('maxnestedlevels'));
|
||||
$this->_extractUsingRarInfo = ($this->pdo->getSetting('extractusingrarinfo') == 0 ? false : true);
|
||||
$this->_fetchLastFiles = ($this->pdo->getSetting('fetchlastcompressedfiles') == 0 ? false : true);
|
||||
|
||||
$this->_7zipPath = false;
|
||||
$this->_unrarPath = false;
|
||||
@@ -626,7 +646,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.categories_id, r.searchname, r.preid
|
||||
SELECT r.id, r.id AS releaseid, r.guid, r.name, r.size, r.groupid,
|
||||
r.nfostatus, r.completion, r.categories_id, r.searchname, r.preid,
|
||||
c.disablepreview
|
||||
FROM releases r
|
||||
LEFT JOIN categories c ON c.id = r.categories_id
|
||||
WHERE r.nzbstatus = 1
|
||||
@@ -729,7 +751,7 @@ class ProcessAdditional
|
||||
$this->_processNZBCompressedFiles();
|
||||
|
||||
// Download rar/zip in reverse order, to get the last rar or zip file.
|
||||
if ($this->pdo->getSetting('fetchlastcompressedfiles') == 1) {
|
||||
if ($this->_fetchLastFiles == 1) {
|
||||
$this->_processNZBCompressedFiles(true);
|
||||
}
|
||||
|
||||
@@ -981,7 +1003,8 @@ class ProcessAdditional
|
||||
*/
|
||||
protected function _processNZBCompressedFiles($reverse = false)
|
||||
{
|
||||
if ($reverse) {
|
||||
$this->_reverse = $reverse;
|
||||
if ($this->_reverse) {
|
||||
if (!krsort($this->_nzbContents)) {
|
||||
return;
|
||||
}
|
||||
@@ -1098,6 +1121,20 @@ class ProcessAdditional
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isset($this->_crc) && $this->_reverse === true) {
|
||||
$fileData = (isset($dataSummary['file_list'][0]) ? $dataSummary['file_list'][0] : '');
|
||||
if(isset($fileData['crc32']) && isset($fileData['size']) && $fileData['size'] > 104857600) {
|
||||
$matchedCRC = $this->_crc->checkCRCInfo(
|
||||
$this->_release,
|
||||
$fileData['crc32'],
|
||||
$fileData['size'],
|
||||
'',
|
||||
$fileData['date']
|
||||
);
|
||||
$this->_release['preid'] = ($matchedCRC !== false ? $matchedCRC : 0);
|
||||
}
|
||||
}
|
||||
|
||||
switch ($dataSummary['main_type']) {
|
||||
case \ArchiveInfo::TYPE_RAR:
|
||||
if ($this->_echoCLI) {
|
||||
|
||||
Reference in New Issue
Block a user