Skip to content

Refactor OPDS links and update catalog metadata#11510

Closed
mekarpeles wants to merge 2 commits intomasterfrom
stored-searches
Closed

Refactor OPDS links and update catalog metadata#11510
mekarpeles wants to merge 2 commits intomasterfrom
stored-searches

Conversation

@mekarpeles
Copy link
Copy Markdown
Member

@mekarpeles mekarpeles commented Nov 24, 2025

Switch to pyopds2_openlibrary.STORED_SEARCHES ArchiveLabs/pyopds2_openlibrary#18 which uses pyopds2.Search (ArchiveLabs/pyopds2@7b42424)

This PR is not complete.

This pull request refactors and improves the OPDS API endpoints in openlibrary/plugins/openlibrary/api.py. The main changes focus on making the code more modular, reducing duplication, and introducing a new subject-based OPDS endpoint. The update also streamlines how bookshelf and profile links are added, and centralizes the logic for featured subject navigation and stored searches.

Key changes:

Refactoring and Code Simplification:

  • Replaces repeated inline bookshelf and profile Link objects with calls to provider.bookshelf_link() and provider.profile_link, making the code more modular and easier to maintain. [1] [2]

New Features:

  • Adds a new opds_subjects endpoint (/opds/subjects/<subject_key>) that returns an OPDS catalog for a given subject using search parameters tailored for trending, borrowable books, and safe-for-work content.

Homepage and Navigation Improvements:

  • Updates the OPDS homepage to use a more descriptive title ("Browsing the Open Library") and changes subject navigation links to point to the new subject endpoints, improving user navigation and discoverability.
  • Refactors the homepage's featured subject groups to use a centralized provider.STORED_SEARCHES list, simplifying the logic for generating trending, classic, romance, kids, thrillers, and textbooks sections.

mekarpeles and others added 2 commits November 23, 2025 17:15
Switch to pyopds2_openlibrary.STORED_SEARCHES which uses pyopds2.Search
@mekarpeles
Copy link
Copy Markdown
Member Author

Code to be moved to https://github.com/archivelabs/opds.openlibrary.org

@mekarpeles mekarpeles closed this Mar 25, 2026
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