From e6eab32473947a1b25061be74ed9cd9896e8b8dc Mon Sep 17 00:00:00 2001 From: Froidefond Julien Date: Sun, 15 Mar 2026 16:41:27 +0100 Subject: [PATCH] fix: fetch real book counts in Stripstream getSeriesById to fix greyed covers bookCount and booksReadCount were hardcoded to 0, causing all series covers to appear completed (opacity-50). Now queries the series endpoint to get actual counts. Co-Authored-By: Claude Opus 4.6 --- .../stripstream/stripstream.provider.ts | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/lib/providers/stripstream/stripstream.provider.ts b/src/lib/providers/stripstream/stripstream.provider.ts index b22abf1..e109688 100644 --- a/src/lib/providers/stripstream/stripstream.provider.ts +++ b/src/lib/providers/stripstream/stripstream.provider.ts @@ -86,6 +86,11 @@ export class StripstreamProvider implements IMediaProvider { revalidate: CACHE_TTL_MED, }); if (!book.series) return null; + + // Try to find series in library to get real book counts + const seriesInfo = await this.findSeriesByName(book.series, book.library_id); + if (seriesInfo) return seriesInfo; + return { id: seriesId, name: book.series, @@ -108,6 +113,10 @@ export class StripstreamProvider implements IMediaProvider { ); if (!page.items.length) return null; const firstBook = page.items[0]; + + const seriesInfo = await this.findSeriesByName(seriesId, firstBook.library_id); + if (seriesInfo) return seriesInfo; + return { id: firstBook.id, name: seriesId, @@ -126,6 +135,21 @@ export class StripstreamProvider implements IMediaProvider { } } + private async findSeriesByName(seriesName: string, libraryId: string): Promise { + try { + const seriesPage = await this.client.fetch( + `libraries/${libraryId}/series`, + { q: seriesName, limit: "10" }, + { revalidate: CACHE_TTL_MED } + ); + const match = seriesPage.items.find((s) => s.name === seriesName); + if (match) return StripstreamAdapter.toNormalizedSeries(match); + } catch { + // ignore + } + return null; + } + async getBooks(filter: BookListFilter): Promise { const limit = filter.limit ?? 24; const params: Record = { limit: String(limit) };