Skip to content

Add maximum chapter duration cap when splitting by chapter (#1680)#1808

Open
CryptoJones wants to merge 4 commits into
rmcrackan:masterfrom
CryptoJones:feat/1680-max-track-length
Open

Add maximum chapter duration cap when splitting by chapter (#1680)#1808
CryptoJones wants to merge 4 commits into
rmcrackan:masterfrom
CryptoJones:feat/1680-max-track-length

Conversation

@CryptoJones

Copy link
Copy Markdown

Summary

  • Adds MaximumFileDuration configuration setting (in seconds, default 0 = disabled)
  • When Split files by chapter is enabled and MaximumFileDuration > 0, any chapter longer than the limit is divided into equal-length parts
  • Part titles are suffixed with (Part N of M) — e.g. Chapter 3 (Part 1 of 2)
  • Offsets and durations are calculated exactly; the final part absorbs any remainder

Changes

  • Configuration.PersistentSettings.cs — new MaximumFileDuration property
  • Configuration.HelpText.cs — help/tooltip text for the new setting
  • DownloadOptions.Factory.cs — new splitLongChapters() method; called after combineShortChapters() in the split-by-chapter pipeline
  • SettingsDialog.Designer.cs / SettingsDialog.AudioSettings.cs — WinForms UI: label + NumericUpDown in the audiobook fixups group, enabled/disabled with the Split by chapter checkbox
  • AudioSettingsVM.cs / Audio.axaml — Avalonia MVVM binding and NumericUpDown row in the split-by-chapter grid
  • DownloadDecryptBookTests.cs — 6 new unit tests for splitLongChapters

Test plan

  • splitLongChapters unit tests pass (no chapter split, exact limit, even split, uneven split, offset preservation, mixed-length list)
  • WinForms: Maximum duration NUD appears beneath Minimum duration, enabled only when Split by chapter is checked
  • Avalonia: same control visible in Audio settings, bound correctly
  • Setting persists across app restarts
  • Downloading an audiobook with a chapter exceeding the limit produces multiple files with correct part titles and durations

Closes #1680

🤖 Generated with Claude Code

@rmcrackan

Copy link
Copy Markdown
Owner

Thank you for the PR. The feature is scoped well: persistence, pipeline placement after combineShortChapters, shared configuration/help, both UIs wired with the same bounds and enable rules, and solid unit tests for splitLongChapters. That makes it much easier to review and merge with confidence.

Please address before merge

  • WinForms layout: Move stripUnabridgedCbox and stripAudibleBrandingCbox (and tweak vertical spacing in the Audiobook Fix-ups group as needed) so they no longer sit on the same row as the new max-duration controls. Right now maxFileDurationNud is at the same Y as stripUnabridgedCbox, and the max label overlaps that row.
  • Help text units: Update the new MaximumFileDuration help copy so it says seconds, not minutes, so it matches [Description], the NumericUpDown, and * 1000 in DownloadOptions.Factory. While you are in that dictionary entry, consider correcting MinimumFileDuration help text too (it already says minutes on master but the setting is seconds).
  • User-facing accuracy: Align PR description / help wording with behavior: chapters are split into segments of at most the limit, with the last segment shorter when there is a remainder, not necessarily mathematically equal-length parts across the whole chapter.

@rmcrackan

Copy link
Copy Markdown
Owner

After making the layout fixes, please run classic (winforms) and chardonnay (avalonia) locally to get human eyes on it. AI can sometimes have a hard time getting visual/layout stuff correct.

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had any activity for 30 days.

It will be closed in 14 days if no further activity occurs.

If you're still working on this PR, please leave a comment to keep it open.
Thank you for your contribution.

@github-actions github-actions Bot added the stale No activity for an extended period label Jun 14, 2026
@CryptoJones

CryptoJones commented Jun 14, 2026

Copy link
Copy Markdown
Author

Apologies for the delay — I've pushed a fix commit that addresses all three items:

WinForms layout: Moved stripUnabridgedCbox (Y 63 → 92) and stripAudibleBrandingCbox (Y 88 → 118) below the max-duration row so they no longer share a row with maxFileDurationNud / maxFileDurationLbl.

Help text units: Both MinimumFileDuration and MaximumFileDuration now say seconds instead of minutes.

User-facing accuracy: MaximumFileDuration help copy now reads: "Chapters longer than this duration will be split into segments of at most this length; the last segment will be shorter if the chapter does not divide evenly." — no more "equal-length parts" language.

Verifying the layout visually now and will report back.

@CryptoJones

Copy link
Copy Markdown
Author

Please hold this merge until human verification has been completed.

CryptoJones pushed a commit to CryptoJones/Libation that referenced this pull request Jun 14, 2026
Baseline main/master, original PR layout (broken), and fixed layout
screenshots taken from a Windows 11 QEMU VM to verify the audiobook
fix-ups layout change.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@CryptoJones

Copy link
Copy Markdown
Author

Visual verification complete — ran all three builds on a Windows 11 QEMU VM.


Baseline Main/Master

(no Max File Duration field — clean reference)

Baseline Main/Master


Smoothbrain Claude's Original PR

(Max File Duration field overlapping the Strip checkboxes — the layout bug)

Original PR — broken layout


Slightly Less Smooth-Brained PR (mine)

(fixed: checkboxes pushed down, no overlap)

Fixed PR — clean layout


The layout is correct. All three reviewer requests (layout, help text units, behavioral accuracy wording) are addressed in commit 77a4997b.

@CryptoJones

Copy link
Copy Markdown
Author

Now manually testing Chardonnay.

@CryptoJones

Copy link
Copy Markdown
Author

Chardonnay (Avalonia) visual verification — same Windows 11 QEMU VM.

Note: the Avalonia UI uses Grid row definitions in AXAML (not fixed pixel coordinates), so there was never a layout overlap in Chardonnay — the Max Duration row slots in correctly by construction.


Chardonnay — Baseline Main/Master

(no Max File Duration field)

Chardonnay baseline


Chardonnay — Fixed PR

(Max File Duration in its own row, no overlap)

Chardonnay fixed PR

@CryptoJones

Copy link
Copy Markdown
Author

Sorry for all the hassle with this PR. I have locked that Claude instance into a virtual environment where it plays Maria Carry's "All I want for Christmas" on a loop for eternity.

@CLHatch

CLHatch commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

I've sworn like a sailor to Gemini myself. :-D Lately to Claude as well, I've noticed the quality went down on it's coding lately.

AK Clark and others added 4 commits June 14, 2026 06:37
Adds a MaximumFileDuration setting: when splitting audiobooks by chapter,
any chapter longer than the configured limit is divided into equal-length
parts titled "Chapter (Part N of M)". Wired up in WinForms and Avalonia
UIs, persisted in Configuration, and covered by unit tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Move stripUnabridgedCbox (Y 63→92) and stripAudibleBrandingCbox
  (Y 88→118) below the max-duration row so controls no longer overlap
- Fix MinimumFileDuration help text: "minutes" → "seconds"
- Fix MaximumFileDuration help text: "minutes" → "seconds"; replace
  "equal-length parts" with accurate description (last segment is
  shorter when chapter doesn't divide evenly)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Baseline main/master, original PR layout (broken), and fixed layout
screenshots taken from a Windows 11 QEMU VM to verify the audiobook
fix-ups layout change.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Audio File Settings tab screenshots from the Windows 11 QEMU VM:
baseline upstream/master and fixed PR build.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@CryptoJones CryptoJones force-pushed the feat/1680-max-track-length branch from 12cc143 to 32759be Compare June 14, 2026 11:37
@rmcrackan

Copy link
Copy Markdown
Owner

Thank you for all the effort you put into this one.

Heads up that I don't know when I'll be able to give it a proper review. I spent a lot of time on Libation last week so I'm falling behind on some stuff. It's my own fault. Now I need to play catch-up for a bit before doing the next big Libation thing.

@wtanksleyjr

Copy link
Copy Markdown
Contributor

Does this change increase the minimum screen height? This Settings window cannot be resized beyond a certain point, we don't want to make it worse than it is.

@rmcrackan

Copy link
Copy Markdown
Owner

@wtanksleyjr Valid concern. I don't want to derail his work-in-progress. Would it be acceptable if I:

  • Review (and hopefully accept) this PR, even if it exceeds desired height
  • After: I can open a new bug for myself: that it's time to put all settings into a resize-able box with scrollbar(s)?

@wtanksleyjr

Copy link
Copy Markdown
Contributor

That's the ideal solution I think.

@github-actions github-actions Bot removed the stale No activity for an extended period label Jun 15, 2026
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.

Add the ability to limit track length when separating into MP3 by Chapter.

4 participants