/** * Component: Audiobookshelf Library Settings Section * Documentation: documentation/settings-pages.md */ import { Input } from '@/components/ui/Input'; import { Button } from '@/components/ui/Button'; import { Settings, ABSLibrary } from '../../lib/types'; import { AUDIBLE_REGIONS } from '@/lib/types/audible'; interface AudiobookshelfSectionProps { settings: Settings; onChange: (settings: Settings) => void; onValidationChange: (section: string, isValid: boolean) => void; libraries: ABSLibrary[]; testing: boolean; testResult: { success: boolean; message: string } | null; onTestConnection: () => void; } export function AudiobookshelfSection({ settings, onChange, onValidationChange, libraries, testing, testResult, onTestConnection, }: AudiobookshelfSectionProps) { const handleServerUrlChange = (serverUrl: string) => { onChange({ ...settings, audiobookshelf: { ...settings.audiobookshelf, serverUrl }, }); onValidationChange('audiobookshelf', false); }; const handleApiTokenChange = (apiToken: string) => { onChange({ ...settings, audiobookshelf: { ...settings.audiobookshelf, apiToken }, }); onValidationChange('audiobookshelf', false); }; const handleLibraryChange = (libraryId: string) => { onChange({ ...settings, audiobookshelf: { ...settings.audiobookshelf, libraryId }, }); onValidationChange('audiobookshelf', false); }; const handleTriggerScanChange = (triggerScanAfterImport: boolean) => { onChange({ ...settings, audiobookshelf: { ...settings.audiobookshelf, triggerScanAfterImport }, }); }; const handleAudibleRegionChange = (audibleRegion: string) => { onChange({ ...settings, audibleRegion, }); }; return (

Audiobookshelf Server

Configure your Audiobookshelf server connection and audiobook library.

handleServerUrlChange(e.target.value)} placeholder="http://localhost:13378" />
handleApiTokenChange(e.target.value)} placeholder="Enter your Audiobookshelf API token" />

Generate in Audiobookshelf: Settings → API Keys → Add API Key

{libraries.length > 0 ? ( ) : (
Test your connection to load libraries.
)}
{/* Audible Region Selection */}
{AUDIBLE_REGIONS[settings.audibleRegion as keyof typeof AUDIBLE_REGIONS]?.language !== 'en' && (

Non-English Region

Many features such as search, discovery, and metadata matching are not yet fully supported for non-English regions. You may still proceed, but expect limited functionality.

)}

Select the Audible region that matches your metadata engine (Audnexus/Audible Agent) configuration in Audiobookshelf. This ensures accurate book matching and metadata.

{testResult && (
{testResult.message}
)}
); }