Fix bad predb match logic

This commit is contained in:
DariusIII
2026-04-14 11:31:49 +02:00
parent 3b78ea0a6e
commit 12daa96d14
2 changed files with 60 additions and 13 deletions
+9 -13
View File
@@ -1288,21 +1288,17 @@ class NameFixingService
$results = Search::searchPredb($preMatch[1]);
if (! empty($results)) {
foreach ($results as $result) {
if (! empty($result)) {
$resultData = is_array($result) ? $result : (array) $result;
$preFtMatch = $this->preMatch($resultData['filename'] ?? '');
if ($preFtMatch[0] === true) {
if ($resultData['title'] !== $release->searchname) {
$this->updateService->updateRelease($release, $resultData['title'], 'file matched source: '.($resultData['source'] ?? ''), $echo, 'PreDB file match, ', $nameStatus, $show);
} else {
$this->updateService->updateSingleColumn('predb_id', $resultData['id'] ?? 0, $release->releases_id);
}
$matching++;
$bestMatch = $this->predbMatchSelector->selectBestMatch($cleanedFileName, $results);
return $matching;
}
if ($bestMatch !== null) {
if ($bestMatch['title'] !== $release->searchname) {
$this->updateService->updateRelease($release, $bestMatch['title'], 'file matched source: '.($bestMatch['source'] ?? ''), $echo, 'PreDB file match, ', $nameStatus, $show);
} else {
$this->updateService->updateSingleColumn('predb_id', $bestMatch['id'] ?? 0, $release->releases_id);
}
$matching++;
return $matching;
}
}
}