Add NFO parsing for channel and episode metadata #4
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/4/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements Phase 2 of the roadmap: ChannelInfo and EpisodeInfo dataclasses, parsers for tvshow.nfo and Kodi episodedetails NFO sidecars, and a regex filename fallback for episodes without a sidecar.
Also bundles the bootstrap cleanup from Phase 1: adds .gitignore and commits the previously-staged .pre-commit-config.yaml, .woodpecker/ai-review.yml, pylock.toml, pyproject.toml, and uv.lock.
Closes #3
src/sub2pod/nfo.pyline 7 — @marvin8🔴 Not actioning.
# ty: ignore[unresolved-import]is the correct suppression syntax for Ruff'stytype checker — it is distinct from mypy's# type: ignore. Both are present on the same codebase; usingtype: ignorehere would suppress the diagnostic only in mypy-compatible checkers and leavetyreporting the error. The annotation is intentional.src/sub2pod/nfo.pyline 26 — @marvin8🔴 Not actioning at this layer. The parsing functions are intentionally thin: they receive a
Paththat the caller already located, and they propagate parse failures as exceptions. Deciding whether to skip a malformed file, log a warning, or abort belongs to the episode-discovery caller (Phase 3). SwallowingXMLSyntaxErrorhere would silently drop corrupted channel data. Note: this comment appears to be a duplicate of #issuecomment-17603165.src/sub2pod/nfo.pyline 26 — @marvin8🔴 Not actioning — same reasoning as #issuecomment-17603162 (duplicate comment). Error handling for missing/corrupt files belongs at the Phase 3 discovery layer, not inside the parser.
src/sub2pod/nfo.pyline 40 — @marvin8✅ Fixed in commit
fa1ebd6.parse_episode_nfonow wraps thedate.fromisoformatcall intry/except ValueErrorand returnsNoneforairedif the value is malformed. A test covering this case (returns None aired when value is not a valid ISO date) was also added.src/sub2pod/nfo.pyline 41 — @marvin8✅ Fixed in commit
fa1ebd6.parse_episode_nfonow wraps theint()conversion intry/except ValueErrorand returnsNoneforruntimeif the value is malformed. A test covering this case (returns None runtime when value is not a valid integer) was also added.src/sub2pod/nfo.pyline 53 — @marvin8✅ Fixed in commit
fa1ebd6.parse_episode_filenamenow wrapsdate.fromisoformatintry/except ValueErrorand returnsNonefor filenames whose date portion is calendar-invalid (the regex enforces theYYYY-MM-DDformat, but cannot reject impossible dates like Feb 30). A test covering this (returns None for a filename with a calendar-invalid date) was also added.tests/test_nfo.pyline 150 — @marvin8✅ Addressed in commit
fa1ebd6:returns empty string title when title element is absentreturns None aired when value is not a valid ISO date(and fixed the guard)returns None runtime when value is not a valid integer(and fixed the guard)returns None for a filename with a calendar-invalid date(and fixed the guard)