Skip to content

feat(amazon): Refactor Amazon metadata provider#1123

Open
jgoguen wants to merge 6 commits intocrocodilestick:mainfrom
jgoguen:refactor-amazon-metadata-provider
Open

feat(amazon): Refactor Amazon metadata provider#1123
jgoguen wants to merge 6 commits intocrocodilestick:mainfrom
jgoguen:refactor-amazon-metadata-provider

Conversation

@jgoguen
Copy link
Contributor

@jgoguen jgoguen commented Feb 16, 2026

Refactor the Amazon metadata provider, setting up a framework for refactoring other metadata providers with the aim of making it easier to add new providers and make providers regional.

In this PR:

  • Anything expected to be common across many metadata providers is moved into the base Metadata class
  • AmazonJp is merged into Amazon
  • A new user and global setting for the Amazon region is used to enable many different Amazon regions from the same metadata provider
  • Tests for the Amazon metadata provider are added, including testing different regions being set
    • There are more than just superficial differences with AmazonJp, those are specifically tested
  • Tests for the base Metadata class are added

This PR includes commits from #1122 and its dependencies. Once those PRs are merged this should collapse to one commit. Check out the latest commit from the Commits tab to see just the changes for this PR.

PR stack:

jgoguen added 6 commits March 14, 2026 21:44
Adds a set of HTML fixture files for future tests of the Amazon metadata
provider. This PR is a no-op.
This PR is a simple set of formatting changes to search_metadata.py.
There are no functional changes in this PR, it exists purely to make
later diffs easier to read.
Adds a setting to the system and user settings pages to allow users to
select their Amazon region. This setting does nothing in this PR, but
will be used in a PR further up the stack to select the correct Amazon
regional site when searching for books.
Instead of a hardcoded number of threads, base the number of threads on
the number of CPU cores available. On systems with more cores, this can
speed up searches by processing more at once.
…tion

This PR refactors the base Metadata class to prepare for consolidating
the various metadata providers into a more unified structure. The
changes for now are effectively a no-op, since any metadata providers
implementing the same function names just override what's here.
Refactor the Amazon metadata provider, setting up a framework for refactoring
other metadata providers with the aim of making it easier to add new providers
and make providers regional.

In this PR:

- Anything expected to be common across many metadata providers is moved into
  the base Metadata class
- AmazonJp is merged into Amazon
- A new user and global setting for the Amazon region is added, enabling many
  different regional Amazon sites in one provider class
- Tests for the Amazon metadata provider are added, including testing different
  regions being set
  - There are more than just superficial differences with AmazonJp, those are
    specifically tested
@jgoguen jgoguen force-pushed the refactor-amazon-metadata-provider branch from 158bb56 to 58a8060 Compare March 15, 2026 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant