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:
ACX
2026-02-05 13:33:08 -07:00
committed by GitHub
co-authored by acx10
parent 92d1334f25
commit d38271de9c
121 changed files with 5078 additions and 909 deletions
@@ -310,7 +310,7 @@ export class BookService {
break;
case 'AUDIOBOOK':
baseUrl = 'audiobook-reader';
baseUrl = 'audiobook-player';
break;
}
@@ -700,6 +700,35 @@ export class BookService {
return this.http.post<void>(`${this.url}/bulk-regenerate-covers`, {bookIds});
}
uploadAudiobookCoverFromUrl(bookId: number, url: string): Observable<BookMetadata> {
return this.http.post<BookMetadata>(`${this.url}/${bookId}/metadata/audiobook-cover/from-url`, {url});
}
uploadAudiobookCoverFromFile(bookId: number, file: File): Observable<void> {
const formData = new FormData();
formData.append('file', file);
return this.http.post<void>(`${this.url}/${bookId}/metadata/audiobook-cover/upload`, formData);
}
getUploadAudiobookCoverUrl(bookId: number): string {
return this.url + '/' + bookId + "/metadata/audiobook-cover/upload";
}
regenerateAudiobookCover(bookId: number): Observable<void> {
return this.http.post<void>(`${this.url}/${bookId}/regenerate-audiobook-cover`, {});
}
generateCustomAudiobookCover(bookId: number): Observable<void> {
return this.http.post<void>(`${this.url}/${bookId}/generate-custom-audiobook-cover`, {});
}
supportsDualCovers(book: Book): boolean {
const allFiles = [book.primaryFile, ...(book.alternativeFormats || [])].filter(f => f?.bookType);
const hasAudiobook = allFiles.some(f => f!.bookType === 'AUDIOBOOK');
const hasEbook = allFiles.some(f => f!.bookType !== 'AUDIOBOOK');
return hasAudiobook && hasEbook;
}
bulkUploadCover(bookIds: number[], file: File): Observable<void> {
const formData = new FormData();
formData.append('file', file);
@@ -165,4 +165,8 @@ export class LibraryService {
setLargeLibraryLoading(isLoading: boolean, expectedCount: number): void {
this.largeLibraryLoadingSubject.next({ isLoading, expectedCount });
}
getBookCountsByFormat(libraryId: number): Observable<Record<string, number>> {
return this.http.get<Record<string, number>>(`${this.url}/${libraryId}/format-counts`);
}
}