Closed chrisridd closed 12 years ago
This looks good. While you're working in the spotlight importer, I'm going to take a look at the epub 3 and iBooks compatibility.
Good plan. BTW I found some stuff about ONIX at http://wiki.mobileread.com/wiki/ONIX
Thanks - iBooks looks like it's identical to epub 2 - and the way Apple have defined its UTI, it even automatically falls back to this plugin. It's crashing at some point though.
How are you triggering the crash, do you have a stack trace?
Looks like while the iBooks .OPF is identical to epub 2, it wasn't being loaded because it defines it's own mime type: application/x-ibooks+zip
rather thanapplication/epub+zip
. Hopefully it will just take a tweak to -openEPUBFile:
to accept this and load the OPF.
Was the crash just in the code trying to detect iBooks? I see you've reworked that code since posting about the crash.
Yeah - there was a weakness in the way -initWithFile:
called -openEPUBFile:
without checking if it returned OK. When presented with an iBook, -openEPUBFile:
would return false due to the unrecognised mimetype, but -initWithFile:
would ignore this, and still return an object. Now in addition to recognising iBooks, it should return nil
if -openEPUBFile:
returns false.
This now finds all the creators and all the contributors and returns an array with just their names instead of names and roles.
I refactored the logic to extract names from file-as attributes into a new method.
Some test cases are added which check creators returns all the expected values for the Untitled and metadata books.
The test cases all succeed.