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
+13 -1
View File
@@ -11,7 +11,7 @@ export async function PUT(request: NextRequest) {
return requireAuth(request, async (req: AuthenticatedRequest) => {
return requireAdmin(req, async () => {
try {
const { downloadDir, mediaDir, metadataTaggingEnabled } = await request.json();
const { downloadDir, mediaDir, metadataTaggingEnabled, chapterMergingEnabled } = await request.json();
if (!downloadDir || !mediaDir) {
return NextResponse.json(
@@ -53,6 +53,18 @@ export async function PUT(request: NextRequest) {
},
});
// Update chapter merging setting
await prisma.configuration.upsert({
where: { key: 'chapter_merging_enabled' },
update: { value: String(chapterMergingEnabled ?? false) },
create: {
key: 'chapter_merging_enabled',
value: String(chapterMergingEnabled ?? false),
category: 'automation',
description: 'Automatically merge multi-file chapter downloads into single M4B with chapter markers',
},
});
console.log('[Admin] Paths settings updated');
// Invalidate qBittorrent service singleton to force reload of download_dir
+1
View File
@@ -81,6 +81,7 @@ export async function GET(request: NextRequest) {
downloadDir: configMap.get('download_dir') || '/downloads',
mediaDir: configMap.get('media_dir') || '/media/audiobooks',
metadataTaggingEnabled: configMap.get('metadata_tagging_enabled') === 'true',
chapterMergingEnabled: configMap.get('chapter_merging_enabled') === 'true',
},
ebook: {
enabled: configMap.get('ebook_sidecar_enabled') === 'true',