Pseudo-Sync an eReader with iTunes and iBookstore
Apr 15, '11 07:30:00AM
Contributed by: Andrew J Freyer
In this hint, I describe the process I use to sync my Sony PRS-350 eReader with iTunes and the iBookstore. NOTE: this does not circumvent any DRM for iBookstore purchases. For simplicity, this hint assumes that books/PDFs import to the device are DRM-free, or otherwise viewable on your device.
First, some facts:
- Sony eReaders, the Kindle, and many other eReaders are mounted to OSX as a regular external volume. The user can drag and drop compatible files and they will appear in the reader's library when ejected.
- If the user has not opted to manually mange their files, iTunes stores imported eBooks in the ~/Music/iTunes/Books/ Directory.
- The Unix tool rsync can synchronize two directories.
- The Unix tool diskutil can mount and eject external volumes.
- Many third party tools, such as Hazel can perform script actions when an external volume is mounted/ejected.
I make use of these four facts in this way:
- I plug in my eReader.
- Hazel recognizes the volume, begins rsync between iTunes and the eReader's book directory.
- When rsync completes, diskutil ejects the reader (so I can remove it safely).
- Lastly, a Growl alert is sent indicating sync completion.
Here are the scripts. Each of these will require some customization for your particular reader:
To Sync:
rsync -va --delete /Users/YOUR USERNAME/Music/iTunes/Books/ /Volumes/READER/database/media/books/
To Eject (in the case of the Sony PRS-350, there are two partitions mounted that need to be ejected):
diskutil unmount `disktool -l | grep 'READER' | sed 's/.*\(disk[0-9s]*\).*/\1/'`
diskutil unmount `disktool -l | grep 'SETTING' | sed 's/.*\(disk[0-9s]*\).*/\1/'`
For Hazel:
Add a the /Volumes directory for a 'Folder with name YOUR EREADER VOLUME NAME.'
For the action, add a shell script containing the scripts above. Click here to see a screenshot of the full Hazel rule.
I also have a Hazel rule that imports to iTunes all *.epub files (and other reader files) that appear in the downloads directory. This action also includes a script to re-mount the eReader upon a new import. Simply change the diskutil script above to read 'mount' instead of 'unmount.'
I call this a pseudo-sync because iTunes does not behave well when third party scripts delete its library files. The current script will only delete files on the device. Thus, if you delete a book on your device but not on iTunes, it will re-appear on your device on your next sync. All book management should be completed in iTunes. Also, I should note that to access the iBookstore, you'll need an iPad, iPhone, or iPod touch.
[crarko adds: I haven't tested this one.]
Comments (1)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20110413143511742