Remove usage of preMatch

This commit is contained in:
DariusIII
2026-04-14 12:21:15 +02:00
parent e3a6b10708
commit c29f1137f7
+11 -26
View File
@@ -1283,23 +1283,20 @@ class NameFixingService
continue;
}
$preMatch = $this->preMatch($cleanedFileName);
if ($preMatch[0] === true) {
$results = Search::searchPredb($preMatch[1]);
$results = Search::searchPredb($cleanedFileName);
if (! empty($results)) {
$bestMatch = $this->predbMatchSelector->selectBestMatch($cleanedFileName, $results);
if (! empty($results)) {
$bestMatch = $this->predbMatchSelector->selectBestMatch($cleanedFileName, $results);
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;
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;
}
}
}
@@ -1307,18 +1304,6 @@ class NameFixingService
return $matching;
}
/**
* Pre-match check for filename patterns.
*
* @return array<int, bool|string>
*/
protected function preMatch(string $fileName): array
{
$result = preg_match('/(\d{2}\.\d{2}\.\d{2})+([\w\-.]+[\w]$)/i', $fileName, $hit);
return [$result === 1, $hit[0] ?? ''];
}
/**
* Check if a release name looks like a season pack.
* Season packs have S01/S02 etc. without an episode (E01) suffix.