feat: primary-clip variant detection, commentary specials, disc8/disc9 fixtures#19
Merged
feat: primary-clip variant detection, commentary specials, disc8/disc9 fixtures#19
Conversation
Add disc8 fixture from a two-episode OVA disc (vol 3 of box set): - 2 episodes: ep1 (54min, 4 scenes), ep2 (60min, 4 scenes) - 2 specials: stream variants of same clip (different audio tracks) - Play-all playlist (00002.mpls) with both episodes + outro - Generic disc title via META/DL/bdmt_eng.xml Tests: episode count, ordering, scene counts, durations, special count/durations, disc title, play-all classification. Matrix entries for episodes, specials, segments, chapter-split, title. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add disc9 fixture from a single-movie disc (vol 4 of box set): - 2 playlists sharing main clip 00006 (~90min) with different secondary clips and stream layouts (stream variants) - Analysis finds 2 episodes, 0 specials (user expects 1 ep + 1 special) - Known limitation: stream-variant playlists with different secondary clips are not detected as duplicates - Generic disc title via META/DL/bdmt_eng.xml Tests: episode count, ordering, shared clip, durations, scene counts, no specials, disc title. Matrix entries for all 6 parametrizations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…sode Add find_primary_clip_variants() to signatures.py that groups playlists sharing the same dominant first clip (>85% of total duration) with similar timing, even when secondary clips differ (e.g. alt-audio or commentary versions with different outros). Add _maybe_collapse_variant_episodes() to prevent chapter splitting from incorrectly decomposing a single movie into multiple episodes when variant dedup reduces the episode playlist count to one. This fixes disc9 analysis: was 2 episodes + 0 specials, now correctly produces 1 episode + 1 special (alt-audio variant). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add commentary special detection: IG menu buttons that JumpTitle to episode playlists from non-chapter-selection pages are recognized as audio commentary features. A chapter-selection page is identified by having all JumpTitle buttons targeting the same title number. Add ICS file fallback to _parse_ig_hints so test fixtures without STREAM/*.m2ts can still provide IG menu data via ics_menu.bin. Skip stream-variant playlists in special feature detection using the existing variant_mpls set from the dedup pipeline. Disc8 now correctly detects 3 specials (2 commentaries + 1 lyrics credit ending) matching the disc menu. Disc2 ICS fallback loads 27 hints but produces no false commentary detections. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add primary-clip variant detection, commentary special detection via IG menu analysis, and ICS fallback loading for test fixtures. Add disc8 and disc9 fixtures with integration tests.
Background
Some Blu-ray discs include multiple playlists for the same content with different audio tracks or short ending clips. These were not caught by exact signature dedup because their full segment keys differ. This caused disc9 (single-movie disc) to be incorrectly analyzed as 2 episodes + 0 specials instead of 1 episode + 1 special.
Additionally, disc menus can list audio commentary tracks as special features — these are IG menu buttons that JumpTitle to episode playlists (not separate playlists). Without IG analysis, these were invisible to the special feature detector.
Changes
Primary-clip variant detection
bdpl/analyze/signatures.py: Addfind_primary_clip_variants()— groups playlists sharing the same dominant first clip (>85% of total duration) with similar timingbdpl/analyze/__init__.py: Integrate variant detection into dedup pipeline (step 1b); add_maybe_collapse_variant_episodes()to prevent chapter splitting when variant dedup reduces episode count to oneCommentary special detection (new)
bdpl/analyze/__init__.py:_detect_special_features()now identifies IG menu buttons that JumpTitle to episode playlists from non-chapter-selection pages ascommentaryspecialsvariant_mplssetICS fallback loading (new)
bdpl/analyze/__init__.py:_parse_ig_hints()now falls back to loadingics_menu.binfrom the BDMV path when no STREAM/*.m2ts files are available — enables IG-based analysis in test fixtures without bundling media streamsDisc8 fixture
tests/fixtures/disc8/: 7 MPLS, 11 CLPI, index.bdmv, MovieObject.bdmv, META/DL/bdmt_eng.xml, ics_menu.bintests/test_disc8_scan.py: 2 episodes (4 scenes each), 3 specials (2 commentaries + 1 lyrics ending)Disc9 fixture
tests/fixtures/disc9/: 4 MPLS, 9 CLPI, index.bdmv, MovieObject.bdmv, META/DL/bdmt_eng.xmltests/test_disc9_scan.py: 1 episode (movie ~90min), 1 special (alt-audio variant)Shared changes
tests/conftest.py: Add disc8/disc9 path and analysis fixturestests/test_disc_matrix.py: Add disc8/disc9 to all 6 matrix parametrizationsTesting
ruff check .— all checks passedruff format .— all files formattedpytest -q— 186 tests passed (up from 154)Additional Notes