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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.