feat(metadata): add endpoint and service for generating custom book covers for PDFs and CBX (#2108)

Signed-off-by: Balázs Szücs <bszucs1209@gmail.com>
This commit is contained in:
Balázs Szücs
2026-01-02 10:47:26 -07:00
committed by GitHub
parent 5d7c67cb5f
commit 486781b9cd
8 changed files with 387 additions and 4 deletions
@@ -328,6 +328,42 @@ export class BookCardComponent implements OnInit, OnChanges, OnDestroy {
command: () => {
this.bookDialogHelperService.openMetadataRefreshDialog(new Set([this.book!.id]))
},
},
{
label: 'Regenerate Cover (File)',
icon: 'pi pi-image',
command: () => {
this.bookService.regenerateCover(this.book.id).subscribe({
next: () => this.messageService.add({
severity: 'success',
summary: 'Success',
detail: 'Cover regeneration started'
}),
error: () => this.messageService.add({
severity: 'error',
summary: 'Error',
detail: 'Failed to regenerate cover'
})
});
}
},
{
label: 'Generate Custom Cover',
icon: 'pi pi-palette',
command: () => {
this.bookService.generateCustomCover(this.book.id).subscribe({
next: () => this.messageService.add({
severity: 'success',
summary: 'Success',
detail: 'Cover generated successfully'
}),
error: () => this.messageService.add({
severity: 'error',
summary: 'Error',
detail: 'Failed to generate cover'
})
});
}
}
]
});
@@ -550,6 +550,10 @@ export class BookService {
return this.http.post<void>(`${this.url}/${bookId}/regenerate-cover`, {});
}
generateCustomCover(bookId: number): Observable<void> {
return this.http.post<void>(`${this.url}/${bookId}/generate-custom-cover`, {});
}
regenerateCoversForBooks(bookIds: number[]): Observable<void> {
return this.http.post<void>(`${this.url}/bulk-regenerate-covers`, {bookIds});
}