mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 17:01:16 +00:00
Remove usage of preMatch
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user