Python bindings for iTunesMobileDevice.dll

Oddly enough I can’t seem to find a Python wrapper for iTunesMobileDevice.dll. I did manage to find a C# equivalent called Manzana though, which is quite widely used.

Anyhow, I bit the bullet and read through the ctypes documentation and wrote AMDevice.py which exposes some simple classes to handle connecting to an iPhone. I only implemented the minimal set of functions required to download and upload files to the iPhone, as I wrote this primarily for my iPhone SMS import script.

As I use the iPhone SMS import script on a regular basis (the Samsung Jet frequently runs out of SMS memory), I got tired of opening iPhone Explorer, copying the file out, running the script, and then copying the file back. If only the bookmark feature actually worked, I wouldn’t have to navigate to the directory every single time.

With this bit of code (and a jailbroken iPhone) the script will now download the sms.db file, insert new SMSes from Samsung New PC Studio, and upload the file back into the iPhone. Very convenient.

On top of that, I can also use the Python wrapper for other purposes. If you need it, you can find AMDevice.py in the Bitbucket repository for my import script.

Advertisements