fix(opds): align mapping with OPDS 2.0 WebPub properties, support OPD…#125
fix(opds): align mapping with OPDS 2.0 WebPub properties, support OPD…#125zeedif wants to merge 5 commits intojohnfactotum:mainfrom
Conversation
…S-PSE and RFC 5005
5eca82c to
518a173
Compare
|
Thanks. Currently the PR is rather large, with many unrelated changes. Can you perhaps make each change a separate PR? In particular, a lot of the changes seem to be merely avoiding having properties with undefined values on the resulting objects. Is there a reason for this? It doesn't seem to be related to the main changes that you're describing. |
518a173 to
0f4822c
Compare
|
The reason for removing I viewed the initial mapping fixes and the blank value omissions as a single logical unit, as both serve the exact same goal: mapping OPDS 1.x feeds into a perfectly spec-compliant OPDS 2.0 / WebPub layout. However, the middle commit was definitely a tangent. I have removed the 2nd commit (Legacy/Stanza support) from this branch right now and move it to its own isolated PR. Regarding the 1st and 3rd commits: since they both work together to achieve strict OPDS 2.0 compliance, does it make sense to keep them together here, or would you still prefer I split the "Blank Values" refactor into a third PR? |
|
OK. I think I got a bit confused, as the objects returned by |
0f4822c to
6240826
Compare
|
My initial reasoning for omitting empty properties was to strictly adhere to the OPDS 2.0 specification regarding "Blank Values," aiming for a minimal JSON output. However, as you pointed out, since this library acts as a client consumer and not a publisher, the benefits of such strictness are minimal and unnecessary. I've refactored the code to align with your suggested approach. The defensive checks have been removed in favor of a more direct, declarative style. I only retained the change from |
… properties by role
6240826 to
b459222
Compare
ce1c8eb to
86568fd
Compare
86568fd to
4fcabc9
Compare
4fcabc9 to
c9ee8d7
Compare
|
I've mapped DOM I consider it ready for review and acceptance, if there are no other details. |
This PR aims to refine the parser so that OPDS 1.x attributes perfectly align with the target OPDS 2.0 (Readium WebPub Manifest) layout without bleeding deprecated metadata onto the root object, while fixing deep DOM evaluation bugs and bringing support for OPDS-PSE (Page Streaming) and Paging extensions.
Improvements & Bug Fixes
Aligning OPDS 1.x mapping exclusively with OPDS 2.0
properties:thr:countexclusively to OPDS 2.0'sproperties.numberOfItems.totalResults,itemsPerPage,startIndex) are now natively mapped directly into OPDS 2.0metadatapagination elements (numberOfItems,itemsPerPage,currentPage).opds:activeFacet="true") is mapped seamlessly by appending the OPDS 2.0 native"self"to therelarray instead of preserving the legacy XML attribute.Prices & Indirect Acquisitions Hierarchy Bug Fix:
getElementsByTagNameNS(...)[0]was used. This caused two major issues: it ignored multiple prices/currencies (e.g., both USD and GBP for the same link) and it broke hierarchy for sibling nestedindirectAcquisitionbranches (only capturing the first deep node instead of treating them as trees like an archive bundle with EPUB, MOBI, and PDF inside).getDirectChildren()to correctly map them strictly inside OPDS 2.0properties.priceandproperties.indirectAcquisitionmaintaining full recursive JSON schema compatibility.OPDS Page Streaming Extension (OPDS-PSE) Support:
REL.STREAM(http://vaemendis.net/opds-pse/stream) to properly recognize stream endpoints as OPDS publications rather than navigational entries.pse:count,pse:lastRead, andpse:lastReadDate) into thepropertiesobject to match the WebPub Manifest specification for custom properties.RFC 5005 (Paging and Archiving):
fh:completeandfh:archiveelements using thehttp://purl.org/syndication/history/1.0namespace exposing them transparently at the root level of the returned feed wrapper.