/iLib

A Library for working with the Apple's iDevice MediaLibrary.sqlitedb and getting information out of it.

Primary LanguageC#GNU General Public License v2.0GPL-2.0

iLib

A Library for working with the Apple's iDevice MediaLibrary.sqlitedb.
iLib is released under the GNU General Public License (GPL). Check LICENSE for more.

If you like this project and know enough of C# to contribute, please do it!

The current version of iLib only supports iOS 5 and 6. Support for iOS 3 is under development.

About: iLib

iLib's code is a little messy, is not as well documented as I wanted to and maybe does not follow the best practices in the .NET world. I'm sorry.

As the lib was developed on a Mac, through Mono, Mono.Data.Sqlite was used.

Adapting for Windows

  1. Comment out "using Mono.Data.Sqlite;"
  2. Uncomment "using System.Data.SQLite;"
  3. Capitalize "SQLite" ("SQLiteConnection", "SQLiteCommand" and "SQLiteReader")

Don't forget about the System.Data.SQLite.dll.

About: MediaFile

It was mainly based on the properties of a TagLib# Tag.
Right after that there were some properties I found while trying to understand the MediaLibrary DB. All of that properties can be found inside (new MediaFile).iTunes.

I am pretty sure the names are self explanatory, except for:

  • Location, which is actually the name of the file (e.g. ADZQ.mp3).
  • LocationKind, which is more of a kind then a location. Well, it is the kind of the file in a human-readable way.
  • BaseLocation, which is the folder (inside an iDevice) where the file ("Location") is stored.

About: iLibraryReader

  • Open/CloseSQLite() -> Opens/Closes (and disposes and sets to null) the SQLConnection;
  • GetAllMediaFiles() -> foreach row in the 'item_extra' table, calls GetMediaFile (row["location"]). Returns a List of the elements;
  • GetMediaFile(location) -> returns a MediaFile object based on it "location" (actually the name of the file e.g. AHDS.mp3);
  • GetDataTable(query,oc) -> returns a DataTable object based on a query (that should ONLY READ). OC means Open/Close... if you want the method to Open/Close connection or if you'll DIY.
  • DO NOT forget collect your SQLite-related garbage (.Dispose(), =null) or else you'll get some SIGSEGVs for christmas.

About: MediaLibrary.sqlitedb

I see you're still interested in my project and want to learn more about apple's MediaLibrary.sqlitedb. In the future (just not now), I'll post something about it.

However, you can easily undertand the Database buy using sqlite3 command line tool and the commands ".tables", ".schema (table)" and "SELECT ..." statements.