libmtp  0.1.4
Functions
The audio/video album management API.

Functions

LIBMTP_album_tLIBMTP_new_album_t (void)
 
void LIBMTP_destroy_album_t (LIBMTP_album_t *)
 
LIBMTP_album_tLIBMTP_Get_Album_List (LIBMTP_mtpdevice_t *)
 
LIBMTP_album_tLIBMTP_Get_Album (LIBMTP_mtpdevice_t *, uint32_t const)
 
int LIBMTP_Create_New_Album (LIBMTP_mtpdevice_t *, LIBMTP_album_t *const, uint32_t const)
 
int LIBMTP_Update_Album (LIBMTP_mtpdevice_t *, LIBMTP_album_t const *const)
 

Detailed Description

Function Documentation

int LIBMTP_Create_New_Album ( LIBMTP_mtpdevice_t device,
LIBMTP_album_t *const  metadata,
uint32_t const  parenthandle 
)

This routine creates a new album based on the metadata supplied. If the tracks field of the metadata contains a track listing, these tracks will be added to the album.

Parameters
devicea pointer to the device to create the new album on.
metadatathe metadata for the new album. If the function exits with success, the album_id field of this struct will contain the new ID of the album.
parenthandlethe parent (e.g. folder) to store this album in. Pass in 0 to put the album in the default music directory.
Returns
0 on success, any other value means failure.
See Also
LIBMTP_Update_Album()
LIBMTP_Delete_Object()

References LIBMTP_album_struct::album_id, LIBMTP_mtpdevice_struct::default_album_folder, LIBMTP_album_struct::name, LIBMTP_album_struct::no_tracks, and LIBMTP_album_struct::tracks.

void LIBMTP_destroy_album_t ( LIBMTP_album_t album)

This recursively deletes the memory for an album structure

Parameters
albumstructure to destroy
See Also
LIBMTP_new_album_t()

References LIBMTP_album_struct::name, and LIBMTP_album_struct::tracks.

LIBMTP_album_t* LIBMTP_Get_Album ( LIBMTP_mtpdevice_t device,
uint32_t const  albid 
)

This function retrieves an individual album from the device.

Parameters
devicea pointer to the device to get the album from.
albidthe unique ID of the album to retrieve.
Returns
a valid album metadata or NULL on failure.
See Also
LIBMTP_Get_Album_List()

References LIBMTP_album_struct::album_id, LIBMTP_new_album_t(), LIBMTP_album_struct::name, LIBMTP_album_struct::no_tracks, LIBMTP_mtpdevice_struct::params, and LIBMTP_album_struct::tracks.

LIBMTP_album_t* LIBMTP_Get_Album_List ( LIBMTP_mtpdevice_t device)

This function returns a list of the albums available on the device.

Parameters
devicea pointer to the device to get the album listing from.
Returns
an album list on success, else NULL. If there are no albums on the device, NULL will be returned as well.
See Also
LIBMTP_Get_Album()

References LIBMTP_album_struct::album_id, LIBMTP_new_album_t(), LIBMTP_album_struct::name, LIBMTP_album_struct::next, LIBMTP_album_struct::no_tracks, LIBMTP_mtpdevice_struct::params, and LIBMTP_album_struct::tracks.

LIBMTP_album_t* LIBMTP_new_album_t ( void  )

This creates a new album metadata structure and allocates memory for it. Notice that if you add strings to this structure they will be freed by the corresponding LIBMTP_destroy_album_t operation later, so be careful of using strdup() when assigning strings.

Returns
a pointer to the newly allocated metadata structure.
See Also
LIBMTP_destroy_album_t()

References LIBMTP_album_struct::album_id.

Referenced by LIBMTP_Get_Album(), and LIBMTP_Get_Album_List().

int LIBMTP_Update_Album ( LIBMTP_mtpdevice_t device,
LIBMTP_album_t const *const  metadata 
)

This routine updates an album based on the metadata supplied. If the tracks field of the metadata contains a track listing, these tracks will be added to the album in place of those already present, i.e. the previous track listing will be deleted.

Parameters
devicea pointer to the device to create the new album on.
metadatathe metadata for the album to be updated. notice that the field album_id must contain the apropriate album ID.
Returns
0 on success, any other value means failure.
See Also
LIBMTP_Create_New_Album()
LIBMTP_Delete_Object()

References LIBMTP_album_struct::album_id, LIBMTP_album_struct::name, LIBMTP_album_struct::no_tracks, LIBMTP_mtpdevice_struct::params, and LIBMTP_album_struct::tracks.