Check for empty filename before processing filename matching

This commit is contained in:
DariusIII
2018-10-19 09:36:41 +02:00
parent 3f4397ffce
commit 78148e52f4
2 changed files with 21 additions and 18 deletions
+20 -18
View File
@@ -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;
}
}
}
+1
View File
@@ -1,4 +1,5 @@
2018-10-19 DariusIII
* Chg: Check for empty filename before processing filename matching
* Chg: Increase matching percentage for matchPreDbFiles function
2018-10-18 DariusIII
* Chg: Remove unused $this->pdo instances