Implement episode discovery #6
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/6/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?
Closes #5
Adds
src/sub2pod/discovery.pywith:Episodedataclass (audio_path,date,title,info: EpisodeInfo | None)discover_episodes(channel_dir): globs for.opus/.mp3/.m4a, pairs.nfosidecars, sorts newest-firstTests cover: empty dir, non-matching filenames skipped, each extension with and without sidecar, sort order, and real NAS data (skipped in CI).
src/sub2pod/discovery.pyline 30✅ Fixed in commits
3af81eeand2c6f672. Atry/except Exceptionnow wraps theparse_episode_nfocall; any parse failure (malformed XML, unreadable file, etc.) silently setsinfo=Noneso discovery of other episodes continues uninterrupted. A new test (returns Episode with info=None when .nfo sidecar contains malformed XML) was added to cover this case.src/sub2pod/discovery.pyline 24🔴 Not actioned. ytdl-sub produces a single audio format per episode, so duplicate stems are not expected in practice. If an episode does exist in two formats, treating them as independent
Episodeobjects is the correct behaviour — Phase 4 (RSS generation) will emit a separate<enclosure>for each, letting clients pick the format they support. Deduplicating here would require choosing a preferred format, which is a Phase 4 concern. A new test (discovers multiple audio formats for the same stem as separate episodes) documents this intentional behaviour.tests/test_discovery.pyline 1✅ Added in commit
3af81ee:returns Episode with info=None when .nfo sidecar contains malformed XML. It creates an audio file with a corrupt NFO sidecar and asserts thatdiscover_episodesreturns the episode withinfo=Nonerather than raising. The corresponding implementation fix landed in2c6f672.tests/test_discovery.pyline 1✅ Added in commit
3af81ee:discovers multiple audio formats for the same stem as separate episodes. The test confirms that both.opusand.mp3files for the same stem are independently discovered. Deduplication is intentionally not implemented — see the reply to the related MEDIUM comment for the rationale.ROADMAP.mdline 10✅ Fixed in commit
a6ae848—[X]changed to[x]for consistency.