Skip to content

Conversation

@mapitman
Copy link
Owner

Closes #35

Summary

Implements automatic detection of disc content type (movie vs TV series) based on title structure analysis. Users no longer need to specify --mode explicitly - the application intelligently detects the content type by default.

Changes

Core Detection

  • IDiscTypeDetector & DiscTypeDetector: Analyzes disc structure to determine content type
    • Movies: Single/few titles, longer durations, significant separation between main/bonus
    • TV Series: Multiple titles (20-55 min) with low variation, consistent episode patterns
    • Uses coefficient of variation (CV) thresholds for confidence scoring
  • DiscInfo: Added DetectedContentType and DetectionConfidence properties
  • DiscScanner: Performs detection during scan, stores results in DiscInfo
  • DiscRipper: Uses detection results, displays emoji (🎬/📺) with confidence percentage

User Experience

  • RipOptions:
    • New AutoDetect flag (default: true)
    • --mode auto|movie|tv now supports auto (and detect)
    • Explicit --mode movie|tv disables auto-detect
    • --tv flag also disables auto-detect
  • Help text: Updated to show --mode optional with auto default
  • Examples: Demonstrate auto-detect usage alongside explicit mode

Testing

  • DiscTypeDetectorTests: 4 tests covering movie/TV/uncertain scenarios
  • RipOptionsTests: 3 new tests for auto-detect behavior
  • All tests passing (104/104) ✓

Documentation

  • README.md: Updated to show --mode optional, auto-detect default
  • EXAMPLES.md: Added auto-detect examples, kept explicit variants
  • Help output: Already reflects optional --mode with detailed descriptions

Verified

Tested on real discs:

  • Movie disc (The Simpsons Movie): 🎬 Detected as movie (confidence: 85%) ✓
  • TV disc (Legend of Korra S1): 📺 Detected as TV series (confidence: 92%) ✓

Migration

No breaking changes - existing --mode movie|tv usage continues to work. Auto-detect is opt-in by default but can be overridden.

- add IDiscTypeDetector and DiscTypeDetector for content-type detection
- move detection into DiscScanner so scan builds DiscInfo with detection results
- store DetectedContentType and DetectionConfidence on DiscInfo
- use detection result in DiscRipper (with 🎬/📺 emoji) when auto-detecting
- add AutoDetect flag and --mode auto|movie|tv handling in RipOptions
- register detector in DI container
- keep default temp under output and update help text accordingly

Detection currently targets movie vs TV heuristics; further TV refinements next.
- enhance TV series detection heuristics with refined thresholds
  - detect TV when most titles are 20-55 min with low variation (CV < 0.15/0.25)
  - detect movie when one long title + many shorts or two long titles
  - improved coefficient of variation analysis for episode consistency
- fix emoji: use 📺 for TV instead of 📻 (radio)
- add comprehensive test coverage:
  - DiscTypeDetectorTests with movie/TV/uncertain scenarios
  - RipOptionsTests for auto-detect, --mode auto, and --tv flag
  - fix invalid mode error message test expectation
  - all tests passing (104/104)
- update documentation:
  - README: show --mode optional with auto default
  - EXAMPLES: demonstrate auto-detect usage
  - help text already reflected optional --mode

Verified detection on real discs:
- Movie disc: 85% confidence ✓
- TV disc: 92% confidence ✓
Copilot AI review requested due to automatic review settings January 11, 2026 07:28
@mapitman mapitman self-assigned this Jan 11, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements automatic detection of disc content type (movie vs TV series) based on structural analysis of disc titles and durations. The feature enables users to rip content without specifying --mode explicitly, as the application now intelligently detects whether the disc contains a movie or TV series by default.

Changes:

  • Added DiscTypeDetector with heuristic-based detection using title count, duration patterns, and coefficient of variation analysis
  • Extended DiscInfo with DetectedContentType and DetectionConfidence properties
  • Modified RipOptions to support auto-detection mode with --mode auto|detect and default AutoDetect=true

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
src/RipSharp/IDiscTypeDetector.cs New interface for content type detection with confidence scoring
src/RipSharp/DiscTypeDetector.cs Core detection implementation using statistical analysis of title durations
src/RipSharp/DiscInfo.cs Added properties for detected content type and confidence
src/RipSharp/DiscScanner.cs Integrated detector into scan pipeline
src/RipSharp/DiscRipper.cs Uses detection results and displays emoji indicators with confidence
src/RipSharp/RipOptions.cs Added AutoDetect flag, updated mode parsing to support auto/detect
src/RipSharp/Program.cs Registered IDiscTypeDetector in DI container
src/RipSharp.Tests/DiscTypeDetectorTests.cs Added 4 tests covering movie/TV/uncertain scenarios
src/RipSharp.Tests/RipOptionsTests.cs Added 3 tests for auto-detect behavior
README.md Updated documentation to show --mode as optional
EXAMPLES.md Added auto-detect examples

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- create IUserPrompt interface for testable user interaction
- implement ConsoleUserPrompt using Spectre.Console SelectionPrompt
- inject IUserPrompt into DiscRipper via DI
- prompt user when detection confidence is below 70%
- show detection hint with confidence percentage
- clean menu selection (Movie/TV Series) via Spectre.Console
- register ConsoleUserPrompt in DI container

Improves UX for edge cases where heuristics are uncertain by
allowing user to confirm or override detection results.
- Add tests for high/low confidence movie detection
- Add test for high confidence TV detection
- Verify 70% threshold behavior
- Ensure prompting triggers appropriately
- Add null check for --mode argument value
- Fix thread-safety by returning tuple instead of mutable state
- Add division by zero checks in CV calculations
- Remove unused assignment (durations variable)
- Add comment documenting options mutation
- Add tests for zero-duration titles
- Add test for two-episode TV disc detection
- Add test for --mode detect alias
- Add test for missing --mode value
- Add AutoDetect assertions to existing tests
- All 111 tests passing

Addresses all code review comments from copilot-pull-request-reviewer
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

mapitman and others added 4 commits January 11, 2026 00:06
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mapitman mapitman merged commit fd8e722 into main Jan 11, 2026
1 check passed
@mapitman mapitman deleted the feature/auto-detect-disc-type branch January 11, 2026 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Auto-detect disc type (movie vs TV series)

2 participants