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

Bunch of fixes, support B&N DRM and expiring library books #15

Merged
merged 18 commits into from Feb 18, 2012

Conversation

chrisridd
Copy link
Contributor

No description provided.

There's no need to test for nil Objective-C objects.
Barnes & Noble use a variant of Adept DRM. One obvious difference seems
to be that contents of <operatorURL> contains a barnesandnoble.com URL.

This change switches from looking at <licenseURL> to <operatorURL> and
checking the URL contents.

The adeptXML object cannot be released if we want to look inside a
returned node, so we now release that later on.

The existing tests still pass.
The test file has <dc:contributor>Foo</dc:contributor> which should not
match any translator/illustrator/editor.
Instead of requesting all <dc:creator> nodes and then iterating looking
for some role, query the role attribute explicitly.

This avoids problems matching elements without roles set.
Creators may not have opt:role='aut'. (I have some books like this)
The opf:role attribute is optional, and I've seen books without it on
dc:creator. This change restores the previous code which matches those
role-less creators.

It does that in a surprising way - itemID is nil for those elements, and
it turns out the caseInsensitiveCompare: method returns NSOrderedSame
for that.
This seemed to appear as a blank line in the list of resources for
EpubTests.

Without it, everything still builds OK and tests OK.
The failing assertions print a reasonable amount about the actual/expected values, so
adding more in the description is superfluous.
We expect nil from -cover if there is no detectable cover.
The fake file is the same as the fake-adept one, except that the
operatorURL has been edited to include barnesandnoble.com.

The extra test succeeds.
The only library books I have are from Overdrive (via the London
Libraries Consortium), which use Adept DRM. The rights.xml file contains
<until> elements.

So while parsing Adept DRM, we look for <until> elements and build a
date if possible.

The parsing of the date string is moved to a category on NSDate; the
parsing of dates in ePub is reasonably well defined and it is not what
Cocoa call "natural language". I switched the publication date parsing
to using this category as well.

It is not known if the DRM expiry dates are formatted the same as dates
elsewhere in ePubs.

The expiry date is rendered into the HTML.

Tests of the date parser are added. Tests of a fake library book are
added as well.
Using NSString's -fileSystemRepresentation method returns a string that
accurately reflects what OS X can open. There are some differences when
you start using accented characters in filenames.

Zip files as used by epubs really do have UTF-8 filenames, so the calls
to open files inside an epub are not changed.

Unit tests still succeed.
jaketmp added a commit that referenced this pull request Feb 18, 2012
Bunch of fixes, support B&N DRM and expiring library books
@jaketmp jaketmp merged commit 5a8b2b7 into jaketmp:master Feb 18, 2012
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.

None yet

2 participants