Repository navigation
feat: an admin setting hides other-language Audible editions from search, series and home rows - #527
Merged
Merged
Conversation
A Library tab setting, off by default, keeps Audible results in the region's language: search, series search, series pages, watched series, the home rows, BookDate and shelf sync. Books with no language listed are kept. BookDate and shelf sync take one book only when its language is listed as accepted and its title matches (80% of the requested words); otherwise no match. Bulk import opts out. With the setting off, every list, pick and response is as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Eyji <10639815+Eyji@users.noreply.github.com>
…elect by its label Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Eyji <10639815+Eyji@users.noreply.github.com>
- BookDate and shelf sync take the first result as before when it is in the region's language or lists none; the title check runs only when the first result is in another language. Only the last parenthetical group is left out of the requested title. - Shelf sync retries without the series only when the search found nothing. - Search and series pages decide "nothing in the language yet" before hide-available; the series detail header and bar count the books shown. - A watched series whose books are all hidden is marked checked and logged as hidden. - Help text says what users see; e2e replays send the route's own counts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…not a missing element (#259) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ge, help text says what home rows do (#259) With the language filter on and more pages on Audible, search and series detail show the Load more bar with "All results/books so far are already available" when hide-available hid every loaded item, instead of a dead-end "No results found". Off: unchanged. Help text: search and series show the hidden count; home rows leave other-language editions out from their next refresh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ad more bar Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # src/lib/integrations/audible.service.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #259
Clean-room re-land of #352 by @Eyji (setting, raw-page
hasMore, settings route and toggle design), extended to series search, series pages, watched series and home rows, with the setting off by default; when it is on, every list is filtered unless the caller opts out (bulk import does).What changed
audible.language_filter('true'/'false', absent = off), read throughConfigurationService.getAudibleLanguageFilter()and the 60 s config cache. A failed read counts as off. No schema change.Only show books in {Language}, named after the region's language (AudibleLanguageFilterOption.tsx). Help text: "Search and series hide other-language editions and show how many they hid; the home page rows leave them out from their next refresh. Books with no language listed still show. BookDate, shelf sync and watched series skip other-language editions and request nothing for them. Books matched before you turn this on keep their match. Bulk import and requests made from a book page are not affected."PUT /api/admin/settings/audibletakes an optional booleanlanguageFilter(anything else is a 400 before any write; omitted keeps the stored value).GET /api/admin/settingsreturnsaudibleLanguageFilter.partitionByLanguage()(src/lib/constants/language-config.ts) on top ofkeepsLanguage. An accepted language or no language at all is kept. Both value forms are accepted: catalog names (german) and storefront labels (Deutsch).audibleService.search()): other-language products are hidden and counted;hasMorecomes from the raw page, so a page whose books are all hidden is not the last one.GET /api/audiobooks/searchaddshiddenCountandfilterLanguageonly while the filter is on. Bulk import's scan passes{ ignoreLanguageFilter: true }.scrapeSeriesPage()): counts,hasMoreand the layout drift warning come from the rows as listed, then the filter runs; it returnsrawCountand the hidden count. The detail route addshiddenCountandfilterLanguageoutside the series object.searchSeries()): off, every series is kept with accepted-language series first (as before); on, other-language products are dropped before aggregation andhiddenCountcounts the series listed only by hidden products. The ranking seam and its test are kept.lastCheckedAt) and logged as hidden, not as "No books found"..languageLabel(Sprache: Deutsch→Deutsch); the nightly refresh leaves out rows in another language. A row without a label is kept.pickSearchMatch(),src/lib/integrations/audible-language-filter.ts). The rule in one line: with the filter on, the first result is taken exactly as before when it is in the region's language or lists no language, and only when it is in another language is the first later result taken whose language is listed as accepted and whose title (plus subtitle) holds at least 80% of the requested title's words (bulk import's bar; only a trailing parenthetical group such as(Series, #1)is left out), otherwise none. BookDate then drops the recommendation and shelf sync records no match, so an edition with a translated title behind an other-language first result becomes no match. Shelf sync's retry without the series runs only when the search found nothing, as before./seriesand the series detail page. When a page shows nothing yet but Audible has more, search loads up to 4 more pages by itself (the count resets on a new query and on a click, and a new query ends the chain); then, like the series detail page, it shows the Load more bar withNo results in {Language} so far. Empty results readNo results in {Language} for "q"andNo series in {Language} for "q". These states are decided from the list before "hide available". When "hide available" empties the loaded list and Audible has more, search and the series detail page keep the Load more bar withAll results so far are already available/All books so far are already available; with nothing more, the usualNo results found/No books foundshows. With the filter off, both pages are as onmain. With the filter on, the series detail header and bar count the books shown (for example2 titleswith18 in other languages hidden), not Audible's series total, which includes other languages.hiddenCount/filterLanguageand that a page can be empty withhasMoretrue.documentation/integrations/audible-language-filter.md(rule, callers, opt-out, single-pick rule, limits), TOC entries, and short links fromaudible.md,audible-series-search.md,settings-pages.md,features/bookdate.md,features/watched-lists.md,features/home-sections.md,features/bulk-import.md,backend/services/goodreads-sync.mdand the harness spec list.Why
On a non-English store, Audible's catalog returns English and other-language editions mixed together, so search, series and the automatic requests from watched series, BookDate and shelf sync could land on an edition in a language the admin's users don't listen in. #352 proposed a filter for search; this extends it to every list that comes from Audible. Filtering a page can leave it empty while Audible has more, so paging is taken from the raw page everywhere. For the callers that pick a single book, "the first kept result" was often another book or a podcast in recordings from audible.it and audible.de (for example
Red Rising Pierce Brownon audible.it, where no result is Italian, the first is English and the first one without a language is a podcast). So when the first result is in another language, those take a later result only when its language and its title both match; when it is in the region's language or lists none, they take it as before.Limits (documented): shelf sync matches are shared per provider and book, so a match made before the filter was turned on stays; BookDate's cache-first match reads the home-row cache, which has no language; a language spelled in a way not in
acceptedLanguageValuesis hidden until added there; home rows are filtered after the 200-row scrape and are not topped up, so a row can hold fewer than 200 books; a no match recorded while the filter is on is retried after 7 days.Evidence
Recordings (trimmed, no covers): catalog keyword pages for it
Red Rising Pierce Brown, deCrooked Kingdom Leigh Bardugo, deSix of Crows Leigh Bardugo, frSix of Crows, and the audible.de/adblbestsellerspage (every row carries a language label).tests/integrations/audible-language-single-pick.test.tsruns the realmatchToAudnexus()andprocessShelfBooks()on those recordings: no pick and no request for Red Rising, Crooked Kingdom and Six of Crows with the filter on, the GermanKing of Scarspicked and requested, and the first result as before with it off. On synthetic audible.com pages with the filter on:The Hobbit, or There and Back Againtakes an English first resultThe Hobbitas before, a first result with no language is taken as before, a German first result followed by the English edition picks the English one, a German first result followed by an unrelated English podcast picks nothing, and shelf sync searches once when results exist but none is taken.tests/integrations/audible-search-language-filter.test.ts,audible-series-language-filter.test.ts,audible-series-search-language.test.tsandtests/processors/audible-refresh-language.test.tsrun the real search, series page, detail route, watched scan, series search and nightly refresh. With the filter off, each result is deep-equal to the same call with the setting absent.tests/lib/hooks/useSearch-language-filter.test.tsx(real SWR): a fully hidden page is loaded past, at most 4 pages in a row, a click allows 4 more, a new query sends nothing more for the old one.tests/app/language-filter.pages.test.tsxcovers the page states.Fails at 25ad327
src(with the test files as of aa7fb65): 13 failed, 46 passed, all 13 on an assertion: the first-result rule (5), the last-parenthetical strip (1), the single shelf sync search (1), "hide available" with the language states (3), the series detail counts (1), the all-hidden watched series (1) and the help text (1).Fails at aa7fb65
src(with the test files as of b2a9d64): 3 failed, 22 passed, all 3 on an assertion: the Load more bar when "hide available" empties a page with more to come, on search (1) and the series detail page (1), and the help text (1).Fails on
main(ba411d3srcwith this branch's test files as of 25ad327): 66 failed, 145 passed. 54 fail on an assertion: the helper with both value forms (10), search with rawhasMore(4), the BookDate and shelf sync pick (4), series page counts from raw rows and the watched-series stop and cap (7), the search auto-load and its cap (3), the settings route including the 400 (8), home rows (2), the bulk import opt-out (13), the saved settings body (2) and the series search hidden count (1). 12 fail because something new is missing: the page lines (6),searchSeries(3) and the config getter (3). The threshold unit tests and the settings control test don't load onmain(new modules). The off-path tests pass onmain.On this branch: the 25 test files, 271/271 pass.
E2E (
--offline-fixtures --overrides abs-fake-metadata, no real Audible host reached): the setting saved through the Library tab on the real path (label follows the region,PUTbody{region, languageFilter: true}, checked after a reload,GETtrue, a string value refused with 400 and nothing written); labelledpage.routereplays of search with hidden results (the browser stops after page 1 plus 4 automatic loads), of search with "Hide Available" on and page 1 all owned (All results so far are already availablewith Load more, no automatic load, a click loads page 2) and of series search; the replays send only counts the real route sends (totalResultsis the page's own result count). Snapshots at 1280 light, 1280 dark and 375:1-settings-control-{1280-light,1280-dark,375-light},2-search-hidden-{1280-light,1280-dark,375-light},2-search-all-hidden-1280-light,2-search-hide-available-more-1280-light,3-series-hidden-{1280-light,1280-dark,375-light},3-series-all-hidden-1280-light. The series detail hidden states are covered by unit tests only.Screenshots (all 12 in https://gist.github.com/kikootwo/2c3773574a8663a8eccc0d5561d3c56d):
Checks
vitest relatedon the changedsrcfiles plus the branch's test files): PASS, 235 files, 3623 passed, 1 skipped at 25ad327; at aa7fb65, 118 files, 1516 passed; at b85e2ba, for the files changed since aa7fb65, 6 files, 43 passedtsc --noEmitclean; ESLint reports nothing new in the touched files compared withmain)smokeand the Feature request: Admin-configurable language filter for Search, BookDate, and Popular results #259 e2e: PASS on an image built from b2a9d64 (srcas at b85e2ba, which only adds the e2e replay): smoke 1/1; Feature request: Admin-configurable language filter for Search, BookDate, and Popular results #259 spec 13/13mainat d2679a7 (one import conflict inaudible.service.ts, both imports kept):vitest relatedonaudible.service.ts, 122 files, 1531 passed;tsc --noEmitcleanRisk and rollback
GET /api/admin/settingsalways returnsaudibleLanguageFilter(false when unset).Follow-ups (not in this PR)
main).userPageskeeps the last clicked query).useAudiobooks.ts; the route sendstotalResultsas the page's count), so it can read "9 of 3 results" after Load more. Same onmain; the filter makes it show more often.audible.service.tsandbookdate/helpers.tswere over the file size limit before this PR.Release note
🤖 Generated with Claude Code