mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 01:08:56 +00:00
Check for empty filename before processing filename matching
This commit is contained in:
+20
-18
@@ -1200,25 +1200,27 @@ class NameFixer
|
||||
{
|
||||
$matching = 0;
|
||||
|
||||
foreach (explode('||', $release->filename) as $key => $fileName) {
|
||||
$this->_fileName = $fileName;
|
||||
$this->_cleanMatchFiles();
|
||||
$preMatch = $this->preMatch($this->_fileName);
|
||||
if ($preMatch[0] === true) {
|
||||
foreach (Predb::search($preMatch[1])->get()->chunk(1000)->first() as $result) {
|
||||
$preFtMatch = $this->preMatch($result['filename']);
|
||||
if ($preFtMatch[0] === true) {
|
||||
similar_text($preMatch[1], $preFtMatch[1], $percent);
|
||||
if ($percent >= 93) {
|
||||
$this->_fileName = $result['filename'];
|
||||
$release->filename = $this->_fileName;
|
||||
if ($result['title'] !== $release->searchname) {
|
||||
$this->updateRelease($release, $result['title'], $method = 'file matched source: '.$result['source'], $echo, 'PreDB file match, ', $nameStatus, $show, $result['id']);
|
||||
} else {
|
||||
$this->_updateSingleColumn('predb_id', $result['id'], $release->releases_id);
|
||||
if (! empty($release->filename)) {
|
||||
foreach (explode('||', $release->filename) as $key => $fileName) {
|
||||
$this->_fileName = $fileName;
|
||||
$this->_cleanMatchFiles();
|
||||
$preMatch = $this->preMatch($this->_fileName);
|
||||
if ($preMatch[0] === true) {
|
||||
foreach (Predb::search($preMatch[1])->get()->chunk(1000)->first() as $result) {
|
||||
$preFtMatch = $this->preMatch($result['filename']);
|
||||
if ($preFtMatch[0] === true) {
|
||||
similar_text($preMatch[1], $preFtMatch[1], $percent);
|
||||
if ($percent >= 93) {
|
||||
$this->_fileName = $result['filename'];
|
||||
$release->filename = $this->_fileName;
|
||||
if ($result['title'] !== $release->searchname) {
|
||||
$this->updateRelease($release, $result['title'], $method = 'file matched source: '.$result['source'], $echo, 'PreDB file match, ', $nameStatus, $show, $result['id']);
|
||||
} else {
|
||||
$this->_updateSingleColumn('predb_id', $result['id'], $release->releases_id);
|
||||
}
|
||||
$matching++;
|
||||
break;
|
||||
}
|
||||
$matching++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user