Low-level functions

Low-level functions — Low-level functions which shouldn't be needed in normal situations

Synopsis




gchar*      itdb_get_control_dir            (const gchar *mountpoint);
gchar*      itdb_get_itunes_dir             (const gchar *mountpoint);
gchar*      itdb_get_music_dir              (const gchar *mountpoint);
gchar*      itdb_get_artwork_dir            (const gchar *mountpoint);
gchar*      itdb_get_device_dir             (const gchar *mountpoint);
gchar*      itdb_get_photos_dir             (const gchar *mountpoint);
gchar*      itdb_get_itunesdb_path          (const gchar *mountpoint);
gchar*      itdb_get_itunessd_path          (const gchar *mountpoint);
gchar*      itdb_get_artworkdb_path         (const gchar *mountpoint);
gchar*      itdb_get_photodb_path           (const gchar *mountpoint);
gchar*      itdb_get_photos_thumb_dir       (const gchar *mountpoint);
gchar*      itdb_get_path                   (const gchar *dir,
                                             const gchar *file);
gchar*      itdb_resolve_path               (const gchar *root,
                                             const gchar * const *components);
gboolean    itdb_shuffle_write              (Itdb_iTunesDB *itdb,
                                             GError **error);
gboolean    itdb_shuffle_write_file         (Itdb_iTunesDB *itdb,
                                             const gchar *filename,
                                             GError **error);
gboolean    itdb_cp                         (const gchar *from_file,
                                             const gchar *to_file,
                                             GError **error);
Itdb_iTunesDB* itdb_parse_file              (const gchar *filename,
                                             GError **error);
gboolean    itdb_write_file                 (Itdb_iTunesDB *itdb,
                                             const gchar *filename,
                                             GError **error);
Itdb_iTunesDB* itdb_duplicate               (Itdb_iTunesDB *itdb);

Description

These functions are not normally needed but are avalable to allow for finer control over the iPod database.

Details

itdb_get_control_dir ()

gchar*      itdb_get_control_dir            (const gchar *mountpoint);

Get the i*_Control directory. Observed values are 'iPod_Control' for standard iPods and 'iTunes/iTunes_Control' for mobile applications.

mountpoint : the iPod mountpoint
Returns : path to the control dir or NULL of non-existent. Must g_free() after use.

itdb_get_itunes_dir ()

gchar*      itdb_get_itunes_dir             (const gchar *mountpoint);

Retrieve the iTunes directory (containing the iTunesDB) by first calling itdb_get_control_dir() and then adding 'iTunes'

mountpoint : the iPod mountpoint
Returns : path to the iTunes directory or NULL of non-existent. Must g_free() after use.

itdb_get_music_dir ()

gchar*      itdb_get_music_dir              (const gchar *mountpoint);

Retrieve the Music directory (containing the Fnn dirs) by first calling itdb_get_control_dir() and then adding 'Music'

mountpoint : the iPod mountpoint
Returns : path to the Music directory or NULL of non-existent. Must g_free() after use.

itdb_get_artwork_dir ()

gchar*      itdb_get_artwork_dir            (const gchar *mountpoint);

Retrieve the Artwork directory (containing the ArtworDB) by first calling itdb_get_control_dir() and then adding 'Artwork'

mountpoint : the iPod mountpoint
Returns : path to the Artwork directory or NULL of non-existent. Must g_free() after use.

itdb_get_device_dir ()

gchar*      itdb_get_device_dir             (const gchar *mountpoint);

Retrieve the Device directory (containing the SysInfo file) by first calling itdb_get_control_dir() and then adding 'Device'

mountpoint : the iPod mountpoint
Returns : path to the Device directory or NULL of non-existent. Must g_free() after use.

itdb_get_photos_dir ()

gchar*      itdb_get_photos_dir             (const gchar *mountpoint);

Retrieve the Photo directory by first calling itdb_get_control_dir() and then adding 'Photos'

mountpoint : mountpoint of iPod
Returns : path to the Artwork directory or NULL of non-existent. Must g_free() after use.

itdb_get_itunesdb_path ()

gchar*      itdb_get_itunesdb_path          (const gchar *mountpoint);

Retrieve a path to the iTunesDB

mountpoint : the iPod mountpoint
Returns : path to the iTunesDB or NULL if non-existent. Must g_free() after use.

itdb_get_itunessd_path ()

gchar*      itdb_get_itunessd_path          (const gchar *mountpoint);

