-
Notifications
You must be signed in to change notification settings - Fork 8
Fix OPDS2+ODL streaming DRM fulfillment (PP-3467) #2956
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
Conversation
| def _license_fulfill( | ||
| self, loan: Loan, delivery_mechanism: LicensePoolDeliveryMechanism | ||
| ) -> Fulfillment: | ||
| # We are unable to fulfill a loan that doesn't have its external identifier set, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change isn't related, but while I was here, I noticed the first line of the doc comment was duplicated.
…ming DRM type - Add test coverage for streaming DRM in test_fulfill_success - Add test for unsupported streaming content type error case - Add helpful error messages when streaming content type is unsupported - Refactor test to use content_type parameter for cleaner parametrization
3717f1b to
f066a81
Compare
tdilauro
left a comment
There was a problem hiding this 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! 🛠️
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2956 +/- ##
=======================================
Coverage 92.78% 92.78%
=======================================
Files 454 454
Lines 42844 42852 +8
Branches 5976 5978 +2
=======================================
+ Hits 39752 39760 +8
Misses 2021 2021
Partials 1071 1071 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…) (#2966) ## Description This refactoring removes the streaming-specific conditional from `LoanController.fulfill()` by creating a new `StreamingFulfillment` class that encapsulates OPDS feed response generation. It shouldn't change the feed output, but in working on #2965, #2962, #2956 it became clear this refactoring would help the maintainability of this code. Changes: - Add `StreamingFulfillment` class that generates OPDS feed entries containing the streaming fulfillment link - Automatically append `STREAMING_PROFILE` to content type in constructor - Update `Fulfillment.response()` signature to accept optional `circulation` and `loan` parameters for subclasses that need them - Update `LoanController` to pass context to `fulfillment.response()` instead of special-casing streaming mechanisms - Update ODL and Overdrive integrations to return `StreamingFulfillment` for streaming delivery mechanisms - Add comprehensive tests for the new fulfillment class - Update existing tests to use `StreamingFulfillment` where appropriate ## Motivation and Context Previously, the `LoanController.fulfill()` method had special-case logic to check if a delivery mechanism was streaming and generate an OPDS feed response. This refactoring allows integrations to explicitly choose their response format by returning the appropriate fulfillment type, rather than having the controller make that decision based on delivery mechanism properties. ## How Has This Been Tested? - Added comprehensive unit tests for `StreamingFulfillment` class - Updated existing integration tests to use `StreamingFulfillment` - All existing tests pass ## Checklist - [x] I have updated the documentation accordingly. - [x] All new and existing tests passed.
Description
Fix a bug where the OPDS2+ODL integration could not fulfill content with the streaming DRM type. The streaming DRM handler was missing from the fulfillment logic, causing these requests to fail.
The fix adds a new handler for
STREAMING_DRMthat:Streaming Text) to the appropriate link media type (text/html)RedirectFulfillmentto send the patron to the streaming readerAlso adds proper error handling when an unsupported streaming content type is encountered.
Motivation and Context
This resolves PP-3467 and should unblock PP-3296.
Streaming content from OPDS2+ODL providers could not be fulfilled because the
_license_fulfillmethod did not have a handler for theSTREAMING_DRMscheme. This caused the code to fall through to the default DRM handler, which looks for alicenserel link with the DRM scheme as the type—incorrect for streaming content.How Has This Been Tested?
test_fulfill_successtest_fulfill_streaming_unsupported_content_typeto verify error handling when an unsupported content type is used with streaming DRMChecklist