diff --git a/documentation/features/audiobookshelf-implementation-guide.md b/documentation/features/audiobookshelf-implementation-guide.md index 183ea35..cbf5fa3 100644 --- a/documentation/features/audiobookshelf-implementation-guide.md +++ b/documentation/features/audiobookshelf-implementation-guide.md @@ -1771,7 +1771,7 @@ export function AudiobookshelfStep({ className="w-full px-3 py-2 border rounded-lg" />
- Find this in Audiobookshelf → Settings → Users → Your User → API Token + Generate this in Audiobookshelf → Settings → API Keys → Add API Key
diff --git a/documentation/features/audiobookshelf-integration.md b/documentation/features/audiobookshelf-integration.md index b9ae0a7..7a3c14e 100644 --- a/documentation/features/audiobookshelf-integration.md +++ b/documentation/features/audiobookshelf-integration.md @@ -1147,11 +1147,11 @@ auth.require_admin_approval = 'false' **Instructions for users:** 1. Login to Audiobookshelf web UI as admin -2. Go to Settings → Users -3. Click on your user -4. Scroll to "API Token" section -5. Click "Generate Token" -6. Copy token for ReadMeABook setup +2. Go to Settings → API Keys +3. Click "Add API Key" +4. Enter a descriptive name (e.g., "ReadMeABook") +5. Copy the generated API key +6. Use the key in ReadMeABook setup ### B. OIDC Provider Setup Guides diff --git a/documentation/features/chapter-merging.md b/documentation/features/chapter-merging.md index 58a25b9..19d9443 100644 --- a/documentation/features/chapter-merging.md +++ b/documentation/features/chapter-merging.md @@ -6,9 +6,26 @@ Automatically merge multi-file audiobook downloads (separate MP3/M4A files per chapter) into a single M4B file with proper chapter markers during file organization. -## Recent Updates (v2 - Corruption Fixes) +## Recent Updates -**Status:** ✅ Implemented (2026-01-09) +### v3 - Book Title Detection (2026-01-14) + +**Status:** ✅ Implemented + +**Critical Fix:** +- ✅ **Fixed identical chapter names bug** - Detects when title metadata contains book title instead of chapter names +- ✅ **Smart book title detection** - Analyzes files; if >80% have same title, flags it as book title +- ✅ **Updated filename patterns** - Added support for "BookTitle - 01 - ChapterName" format +- ✅ **Revised priority logic** - Prioritizes filename extraction over metadata when book title detected +- ✅ **Enhanced logging** - Reports book title detection and filename extraction strategy + +**Impact:** +- Before: Files with book title in metadata → All chapters named "The Let Them Theory" +- After: Filename extraction prioritized → Ch1: "Opening Credits", Ch2: "Introduction: My Story", etc. + +### v2 - Corruption Fixes (2026-01-09) + +**Status:** ✅ Implemented **Critical Fixes:** 1. ✅ **Fixed corruption on long audiobooks** - Dynamic timeout calculation (16h book = 254min vs old 20min) @@ -74,10 +91,23 @@ Detection now uses a **permissive heuristic** instead of strict filename pattern ### Chapter Metadata Generation -**Chapter Naming Strategy:** -1. **From filename:** Extract "Chapter 1", "01", "Part 1" -2. **Fallback numbering:** "Chapter 1", "Chapter 2" if no name found -3. **Preserve order:** Sort files naturally (ch1, ch2, ch10) +**Chapter Naming Strategy (Updated v3):** + +**Priority Order:** +1. **From filename:** Extract chapter name from filename patterns (most reliable) + - "01 - The Beginning" → "The Beginning" + - "Chapter 1 - Introduction" → "Introduction" + - "BookTitle - 01 - ChapterName" → "ChapterName" (NEW: supports book title prefix) +2. **From metadata:** Use embedded title tag (only if chapter-specific) + - Automatically detects if title metadata is the book title (appears in >80% of files) + - Skips metadata that matches the book title to avoid "every chapter named the same" +3. **Fallback numbering:** "Chapter 1", "Chapter 2" if no name found + +**Book Title Detection (NEW):** +- Analyzes all files to detect if title metadata contains the book title instead of chapter names +- If >80% of files have identical title metadata, flags it as the book title +- Prioritizes filename extraction when book title is detected in metadata +- Logs detection: "Detected book title in metadata: [title] (appears in X/Y files)" **Chapter Timing:** - Calculate from individual file durations using ffprobe @@ -206,6 +236,7 @@ All chapter merging decisions are **fully logged** for user transparency: **Analysis Phase Logs:** - Sample filenames for debugging +- Book title detection in metadata (NEW v3) - Metadata availability (track numbers) - Ordering strategy chosen (metadata vs filename) - Sample chapter titles generated @@ -220,23 +251,25 @@ All chapter merging decisions are **fully logged** for user transparency: - Final file size and chapter count - Cleanup status -**Example Log Output:** +**Example Log Output (v3 with book title detection):** ``` -[FileOrganizer] Multiple audio files detected (30 files) - checking chapter merge settings... +[FileOrganizer] Multiple audio files detected (31 files) - checking chapter merge settings... [FileOrganizer] Chapter merging enabled - analyzing files... -[FileOrganizer] Chapter detection: 30 files with format .mp3 - attempting chapter merge -[FileOrganizer] Analyzing 30 chapter files... -[FileOrganizer] Sample filenames: Andy Weir - Project Hail Mary - 01.mp3, Andy Weir - Project Hail Mary - 02.mp3, Andy Weir - Project Hail Mary - 03.mp3, ... -[FileOrganizer] Metadata analysis: 30/30 files have track numbers -[FileOrganizer] Track numbers: 1, 2, 3 ... 30 +[FileOrganizer] Chapter detection: 31 files with format .mp3 - attempting chapter merge +[FileOrganizer] Analyzing 31 chapter files... +[FileOrganizer] Sample filenames: The Let Them Theory - 01 - Opening Credits.mp3, The Let Them Theory - 02 - Introduction_ My Story.mp3, ... +[FileOrganizer] Detected book title in metadata: "The Let Them Theory" (appears in 31/31 files) +[FileOrganizer] Title metadata flagged as book title - will prioritize filename extraction for chapter names +[FileOrganizer] Metadata analysis: 31/31 files have track numbers +[FileOrganizer] Track numbers: 1, 2, 3 ... 31 [FileOrganizer] Chapter ordering: Filename and metadata orders match - high confidence -[FileOrganizer] Using metadata-based ordering for 30 chapters -[FileOrganizer] Sample chapter titles: Ch1: "Chapter 1", Ch2: "Chapter 2", Ch3: "Chapter 3", ... -[FileOrganizer] Starting chapter merge: "Project Hail Mary" by Andy Weir +[FileOrganizer] Using metadata-based ordering for 31 chapters +[FileOrganizer] Sample chapter titles: Ch1: "Opening Credits", Ch2: "Introduction: My Story", Ch3: "Dedication", ... +[FileOrganizer] Starting chapter merge: "The Let Them Theory" by Mel Robbins [FileOrganizer] Merge strategy: Re-encoding MP3 → AAC/M4B at 128k -[FileOrganizer] Executing FFmpeg merge (timeout: 20 minutes)... +[FileOrganizer] Executing FFmpeg merge (timeout: 254 minutes)... [FileOrganizer] ✓ Chapter merge successful! -[FileOrganizer] - Chapters: 30 +[FileOrganizer] - Chapters: 31 [FileOrganizer] - Duration: 16h 32m 10s [FileOrganizer] - Size: 452MB ``` diff --git a/scripts/setup-abs-config.ts b/scripts/setup-abs-config.ts index 17a4f1e..605075e 100644 --- a/scripts/setup-abs-config.ts +++ b/scripts/setup-abs-config.ts @@ -9,7 +9,7 @@ async function setupABSConfig() { // Configure these values for your Audiobookshelf instance const config = { 'audiobookshelf.server_url': 'http://localhost:13378', // Change to your ABS server URL - 'audiobookshelf.api_token': 'YOUR_ABS_API_TOKEN', // Get from ABS Settings -> Users -> Your User -> API Token + 'audiobookshelf.api_token': 'YOUR_ABS_API_TOKEN', // Generate from ABS Settings -> API Keys -> Add API Key 'audiobookshelf.library_id': 'YOUR_LIBRARY_ID', // Get from ABS or use test-abs endpoint }; diff --git a/src/app/admin/settings/page.tsx b/src/app/admin/settings/page.tsx index 7913d17..f5ef370 100644 --- a/src/app/admin/settings/page.tsx +++ b/src/app/admin/settings/page.tsx @@ -1340,7 +1340,7 @@ export default function AdminSettings() { placeholder="Enter your Audiobookshelf API token" />- Found in Audiobookshelf Settings → Users → Your Account → API Tokens + Generate in Audiobookshelf: Settings → API Keys → Add API Key
diff --git a/src/app/setup/steps/AudiobookshelfStep.tsx b/src/app/setup/steps/AudiobookshelfStep.tsx index 23464ae..4573517 100644 --- a/src/app/setup/steps/AudiobookshelfStep.tsx +++ b/src/app/setup/steps/AudiobookshelfStep.tsx @@ -136,7 +136,7 @@ export function AudiobookshelfStep({ onChange={(e) => onUpdate('absApiToken', e.target.value)} />- Find this in Audiobookshelf → Settings → Users → Your User → API Token + Generate this in Audiobookshelf → Settings → API Keys → Add API Key
@@ -270,8 +270,8 @@ export function AudiobookshelfStep({ About API Token- You can generate an API token in Audiobookshelf by going to Settings → Users - → selecting your user → and copying the API Token. + Generate an API key in Audiobookshelf by navigating to Settings → API Keys → Add API Key. + Give it a descriptive name and copy the generated key to use here.
diff --git a/src/components/audiobooks/AudiobookDetailsModal.tsx b/src/components/audiobooks/AudiobookDetailsModal.tsx index 4964355..fced29c 100644 --- a/src/components/audiobooks/AudiobookDetailsModal.tsx +++ b/src/components/audiobooks/AudiobookDetailsModal.tsx @@ -43,6 +43,7 @@ export function AudiobookDetailsModal({ const [requestError, setRequestError] = useStateASIN
+ +