From c29f1137f705fd791513ac19d4999e10da132dab Mon Sep 17 00:00:00 2001 From: DariusIII Date: Tue, 14 Apr 2026 12:21:15 +0200 Subject: [PATCH] Remove usage of preMatch --- app/Services/NameFixing/NameFixingService.php | 37 ++++++------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/app/Services/NameFixing/NameFixingService.php b/app/Services/NameFixing/NameFixingService.php index e02e82e0e..5d91b0bc4 100644 --- a/app/Services/NameFixing/NameFixingService.php +++ b/app/Services/NameFixing/NameFixingService.php @@ -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 - */ - 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.