Skip to content

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

Open
CryptoJones wants to merge 1 commit 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 1 commit 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

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>
@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.

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.

2 participants