![]() |
![]() |
![]() |
libgpod Reference Manual | ![]() |
---|---|---|---|---|
iPod database reading/writingiPod database reading/writing — Functions to create, read, write the iPod database |
Itdb_iTunesDB; void (*ItdbUserDataDestroyFunc) (gpointer userdata); gpointer (*ItdbUserDataDuplicateFunc) (gpointer userdata); Itdb_iTunesDB* itdb_new (void); void itdb_free (Itdb_iTunesDB *itdb); Itdb_iTunesDB* itdb_parse (const gchar *mp, GError **error); gboolean itdb_write (Itdb_iTunesDB *db, GError **error); void itdb_set_mountpoint (Itdb_iTunesDB *itdb, const gchar *mp); const gchar* itdb_get_mountpoint (Itdb_iTunesDB *itdb); guint32 itdb_tracks_number (Itdb_iTunesDB *itdb); guint32 itdb_tracks_number_nontransferred (Itdb_iTunesDB *itdb); guint32 itdb_playlists_number (Itdb_iTunesDB *itdb);
typedef struct { GList *tracks; GList *playlists; gchar *filename; /* filename of iTunesDB */ Itdb_Device *device;/* iPod device info */ guint32 version; guint64 id; /* below is for use by application */ guint64 usertype; gpointer userdata; /* function called to duplicate userdata */ ItdbUserDataDuplicateFunc userdata_duplicate; /* function called to free userdata */ ItdbUserDataDestroyFunc userdata_destroy; } Itdb_iTunesDB;
gpointer (*ItdbUserDataDuplicateFunc) (gpointer userdata);
userdata : |
|
Returns : |
Itdb_iTunesDB* itdb_new (void);
Creates a new Itdb_iTunesDB with the unknowns filled in to reasonable values.
Returns : | a newly created Itdb_iTunesDB to be freed with itdb_free()
when it's no longer needed
|
void itdb_free (Itdb_iTunesDB *itdb);
Free the memory taken by itdb
.
itdb : |
an Itdb_iTunesDB |
Itdb_iTunesDB* itdb_parse (const gchar *mp, GError **error);
Parse the Itdb_iTunesDB of the iPod located at mp
mp : |
mount point of the iPod (eg "/mnt/ipod) in local encoding |
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
|
gboolean itdb_write (Itdb_iTunesDB *db, GError **error);
Write out an iTunesDB. It 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.
db : |
|
error : |
return location for a GError or NULL |
Returns : | TRUE on success, FALSE on error, in which case error is
set accordingly.
|
void itdb_set_mountpoint (Itdb_iTunesDB *itdb, const gchar *mp);
Sets the mountpoint of db
. Always use this function to set the mountpoint
of an Itdb_iTunesDB as it will reset the number of available
/iPod_Control/Music/F.. dirs. It doesn't attempt to parse an iPod database
that may be present on the iPod at mp
itdb : |
an Itdb_iTunesDB |
mp : |
new mount point |
const gchar* itdb_get_mountpoint (Itdb_iTunesDB *itdb);
Retrieve a reference to the mountpoint of itdb
itdb : |
an Itdb_iTunesDB |
Returns : | the itdb mountpoint, this string shouldn't be freed nor
modified
|
guint32 itdb_tracks_number (Itdb_iTunesDB *itdb);
Counts the number of tracks stored in itdb
itdb : |
an Itdb_iTunesDB |
Returns : | the number of tracks in itdb
|
guint32 itdb_tracks_number_nontransferred (Itdb_iTunesDB *itdb);
Counts the number of non-transferred tracks in itdb
itdb : |
an Itdb_iTunesDB |
Returns : | the number of tracks in itdb that haven't been transferred
to the iPod yet (ie the number of Itdb_Track in which the transferred field
is false)
|
guint32 itdb_playlists_number (Itdb_iTunesDB *itdb);
Counts the number of playlists stored in itdb
itdb : |
an Itdb_iTunesDB |
Returns : | the number of playlists in itdb (including the master
playlist)
|