-
Notifications
You must be signed in to change notification settings - Fork 2
Description
openlibrary/openlibrary/book_providers.py
Line 243 in ded8118
| 'identifier': ocaid, |
Most lendable items on archive.org have a filename_base that matches the identifier. For example, a book with the identifier "foo" will have files named "foo.pdf" inside the item. This is the case with all books that we digitize ourselves. Additionally, Adobe ACS was never set up to support items that had a different naming scheme, so before LCP, those items ended up not being lendable via downloadable file (or I should say, the ACS encryption supported it, but the UI and possible endpoints were never updated to support it).
However, the LCP code supports any files inside the item. As an example, there is an item with the identifier isbn_9781849353496 which contains files starting with the base luigi_galleani__the_most_dangerous_anarchi_-_antonio_senta. To create a loan for these items, you must supply the filename_base param IN ADDITION TO the identifier param in the lending endpoint URL.
Note: the loan will apply to the entire item, not just individual files.
Luckily, there is an easy way to get the filename_base (and to know if it is different). It appears as part of the associated urn for the lendable file in the external-identifier field of item metadata (which should also be in search engine, and can be added to bulk availability API if it is not already).
So, in the item above, the external identifier field looks like this:
[
"urn:acs6:luigi_galleani__the_most_dangerous_anarchi_-antonio_senta:epub:ba89796d-5672-40ac-a010-eca9555ac151",
"urn:acs6:luigi_galleani__the_most_dangerous_anarchi-antonio_senta:pdf:c48a2b01-e908-45e9-ba7b-d1b345a05d39",
"urn:lcp:luigi_galleani__the_most_dangerous_anarchi-antonio_senta:epub:96ffd35e-5979-47a3-a76c-045e11240f7a",
"urn:lcp:luigi_galleani__the_most_dangerous_anarchi-_antonio_senta:lcpdf:451332ca-7112-4f12-b0c2-c9582143bebc"
]
And so you can see that the filename base is the third item in the urn if split by ":".