Audiobook enhancement (#2611)
* Audiobook enhancement * Fix choppy virtual scroller with mixed audiobook/ebook cards by using uniform heights * Fix audiobook cover regeneration for combined books and improve error messages * Fix cover extraction when attaching audiobook files during rescan * Set audiobookCoverUpdatedOn for cache busting when generating cover * Add support for regenerating covers from specific book files * Fix Continue Reading/Listening scrollers to filter by actual progress instead of primary file type * Show ebook cover and open ebook reader in Continue Reading scroller for combined books * Prevent read status from being downgraded when saving audiobook progress * Fix BookCoverServiceTest to match updated regenerateCover method signature --------- Co-authored-by: acx10 <acx10@users.noreply.github.com>
This commit is contained in:
@@ -72,6 +72,42 @@ export class UrlHelperService {
|
||||
return this.appendToken(url);
|
||||
}
|
||||
|
||||
getAudiobookCoverUrl(bookId: number, audiobookCoverUpdatedOn?: string): string {
|
||||
if (!audiobookCoverUpdatedOn) {
|
||||
const book = this.bookService.getBookByIdFromState(bookId);
|
||||
if (book && book.metadata) {
|
||||
const coverGenerator = new CoverGeneratorComponent();
|
||||
coverGenerator.title = book.metadata.title || '';
|
||||
coverGenerator.author = (book.metadata.authors || []).join(', ');
|
||||
coverGenerator.isSquare = true;
|
||||
return coverGenerator.generateCover();
|
||||
}
|
||||
}
|
||||
let url = `${this.mediaBaseUrl}/book/${bookId}/audiobook-cover`;
|
||||
if (audiobookCoverUpdatedOn) {
|
||||
url += `?${audiobookCoverUpdatedOn}`;
|
||||
}
|
||||
return this.appendToken(url);
|
||||
}
|
||||
|
||||
getAudiobookThumbnailUrl(bookId: number, audiobookCoverUpdatedOn?: string): string {
|
||||
if (!audiobookCoverUpdatedOn) {
|
||||
const book = this.bookService.getBookByIdFromState(bookId);
|
||||
if (book && book.metadata) {
|
||||
const coverGenerator = new CoverGeneratorComponent();
|
||||
coverGenerator.title = book.metadata.title || '';
|
||||
coverGenerator.author = (book.metadata.authors || []).join(', ');
|
||||
coverGenerator.isSquare = true;
|
||||
return coverGenerator.generateCover();
|
||||
}
|
||||
}
|
||||
let url = `${this.mediaBaseUrl}/book/${bookId}/audiobook-thumbnail`;
|
||||
if (audiobookCoverUpdatedOn) {
|
||||
url += `?${audiobookCoverUpdatedOn}`;
|
||||
}
|
||||
return this.appendToken(url);
|
||||
}
|
||||
|
||||
getBookdropCoverUrl(bookdropId: number): string {
|
||||
const url = `${this.mediaBaseUrl}/bookdrop/${bookdropId}/cover`;
|
||||
return this.appendToken(url);
|
||||
|
||||
Reference in New Issue
Block a user