Skip to content

feat: mid-rip main-feature redirect with smarter track selection - #72

Merged
negativeeddy merged 4 commits into
masterfrom
feat/main-feature-redirect
Aug 15, 2026
Merged

feat: mid-rip main-feature redirect with smarter track selection#72
negativeeddy merged 4 commits into
masterfrom
feat/main-feature-redirect

Conversation

@negativeeddy

Copy link
Copy Markdown
Owner

Summary

Fixes the case where a disc's automatically-selected main feature is wrong (e.g. a featurette marginally longer than the movie) by letting the user redirect a rip in progress to a different track. The choice is remembered per disc fingerprint for future rips.

What changed

Track selection (ArmRipperService.SelectMainFeatureTrack)

  • Longest eligible track wins, but near-duration ties are broken by file size → chapter count → (optional) widescreen → duration, instead of raw duration alone.
  • Falls back to the longest track overall when nothing is within the length window.

Mid-rip redirect (RipRedirectService, new)

  • Singleton registry of active MakeMKV rips. The UI requests a redirect → the active rip's token is cancelled → the pipeline re-rips the newly-chosen track after cleaning up the partial output.

Overrides

  • Per-job override (Job.MainFeatureOverrideTrackNumber) set from the UI.
  • Per-fingerprint override (DiscMetadata.MainFeatureTrackNumber) remembered across rips of the same disc.

API + UI

  • New POST /api/jobs/{id}/redirect-rip endpoint (antiforgery-token protected).
  • "Redirect" button on each non-main track row of the Job Detail page, shown only while the job is ripping in main-feature mode.

Data

  • EF migration AddMainFeatureRedirect + legacy DatabaseHelper column sync.

Tests

  • 8 SelectMainFeatureTrack unit tests (ties, widescreen, eligibility, fallbacks).
  • 3 rip-pipeline integration tests (job override, fingerprint override, mid-rip redirect + partial-output cleanup).
  • 4 API integration tests for redirect-rip (persist override, missing job, unknown track, non-ripping job).

All 244 Core + 77 WebUi tests pass.

ARM Dotnet Port added 2 commits August 15, 2026 09:26
- SelectMainFeatureTrack: longest eligible track wins, tie-broken by file
  size, chapter count, then (optionally) widescreen, then duration; falls
  back to longest overall when nothing is eligible
- RipRedirectService: singleton registry of active MakeMKV rips so the UI
  can request a mid-rip redirect (cancel + re-rip the chosen track)
- Main-feature rips honor a per-job override and a per-fingerprint override
  remembered for future rips of the same disc; partial output is cleaned up
  before re-ripping
- New POST /api/jobs/{id}/redirect-rip endpoint plus a Redirect button on
  the job details track table (antiforgery-token aware)
- EF migration AddMainFeatureRedirect + legacy DB column sync
- Tests: main-feature selection, override/redirect pipeline, API endpoint
The abandon fetch posted without a token, so [ValidateAntiForgeryToken]
on /api/abandon/{id} rejected it with a 400. Render a hidden token in the
shared layout and send it as the RequestVerificationToken header.
ARM Dotnet Port added 2 commits August 15, 2026 11:28
- RipRedirectService.BeginRip registers the CTS before checking the pending
  redirect flag, closing the race where a redirect landing between the check
  and the store would be lost.
- CleanupPartialRipOutput now deletes only the cancelled track's output file
  (exact MakeMKV FileName or _t{TrackNumber-1:D2}.mkv suffix) instead of every
  .mkv in the raw output dir, so a good file from an earlier rip of the same
  title is preserved.
- Rip-pipeline tests use the real 1-based MakeMKV track convention (track 1 →
  title_t00.mkv), so the mid-rip redirect test exercises the track-scoped
  cleanup; DamagedDisc assertion updated accordingly.
- Document remaining review findings 37-40 in docs/code-review/.
…edirect

# Conflicts:
#	docs/code-review/README.md
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.

1 participant