Enhance GridPlanner with SlotFactory for improved slot composition and management
ci / build-backend (push) Successful in 1m35s
ci / build-frontend (push) Successful in 1m2s
ci / tests (push) Successful in 3m54s
ci / sonar (push) Successful in 4m22s

Refactored the GridPlanner class to introduce a SlotFactory for better organization and clarity in slot composition. Added detailed summaries for methods to improve code documentation and understanding. Enhanced the logic for handling content and repeat slots, ensuring more efficient management of grid slots during generation. These changes contribute to improved readability and maintainability of the code.
This commit is contained in:
Leonid Pershin
2026-07-27 19:53:01 +03:00
parent 986cf02b0d
commit e55161f8f9
2 changed files with 68 additions and 46 deletions
@@ -77,15 +77,17 @@ export function parseEpisodeName(name: string, opts?: ParseOptions): ParsedEpiso
// и движок перебирает варианты впустую (у Sonar это «super-linear backtracking»).
const SEASON_RANGES = [
/(?:s|season|сезоны?)[\s._-]*\d{1,2}[\s._]*[-][\s._]*(?:s|season)?\d{1,2}/i,
/\d{1,2}[\s._]*[-][\s._]*\d{1,2}[\s._-]*сезон/i,
/\d{1,2}[\s._]*[-][\s._]*\d{1,2}[\s._-]*(?:season|сезон)/i,
]
/** Сезон в имени одного сегмента пути: «S02», «Season 2», «Сезон 2», «2 сезон». */
/** Сезон в имени одного сегмента пути: «S02», «Season 2», «Сезон 2», «2 сезон», «3 Season». */
const SEASON_PATTERNS = [
// S02 — не часть более длинного числа (год «S2007» сезоном не считаем).
/(?:^|[^a-z0-9])s[\s._-]*(\d{1,2})(?!\d)/i,
/(?:season|сезон)[\s._-]*(\d{1,2})(?!\d)/i,
/(\d{1,2})[\s._-]*сезон/i,
// Номер перед словом — «3 Season», «2 сезон». Ограничение слева не даёт принять за сезон
// хвост года: в «2007 Season» это не третий сезон, а сезон 2007 года.
/(?:^|[^\d])(\d{1,2})[\s._-]*(?:season|сезон)/i,
]
/**