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:
+36
@@ -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});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user