Add multi-source ebook support and per-indexer categories

Introduces granular toggles for Anna's Archive and Indexer Search as ebook sources, updates settings UI to a three-section layout, and documents the new configuration. Adds per-indexer category configuration with separate tabs for audiobooks and ebooks, updates API routes and types for new settings, and ensures legacy config migration. Indexer grouping and file organization logic now support the new category structure and ebook source toggles.
This commit is contained in:
kikootwo
2026-01-30 22:12:24 -05:00
parent 590f089733
commit 5a0cce7985
19 changed files with 563 additions and 212 deletions
+25 -5
View File
@@ -608,6 +608,10 @@ async function processEbookOrganization(
/**
* Create ebook request if ebook downloads are enabled
* Called after audiobook organization completes
*
* Supports two ebook sources:
* - Anna's Archive (ebook_annas_archive_enabled) - Currently implemented
* - Indexer Search (ebook_indexer_search_enabled) - Future feature, gracefully skipped
*/
async function createEbookRequestIfEnabled(
parentRequestId: string,
@@ -617,15 +621,31 @@ async function createEbookRequestIfEnabled(
logger: RMABLogger
): Promise<void> {
try {
// Check if ebook downloads are enabled
// Check which ebook sources are enabled
const configService = getConfigService();
const ebookEnabled = await configService.get('ebook_sidecar_enabled');
const annasArchiveEnabled = await configService.get('ebook_annas_archive_enabled');
const indexerSearchEnabled = await configService.get('ebook_indexer_search_enabled');
if (ebookEnabled !== 'true') {
logger.info('Ebook downloads disabled, skipping ebook request creation');
// Legacy migration: check old key if new keys don't exist
const legacyEnabled = await configService.get('ebook_sidecar_enabled');
const isAnnasArchiveEnabled = annasArchiveEnabled === 'true' ||
(annasArchiveEnabled === null && legacyEnabled === 'true');
const isIndexerSearchEnabled = indexerSearchEnabled === 'true';
// If no sources are enabled, skip ebook creation
if (!isAnnasArchiveEnabled && !isIndexerSearchEnabled) {
logger.info('Ebook downloads disabled (no sources enabled), skipping ebook request creation');
return;
}
// If only indexer search is enabled (not yet implemented), log and skip
if (!isAnnasArchiveEnabled && isIndexerSearchEnabled) {
logger.info('Ebook indexer search is enabled but not yet implemented, skipping ebook request creation');
return;
}
// Anna's Archive is enabled - proceed with ebook request creation
// Check if an ebook request already exists for this parent
const existingEbookRequest = await prisma.request.findFirst({
where: {
@@ -656,7 +676,7 @@ async function createEbookRequestIfEnabled(
logger.info(`Created ebook request ${ebookRequest.id}`);
// Trigger ebook search job
// Trigger ebook search job (Anna's Archive)
const jobQueue = getJobQueueService();
await jobQueue.addSearchEbookJob(ebookRequest.id, {
id: audiobook.id,