diff --git a/backend/app/services/matcher.py b/backend/app/services/matcher.py index fc2e420..5faad5d 100644 --- a/backend/app/services/matcher.py +++ b/backend/app/services/matcher.py @@ -373,6 +373,24 @@ async def search_for_item(title: str, author: str | None = None) -> list[dict]: _search_source("dnb", search_dnb(search_title, author)), ) + # MusicBrainz: Search liefert weder Cover noch Tracklist. + # Für die Top-3 MB-Treffer Details holen, damit Cover + Kapitelzahl im UI sichtbar sind. + mb_top = sorted(mb, key=lambda r: r.confidence, reverse=True)[:3] + if mb_top: + async def _details(mb_result): + try: + return await get_release_details(mb_result.source_id) + except Exception as e: + logger.warning(f"MB-Details Fehler für {mb_result.source_id}: {e}") + return None + details = await asyncio.gather(*(_details(r) for r in mb_top)) + for orig, detail in zip(mb_top, details): + if detail: + if detail.cover_url and not orig.cover_url: + orig.cover_url = detail.cover_url + if detail.chapters and not orig.chapters: + orig.chapters = detail.chapters + results = [] for r in mb + ol + gb + dnb: results.append({ @@ -390,6 +408,7 @@ async def search_for_item(title: str, author: str | None = None) -> list[dict]: "language": r.language, "genres": r.genres, "cover": r.cover_url, + "chapterCount": len(r.chapters or []), "confidence": r.confidence, }) diff --git a/frontend/src/pages/BookDetail.tsx b/frontend/src/pages/BookDetail.tsx index 7498420..8fa1913 100644 --- a/frontend/src/pages/BookDetail.tsx +++ b/frontend/src/pages/BookDetail.tsx @@ -283,13 +283,39 @@ export default function BookDetail() { )} {matchResults.map((r, i) => (
{r.title}
-{r.author} · {r.source} · {Math.round(r.confidence * 100)}%
++ {[ + r.author, + r.publishYear, + r.source, + `${Math.round(r.confidence * 100)}%`, + ].filter(Boolean).join(' · ')} + {r.chapterCount > 0 && ( + · {r.chapterCount} Kapitel + )} +