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):
|
if not _is_well_formed(clean, kb):
|
||||||
parsed = ParsedRelease(
|
parsed = ParsedRelease(
|
||||||
raw=name,
|
raw=name,
|
||||||
normalised=clean,
|
clean=clean,
|
||||||
title=clean,
|
title=clean,
|
||||||
title_sanitized=kb.sanitize_for_fs(clean),
|
title_sanitized=kb.sanitize_for_fs(clean),
|
||||||
year=None,
|
year=None,
|
||||||
@@ -92,7 +92,7 @@ def parse_release(
|
|||||||
|
|
||||||
parsed = ParsedRelease(
|
parsed = ParsedRelease(
|
||||||
raw=name,
|
raw=name,
|
||||||
normalised=clean,
|
clean=clean,
|
||||||
parse_path=parse_path,
|
parse_path=parse_path,
|
||||||
**fields,
|
**fields,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class ParsedRelease:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
raw: str # original release name (untouched)
|
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: str # show/movie title (dots, no year/season/tech)
|
||||||
title_sanitized: str # title with filesystem-forbidden chars stripped
|
title_sanitized: str # title with filesystem-forbidden chars stripped
|
||||||
year: int | None # movie year or show start year (from TMDB)
|
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
|
For a single-episode release we still strip the episode token so the
|
||||||
folder can hold the whole season.
|
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:
|
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."""
|
"""Build a minimal ParsedRelease with all enrichable fields = None."""
|
||||||
defaults = dict(
|
defaults = dict(
|
||||||
raw="X",
|
raw="X",
|
||||||
normalised="X",
|
clean="X",
|
||||||
title="X",
|
title="X",
|
||||||
title_sanitized="X",
|
title_sanitized="X",
|
||||||
year=None,
|
year=None,
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ def _movie(year: int = 2020, **overrides) -> ParsedRelease:
|
|||||||
"""Build a populated movie ParsedRelease for scoring tests."""
|
"""Build a populated movie ParsedRelease for scoring tests."""
|
||||||
base = dict(
|
base = dict(
|
||||||
raw="Inception.2010.1080p.BluRay.x264-GROUP",
|
raw="Inception.2010.1080p.BluRay.x264-GROUP",
|
||||||
normalised="Inception.2010.1080p.BluRay.x264-GROUP",
|
clean="Inception.2010.1080p.BluRay.x264-GROUP",
|
||||||
title="Inception",
|
title="Inception",
|
||||||
title_sanitized="Inception",
|
title_sanitized="Inception",
|
||||||
year=year,
|
year=year,
|
||||||
@@ -109,7 +109,7 @@ class TestComputeScore:
|
|||||||
def test_tv_show_gets_season_and_episode_weight(self) -> None:
|
def test_tv_show_gets_season_and_episode_weight(self) -> None:
|
||||||
parsed = ParsedRelease(
|
parsed = ParsedRelease(
|
||||||
raw="Oz.S01E01.1080p.WEBRip.x265-KONTRAST",
|
raw="Oz.S01E01.1080p.WEBRip.x265-KONTRAST",
|
||||||
normalised="Oz.S01E01.1080p.WEBRip.x265-KONTRAST",
|
clean="Oz.S01E01.1080p.WEBRip.x265-KONTRAST",
|
||||||
title="Oz",
|
title="Oz",
|
||||||
title_sanitized="Oz",
|
title_sanitized="Oz",
|
||||||
year=None,
|
year=None,
|
||||||
@@ -220,7 +220,7 @@ class TestCollectors:
|
|||||||
def test_collect_missing_critical_full(self) -> None:
|
def test_collect_missing_critical_full(self) -> None:
|
||||||
empty = ParsedRelease(
|
empty = ParsedRelease(
|
||||||
raw="x",
|
raw="x",
|
||||||
normalised="x",
|
clean="x",
|
||||||
title="",
|
title="",
|
||||||
title_sanitized="",
|
title_sanitized="",
|
||||||
year=None,
|
year=None,
|
||||||
|
|||||||
Reference in New Issue
Block a user