Extracting ebooks from Apple iBooks for Mavericks

I decided to remove a lot of the read ebooks from my library but wanted to back them up first, especially the ones that weren’t purchased via iTunes. iBooks on Mavericks had “imported” them all from iTunes and as a result I couldn’t just right click on them in iTunes and use Show in Finder.

First step was to locate them – turns out they’re in ~/Library/Containers/com.apple.BKAgentService/Data/Documents/iBooks/Books/

Next problem was that all the files had been renamed from something human readable into a large string of hex characters! The Books.plist file contained a lot of metadata, including the original filename and the current full path of the ebook. I wasn’t about to go renaming them manually so wrote a quick Perl script using Data::Plist::BinaryReader to extract the data structures and print the values for ‘BkDisplayName’ and ‘path’ from each book.

Then I found that although some of them were still .epub files, quite a few had been unpacked into directories containing the epub contents but not with the OEBPS subdirectory.

I wasn’t about to go updating the script to repack all the epubs and just on a whim thought I’d try dragging an ebook out of iBooks onto the desktop.. it worked! The one I had tried was one of the unpacked ebooks but on the desktop was a zipped up epub file. I wish I’d tried dragging them in the first place as it would have saved a lot of hassle!

To back them up, I ended up simply selecting all the ebooks and dragging them to a separate folder. Now I can remove all the read ebooks from within iBooks without worrying about losing them.

DBD::mysql, MySQL and OS X Lion

I downloaded and installed MySQL Community Server 5.5.15 from http://dev.mysql.com/downloads/mysql/5.5.html

Using CPAN, I then tried to install DBD::mysql on a fresh install of OS X Lion and was presented with an error saying it was unable to load the library.

#     Error:  Can’t load ‘/private/var/root/.cpan/build/DBD-mysql-4.019-H1RD6j/blib/arch/auto/DBD/mysql/mysql.bundle’ for module DBD::mysql: dlopen(/private/var/root/.cpan/build/DBD-mysql-4.019-H1RD6j/blib/arch/auto/DBD/mysql/mysql.bundle, 2): Library not loaded: libmysqlclient.18.dylib
#   Referenced from: /private/var/root/.cpan/build/DBD-mysql-4.019-H1RD6j/blib/arch/auto/DBD/mysql/mysql.bundle

Continue reading “DBD::mysql, MySQL and OS X Lion”

iOS4.2 for the iPhone

iOS 4.2 for the iPhone 4 (and other generations) is now available – it includes a number of new features related to printing from the iPhone over wifi (AirPrint), streaming audio and video to AirMusic and AppleTV devices. Neither of those are particularly exciting to me since we don’t have any of those devices. The one new feature that I will make use of is that you can apparently now have custom SMS/MMS text tones and separate tones per contact. Continue reading “iOS4.2 for the iPhone”

synergy2 on Leopard

Having upgraded to Leopard, I found that synergy2 wasn’t working. It’s an application that lets you control multiple machines from a single keyboard and mouse and I use it quite a lot at work.
More information about Synergy2 can be found at http://synergy2.sourceforge.net/
After the upgrade to Leopard (and even after a fresh reinstall) it would start up and then a crash would be logged in /var/log/system.log; searching in Google resulted in a hit that mentions using launchd to start it up and having set it up like that I found that it actually works fine!
The forum post is at http://sourceforge.net/forum/forum.php?thread_id=1848423&forum_id=199580
Continue reading “synergy2 on Leopard”