Version 5, last updated by redbrain at August 03, 2008 16:21 UTC

Well i guess where to start, my aim for this project is to have a java implementation of the libgpod (gtkpod) project. This is licienced under the LGPL, and was started for the need of the java media players like aTunes, or jajuk.

 There are 2 branches on the SVN repos at the moment. One is testing branch of code to mess with but in a bad design. The other branch, libjpod is the main branch for the actual final lib. So There are a few approaches to look at read/write to an ipod.

 For all ipods except for the newest editions like the iTouch or iPhone, there is a folder  iPod_Control/iTunes which contains a file iTunesDB. In this file there is a mess of strings and tags for data. 

* mhbd - root tag of a database<BR>
 * mhsd - list holder, contains song lists or playlists<BR>
 * mhlt - song list header contains song items<BR>
 * mhit - song item, stores song meta information and is followed by one or more<BR>
 * mhod - song item content - stores one strings like artist, filetype, path etc.<BR>
 * mhlp - playlist header, contains one or more playlist items<BR>
 * mhyp - playlist item holds the playlist in paires of<BR>
 * mhip - playlist index and mhod<BR>

This is just some of the data, it contains the links and id3 tag info for all songs on the ipod, when writing to an ipod this itunesdb file needs to be edited for the ipod to know the song is inside its repos. Going on to where the files are stored on the ipod is still something i havent figured out, the files are located in  iPod_Control/Music.

Inside files like FOO and F01 etc the music files reside, in a paticular order aswell as the files renamed. One thing i tried their recently is using the jAudioTagger to read through all the music files for their id3 tags to see what file is which, but i havent had much time to look at any patterns a guess would be the first track of each album could be put into F00 or F01 for track 2. 

But my main concern is getting a good algorithm for reading the itunesdb file. Anyways my libgpod branch is designed to get read/write support to an ipod really quick. So what you want to do is

import org.commonjukebox.libjpod.iPod.*;

In that package contains classes:  ipod_3gen or  ipod_4gen. These java files extend the abstract class ipod.So the ipod3gen or 4gen has to implement methods like:

 publicabstractvoid readIpod() throws Exception;

publicabstract Artist[] getArtists();

publicabstractboolean writeSongToIpod(File song);

publicabstractdouble getIpodFreeSpace();

publicabstractdouble getIpodUsedSpace();

I think these are the main methods for this ipod lib to get started, ofcouse depending on the ipod generation like the ipod photo it might be good to have methods to add album art to it etc.

But basicaly i have the lib made so that you create an object of the ipod_3gen or whatever the ipod seems to be and you have acces to atleast the above methods. the Artist class contains a linkedlist of albums and each album class contains a list of songs and each song contains info on the song and file path on the ipod etc. I will aim to update this as i go. 

-Philip Herron