Implement chapter merging feature and update ranking algorithm

Added automatic chapter merging to M4B with admin/config toggles, UI controls, and backend logic. Updated documentation to reflect implementation. Refactored ranking algorithm: increased Title/Author match points, removed size scoring, and improved Usenet/torrent handling. Enhanced Prowlarr integration for protocol detection and filtering. Improved file organizer to support chapter merging. Various bug fixes and logging improvements.
This commit is contained in:
kikootwo
2026-01-08 16:26:26 -05:00
parent 722a78ac33
commit 288421012d
21 changed files with 922 additions and 128 deletions
+4
View File
@@ -84,6 +84,7 @@ interface SetupState {
downloadDir: string;
mediaDir: string;
metadataTaggingEnabled: boolean;
chapterMergingEnabled: boolean;
bookdateProvider: string;
bookdateApiKey: string;
bookdateModel: string;
@@ -153,6 +154,7 @@ export default function SetupWizard() {
downloadDir: '/downloads',
mediaDir: '/media/audiobooks',
metadataTaggingEnabled: true,
chapterMergingEnabled: false,
bookdateProvider: 'openai',
bookdateApiKey: '',
bookdateModel: '',
@@ -228,6 +230,7 @@ export default function SetupWizard() {
download_dir: state.downloadDir,
media_dir: state.mediaDir,
metadata_tagging_enabled: state.metadataTaggingEnabled,
chapter_merging_enabled: state.chapterMergingEnabled,
},
bookdate: state.bookdateConfigured ? {
provider: state.bookdateProvider,
@@ -525,6 +528,7 @@ export default function SetupWizard() {
downloadDir={state.downloadDir}
mediaDir={state.mediaDir}
metadataTaggingEnabled={state.metadataTaggingEnabled}
chapterMergingEnabled={state.chapterMergingEnabled}
onUpdate={updateField}
onNext={() => goToStep(currentStepNumber + 1)}
onBack={() => goToStep(currentStepNumber - 1)}
+27
View File
@@ -13,6 +13,7 @@ interface PathsStepProps {
downloadDir: string;
mediaDir: string;
metadataTaggingEnabled: boolean;
chapterMergingEnabled: boolean;
onUpdate: (field: string, value: string | boolean) => void;
onNext: () => void;
onBack: () => void;
@@ -22,6 +23,7 @@ export function PathsStep({
downloadDir,
mediaDir,
metadataTaggingEnabled,
chapterMergingEnabled,
onUpdate,
onNext,
onBack,
@@ -235,6 +237,31 @@ export function PathsStep({
</div>
</div>
{/* Chapter Merging Toggle */}
<div className="bg-gray-50 dark:bg-gray-800 rounded-lg p-4 border border-gray-200 dark:border-gray-700">
<div className="flex items-start gap-4">
<input
type="checkbox"
id="chapter-merging"
checked={chapterMergingEnabled}
onChange={(e) => onUpdate('chapterMergingEnabled', e.target.checked)}
className="mt-1 h-5 w-5 rounded border-gray-300 text-blue-600 focus:ring-blue-500"
/>
<div className="flex-1">
<label
htmlFor="chapter-merging"
className="block text-sm font-medium text-gray-900 dark:text-gray-100 cursor-pointer"
>
Auto-merge chapters to M4B
</label>
<p className="text-sm text-gray-600 dark:text-gray-400 mt-1">
Automatically merge multi-file chapter downloads into a single M4B audiobook with chapter
markers. Improves playback experience and library organization.
</p>
</div>
</div>
</div>
<Button
onClick={testPaths}
loading={testing}