Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPDS ODL API changes for UL Feed (PP-1769) #2095

Merged
merged 17 commits into from
Oct 5, 2024
Merged

Conversation

jonathangreen
Copy link
Member

@jonathangreen jonathangreen commented Oct 1, 2024

Description

Some major updates to the OPDS2 + ODL API code.

The highlights are:

  • Switch the validation of the status documents we get back to use Pydantic
    • There is some work here to start building up models of OPDS2 and ODL that can be the basis of replacing webpub manifest parser when we get to it.
  • Update the checkout / checkin / fulfillment logic, to reflect the differences between the documents we get back from DeMarque and those returned by the Open Source LCP server stack.
    • While I was in here, I updated the fulfillment logic to support ODL without LCP encryption.
  • Using the correct HTTP methods as defined in the spec, rather then using GET for everything
    • DeMarque supports using GET, but LCP server doesn't, and we should be following the spec

Motivation and Context

Starting to pull in ODL feeds from other distributors.

JIRA: PP-1769

How Has This Been Tested?

  • Running unit tests
  • Manually testing all the different DRM / content type interactions from marketplace via the app
    • This is complete, the interactions were tested in Cerberus.
      • LCP Ebook
      • LCP Audiobook
      • Adobe Ebook
      • DeMarque Audiobook
      • UL Abook
      • UL Ebook

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

Copy link

codecov bot commented Oct 1, 2024

Codecov Report

Attention: Patch coverage is 96.10656% with 19 lines in your changes missing coverage. Please review.

Project coverage is 90.69%. Comparing base (4f4295e) to head (c0b4b90).
Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
src/palace/manager/api/odl/api.py 94.28% 2 Missing and 4 partials ⚠️
src/palace/manager/opds/authentication.py 89.74% 2 Missing and 2 partials ⚠️
src/palace/manager/opds/lcp/license.py 92.45% 2 Missing and 2 partials ⚠️
src/palace/manager/opds/odl/info.py 92.85% 3 Missing ⚠️
src/palace/manager/opds/base.py 97.22% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2095      +/-   ##
==========================================
+ Coverage   90.65%   90.69%   +0.03%     
==========================================
  Files         344      351       +7     
  Lines       40580    40878     +298     
  Branches     8822     8858      +36     
==========================================
+ Hits        36787    37073     +286     
- Misses       2485     2493       +8     
- Partials     1308     1312       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jonathangreen jonathangreen requested a review from a team October 1, 2024 23:55
tests/manager/scripts/test_playtime_entries.py Outdated Show resolved Hide resolved
src/palace/manager/api/odl/api.py Show resolved Hide resolved
src/palace/manager/api/odl/api.py Show resolved Hide resolved
src/palace/manager/api/odl/api.py Show resolved Hide resolved
# an extra request to try to get the information we need from the 'status' link in the license
# document, which the LCP server does provide.
# TODO: Raise this issue with LCP server maintainers, and try to get a fix in place.
# once that is done, we should be able to remove this fallback.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Started a slack thread about this here: https://readium.slack.com/archives/C0SGTMMR6/p1727814143241779

src/palace/manager/api/odl/api.py Show resolved Hide resolved
@jonathangreen jonathangreen requested review from a team and removed request for a team October 2, 2024 00:26
@jonathangreen jonathangreen marked this pull request as ready for review October 2, 2024 15:09
@jonathangreen
Copy link
Member Author

Okay I finished the testing on this one, so this one is ready for code review / merge.

@jonathangreen jonathangreen force-pushed the feature/odl-update branch 2 times, most recently from 9dbbccb to ff3bc90 Compare October 4, 2024 12:23
Copy link
Contributor

@tdilauro tdilauro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. 🍄

A couple small comments below.

)
fulfill_cls = RedirectFulfillment
elif drm_scheme == DeliveryMechanism.FEEDBOOKS_AUDIOBOOK_DRM:
# For DeMarque audiobook content, the link we are looking is stored in the 'manifest' rel.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: missing word in the comment? "...link we are looking [up? for? is..."

library=odl_fixture.library,
data=odl_fixture.loan_status_document("returned").model_dump_json(),
):
response = odl_fixture.controller.notify(-55)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this -55 is meant to represent a loan that can't exist, but it's not super clear in this context. Would be useful to add a comment here (and a few lines down) making that explicit. Or we could use a constant named something like "NON_EXISTENT_LOAN".

@jonathangreen jonathangreen merged commit ea60979 into main Oct 5, 2024
20 checks passed
@jonathangreen jonathangreen deleted the feature/odl-update branch October 5, 2024 21:47
@dbernstein dbernstein added the feature New feature label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants