refactor(release): rename ParsedRelease.normalised → clean
Le champ s'appelait normalised mais ne faisait pas la normalisation suggérée par son nom (dots instead of spaces). En pratique il contient raw - site_tag - apostrophes, qui sert uniquement à season_folder_name() via _strip_episode_from_normalized. Renommé en 'clean' qui décrit ce qu'il contient réellement, docstring corrigée.
This commit is contained in:
@@ -62,7 +62,7 @@ def parse_release(
|
||||
if not _is_well_formed(clean, kb):
|
||||
parsed = ParsedRelease(
|
||||
raw=name,
|
||||
normalised=clean,
|
||||
clean=clean,
|
||||
title=clean,
|
||||
title_sanitized=kb.sanitize_for_fs(clean),
|
||||
year=None,
|
||||
@@ -92,7 +92,7 @@ def parse_release(
|
||||
|
||||
parsed = ParsedRelease(
|
||||
raw=name,
|
||||
normalised=clean,
|
||||
clean=clean,
|
||||
parse_path=parse_path,
|
||||
**fields,
|
||||
)
|
||||
|
||||
@@ -116,7 +116,7 @@ class ParsedRelease:
|
||||
"""
|
||||
|
||||
raw: str # original release name (untouched)
|
||||
normalised: str # dots instead of spaces
|
||||
clean: str # raw minus site_tag and apostrophes — used by season_folder_name()
|
||||
title: str # show/movie title (dots, no year/season/tech)
|
||||
title_sanitized: str # title with filesystem-forbidden chars stripped
|
||||
year: int | None # movie year or show start year (from TMDB)
|
||||
@@ -212,7 +212,7 @@ class ParsedRelease:
|
||||
For a single-episode release we still strip the episode token so the
|
||||
folder can hold the whole season.
|
||||
"""
|
||||
return _strip_episode_from_normalized(self.normalised)
|
||||
return _strip_episode_from_normalized(self.clean)
|
||||
|
||||
def episode_filename(self, tmdb_episode_title_safe: str | None, ext: str) -> str:
|
||||
"""
|
||||
|
||||
@@ -35,7 +35,7 @@ def _bare(**overrides) -> ParsedRelease:
|
||||
"""Build a minimal ParsedRelease with all enrichable fields = None."""
|
||||
defaults = dict(
|
||||
raw="X",
|
||||
normalised="X",
|
||||
clean="X",
|
||||
title="X",
|
||||
title_sanitized="X",
|
||||
year=None,
|
||||
|
||||
@@ -67,7 +67,7 @@ def _movie(year: int = 2020, **overrides) -> ParsedRelease:
|
||||
"""Build a populated movie ParsedRelease for scoring tests."""
|
||||
base = dict(
|
||||
raw="Inception.2010.1080p.BluRay.x264-GROUP",
|
||||
normalised="Inception.2010.1080p.BluRay.x264-GROUP",
|
||||
clean="Inception.2010.1080p.BluRay.x264-GROUP",
|
||||
title="Inception",
|
||||
title_sanitized="Inception",
|
||||
year=year,
|
||||
@@ -109,7 +109,7 @@ class TestComputeScore:
|
||||
def test_tv_show_gets_season_and_episode_weight(self) -> None:
|
||||
parsed = ParsedRelease(
|
||||
raw="Oz.S01E01.1080p.WEBRip.x265-KONTRAST",
|
||||
normalised="Oz.S01E01.1080p.WEBRip.x265-KONTRAST",
|
||||
clean="Oz.S01E01.1080p.WEBRip.x265-KONTRAST",
|
||||
title="Oz",
|
||||
title_sanitized="Oz",
|
||||
year=None,
|
||||
@@ -220,7 +220,7 @@ class TestCollectors:
|
||||
def test_collect_missing_critical_full(self) -> None:
|
||||
empty = ParsedRelease(
|
||||
raw="x",
|
||||
normalised="x",
|
||||
clean="x",
|
||||
title="",
|
||||
title_sanitized="",
|
||||
year=None,
|
||||
|
||||
Reference in New Issue
Block a user