refactor: tech debt mini-pass (items 5, 6, 7, 20)
Low-risk cleanup items, no functional change to the parser. The philosophy remains: keep the parser simple, the AI handles edge cases. - Extract duplicated 'fs-safe title → dot-folder-name' regex into to_dot_folder_name() in domain/shared/value_objects.py. Used by both MovieTitle.normalized() and TVShow.get_folder_name() (item #5). - ParsedRelease.languages now uses field(default_factory=list) instead of a manual __post_init__ assigning [] via object.__setattr__ (#6). - tv_shows/entities.py module docstring: prepend ASCII ownership tree for quicker visual scan of the aggregate hierarchy (#7). - file_extensions.yaml: split subtitle sidecars (.srt/.sub/.idx/.ass/.ssa) into a dedicated 'subtitle:' category instead of lumping them under 'metadata:'. _METADATA_EXTENSIONS at the value_objects.py level remains the union of both — detect_media_type behavior unchanged. New loader load_subtitle_extensions() exposes the distinct subtitle set for future callers in the subtitles domain (#20). Suite: 1020 passed, 8 skipped.
This commit is contained in:
@@ -112,6 +112,22 @@ callers).
|
||||
|
||||
### Internal
|
||||
|
||||
- **`to_dot_folder_name(title)` helper** in
|
||||
`alfred/domain/shared/value_objects.py` — extracts the
|
||||
`re.sub(r"[^\w\s\.\-]", "", title).replace(" ", ".")` pattern that was
|
||||
duplicated between `MovieTitle.normalized()` and `TVShow.get_folder_name()`.
|
||||
- **`ParsedRelease.languages` uses `field(default_factory=list)`** instead of
|
||||
a manual `__post_init__` that assigned `[]` via `object.__setattr__`.
|
||||
- **`file_extensions.yaml` splits subtitle sidecars (`.srt`, `.sub`, `.idx`,
|
||||
`.ass`, `.ssa`) into a dedicated `subtitle:` category** instead of lumping
|
||||
them under `metadata:`. The `_METADATA_EXTENSIONS` set used by
|
||||
`detect_media_type` remains the union of both (same behavior — subtitles
|
||||
are still ignored when deciding the media type of a folder), but a new
|
||||
`load_subtitle_extensions()` loader is now available for the subtitles
|
||||
domain. Sematic clarity, no functional change.
|
||||
- **`tv_shows/entities.py` module docstring** now shows the aggregate
|
||||
ownership as an ASCII tree before the rule text — quicker visual scan
|
||||
of the DDD structure.
|
||||
- Removed backward-compat shims `_sanitise_for_fs` /
|
||||
`_strip_episode_from_normalised` from `domain/release/value_objects.py`
|
||||
(zero callers).
|
||||
|
||||
Reference in New Issue
Block a user