de.axelwernicke.mypod.ipod
Class IPod

java.lang.Object
  extended byde.axelwernicke.mypod.ipod.IPod

public class IPod
extends java.lang.Object

Class representing an iPod.

Author:
Axel Wernicke axelwernicke@users.sourceforge.net

Field Summary
protected static java.lang.String IPOD_CONTROL_DIR
          string to probe ipod availability
protected static java.lang.String IPOD_ITUNES_DIR
          Relative Path to the iTunes directory on the iPod
 
Constructor Summary
IPod()
          Standard Constructor
 
Method Summary
 boolean addClips(DataPool dataPool, java.util.Vector oids, java.util.Hashtable iMapper, IPodSyncDialog dialog)
          Moves Clips to the iPod
 void createPlaylists(javax.swing.DefaultListModel playlistList, java.util.Hashtable iMapper, IPodSyncDialog dialog)
          Creates playlists on iPod.
 long getClipsSize(java.util.Vector oids, java.util.Hashtable iMapper)
          Gets the summarized filesize for all clips.
 long getDiscSpace()
          Getter for property discSpace.
 long getDiscSpaceFree()
          Getter for property discSpaceFree.
 long getDiscSpaceUsed()
          Getter for property discSpaceUsed.
 ITunesDB getITunesDB()
          Getter for property itunesDB.
 java.lang.String getName()
          Gets the name of the iPod.
 Playcounts getPlaycounts()
          Gets the playcounts object, loads it from file if not done yet
 java.lang.String getSerialNumber()
          Getter for property serial number.
 java.lang.String getVersion()
          Getter for property version.
static boolean isConnected()
          Probes iPod.
 void removeAllClips()
          Removes all Clips from iPod.
 boolean removeClips(java.util.Vector oids, java.util.Hashtable iMapper, IPodSyncDialog dialog)
          Removes Clips from iPod.
 void removeEmptyPlaylists()
          Removes empty playlists on iPod.
 void removePlaycounts()
           
 boolean saveITunesDB()
          Saves iTunes database on iPod.
 boolean saveITunesDB(ITunesDB db)
          saves the iTunes database on iPod.
 void setITunesDB(ITunesDB iTunesDB)
          Setter for property itunesDB.
 void setName(java.lang.String name)
          Setter for property name.
 void setPlaycounts(Playcounts playcounts)
          Setter for property Playcounts.
 void wipe()
          Wipes all music from the iPod.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IPOD_CONTROL_DIR

protected static final java.lang.String IPOD_CONTROL_DIR
string to probe ipod availability

See Also:
Constant Field Values

IPOD_ITUNES_DIR

protected static final java.lang.String IPOD_ITUNES_DIR
Relative Path to the iTunes directory on the iPod

Constructor Detail

IPod

public IPod()
Standard Constructor

Method Detail

saveITunesDB

public boolean saveITunesDB(ITunesDB db)
saves the iTunes database on iPod.

Parameters:
db - Database to save.
Returns:
true, if saving succeeded

saveITunesDB

public boolean saveITunesDB()
Saves iTunes database on iPod.

Returns:
true, if saving succeeded

isConnected

public static boolean isConnected()
Probes iPod. To ensure the iPod is connected, we check the basic file and directory structure.

Returns:
true, if iPod was found.

getClipsSize

public long getClipsSize(java.util.Vector oids,
                         java.util.Hashtable iMapper)
Gets the summarized filesize for all clips. It tries to determine clip size iTunes database.

Parameters:
iMapper - hashtable that allows to find songs on the iPod by myPod oid
oids - vector of oids to summarize filesizes
Returns:
filesize of all specified oids

removeClips

public boolean removeClips(java.util.Vector oids,
                           java.util.Hashtable iMapper,
                           IPodSyncDialog dialog)
Removes Clips from iPod. delete file on the iPod, remove song from iPods database remove song from iMapper

Parameters:
dialog - to inform user about progress
oids - to remove from iPod
iMapper - to correct
Returns:
true, if all clips were removed

removeAllClips

public void removeAllClips()
Removes all Clips from iPod.


addClips

public boolean addClips(DataPool dataPool,
                        java.util.Vector oids,
                        java.util.Hashtable iMapper,
                        IPodSyncDialog dialog)
Moves Clips to the iPod. - move file to the iPod, - add song to iPods database - add song to iMapper

Parameters:
dataPool - to determine clip meta data
dialog - to show progress
oids - of the clips to move
iMapper - to correct
Returns:
true, if all clips were moved

removeEmptyPlaylists

public void removeEmptyPlaylists()
Removes empty playlists on iPod.


createPlaylists

public void createPlaylists(javax.swing.DefaultListModel playlistList,
                            java.util.Hashtable iMapper,
                            IPodSyncDialog dialog)
Creates playlists on iPod. All myPod playlists are checked for synchronization. If a playlist is synchronized with iPod, a playlist is created on iPod, containing all the songs of the myPod playlist, as far as they are transfered correctly to the iPod.

Parameters:
playlistList - list of playlists to create
dialog - to inform user about progress
iMapper - mapper object

setName

public void setName(java.lang.String name)
Setter for property name.

Parameters:
name - New value of property name.

getName

public java.lang.String getName()
Gets the name of the iPod. iPods name is stored in a file calles DeviceInfo. Its located in the iTunes directory.

Returns:
name of the iPod

wipe

public void wipe()
Wipes all music from the iPod.
- create a new empty database from given name
- remove all clips from iPod
- save new database
- serialize iPodMapper


getITunesDB

public ITunesDB getITunesDB()
Getter for property itunesDB.

Returns:
Value of property itunesDB.

setITunesDB

public void setITunesDB(ITunesDB iTunesDB)
Setter for property itunesDB.

Parameters:
iTunesDB - to set

getVersion

public java.lang.String getVersion()
Getter for property version.

Returns:
Value of property version.

getSerialNumber

public java.lang.String getSerialNumber()
Getter for property serial number.

Returns:
Value of property serial number.

getDiscSpace

public long getDiscSpace()
Getter for property discSpace.

Returns:
Value of property discSpace.

getDiscSpaceFree

public long getDiscSpaceFree()
Getter for property discSpaceFree.

Returns:
Value of property discSpaceFree.

getDiscSpaceUsed

public long getDiscSpaceUsed()
Getter for property discSpaceUsed.

Returns:
Value of property discSpaceUsed.

getPlaycounts

public Playcounts getPlaycounts()
Gets the playcounts object, loads it from file if not done yet


setPlaycounts

public void setPlaycounts(Playcounts playcounts)
Setter for property Playcounts.


removePlaycounts

public void removePlaycounts()