Retrieve a path to the iTunesSD

mountpoint : the iPod mountpoint
Returns : path to the iTunesSD or NULL if non-existent. Must g_free() after use.

itdb_get_artworkdb_path ()

gchar*      itdb_get_artworkdb_path         (const gchar *mountpoint);

Retrieve a path to the ArtworkDB

mountpoint : the iPod mountpoint
Returns : path to the ArtworkDB or NULL if non-existent. Must g_free() after use.

itdb_get_photodb_path ()

gchar*      itdb_get_photodb_path           (const gchar *mountpoint);

Retrieve a path to the Photo DB

mountpoint : the iPod mountpoint
Returns : path to the PhotoDB or NULL if non-existent. Must g_free() after use.

itdb_get_photos_thumb_dir ()

gchar*      itdb_get_photos_thumb_dir       (const gchar *mountpoint);

Retrieve the Photo Thumbnail directory by first calling itdb_get_control_dir() and then adding 'Photos/Thumbs'

mountpoint : the iPod mountpoint
Returns : path to the Artwork directory or NULL of non-existent. Must g_free() after use.

itdb_get_path ()

gchar*      itdb_get_path                   (const gchar *dir,
                                             const gchar *file);

Retrieve a path to the file in dir

dir : a directory
file : a file
Returns : path to the file or NULL if non-existent. Must be g_free()'d after use.

itdb_resolve_path ()

gchar*      itdb_resolve_path               (const gchar *root,
                                             const gchar * const *components);

Resolve the path to a track on the iPod

We start by assuming that the ipod mount point exists. Then, for each component c of track->ipod_path, we try to find an entry d in good_path that is case-insensitively equal to c. If we find d, we append d to good_path and make the result the new good_path. Otherwise, we quit and return NULL.

root : in local encoding
components : in utf8
Returns : path to track on the iPod or NULL.

itdb_shuffle_write ()

gboolean    itdb_shuffle_write              (Itdb_iTunesDB *itdb,
                                             GError **error);

Write out an iTunesSD for the Shuffle. First reassigns unique IDs to all tracks. An existing "Play Counts" file is renamed to "Play Counts.bak" if the export was successful. An existing "OTGPlaylistInfo" file is removed if the export was successful. itdb->mountpoint must point to the mount point of the iPod, e.g. "/mnt/ipod" and be in local encoding.

itdb : the Itdb_iTunesDB to write to disk
error : return location for a GError or NULL
Returns : TRUE on success, FALSE on error, in which case error is set accordingly.

itdb_shuffle_write_file ()

gboolean    itdb_shuffle_write_file         (Itdb_iTunesDB *itdb,
                                             const gchar *filename,
                                             GError **error);

Do the actual writing to the iTunesSD

itdb : the Itdb_iTunesDB to write to disk
filename : file to write to, cannot be NULL
error : return location for a GError or NULL
Returns : TRUE on success, FALSE on error, in which case error is set accordingly.

itdb_cp ()

gboolean    itdb_cp                         (const gchar *from_file,
                                             const gchar *to_file,
                                             GError **error);

Copy file "from_file" to "to_file".

from_file : source file
to_file : destination file
error : return location for a GError or NULL
Returns : TRUE on success, FALSE on error, in which case error is set accordingly.

itdb_parse_file ()

Itdb_iTunesDB* itdb_parse_file              (const gchar *filename,
                                             GError **error);

Same as itunesdb_parse(), but filename is specified directly.

filename : path to a file in iTunesDB format
error : return location for a GError or NULL
Returns : a newly allocated Itdb_iTunesDB struct holding the tracks and the playlists present on the iPod at mp, NULL if mp isn't an iPod mount point. If non-NULL, the Itdb_iTunesDB is to be freed with itdb_free() when it's no longer needed

itdb_write_file ()

gboolean    itdb_write_file                 (Itdb_iTunesDB *itdb,
                                             const gchar *filename,
                                             GError **error);

Write the content of itdb to filename. If filename is NULL, it attempts to write to itdb->filename.

itdb : the Itdb_iTunesDB to save
filename : filename to save itdb to
error : return location for a GError or NULL
Returns : TRUE if all went well, FALSE otherwise

itdb_duplicate ()

Itdb_iTunesDB* itdb_duplicate               (Itdb_iTunesDB *itdb);

Duplicate itdb FIXME: not implemented yet

itdb : an Itdb_iTunesDB
Returns : always return NULL since it's unimplemented