diff --git a/Blacklight/NameFixer.php b/Blacklight/NameFixer.php index 0f8c25099..8815f6e4b 100755 --- a/Blacklight/NameFixer.php +++ b/Blacklight/NameFixer.php @@ -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; } } } diff --git a/Changelog b/Changelog index 1a4d8a77e..6400ef0e7 100755 --- a/Changelog +++ b/Changelog @@ -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