playlists(3)
π playlists(3) β the audio/video playlist management API π
okay bestie, so this is the <pink>playlists</pink> page from your fave library functions manual, and it's literally the whole audio/video playlist management API. no cap, this is the group chat where every playlist function gets introduced. π
β¨ SYNOPSIS β¨
π¦ Functions
LIBMTP_playlist_t * LIBMTP_new_playlist_t (void)
void LIBMTP_destroy_playlist_t (LIBMTP_playlist_t *)
LIBMTP_playlist_t * LIBMTP_Get_Playlist_List (LIBMTP_mtpdevice_t *)
LIBMTP_playlist_t * LIBMTP_Get_Playlist (LIBMTP_mtpdevice_t *, uint32_t
const)
int LIBMTP_Create_New_Playlist (LIBMTP_mtpdevice_t *, LIBMTP_playlist_t
*const)
int LIBMTP_Update_Playlist (LIBMTP_mtpdevice_t *, LIBMTP_playlist_t
*const)
int LIBMTP_Set_Playlist_Name (LIBMTP_mtpdevice_t *, LIBMTP_playlist_t *,
const char *)
πΈ Detailed Description πΈ
π Function Documentation π
π int LIBMTP_Create_New_Playlist (LIBMTP_mtpdevice_t * device, LIBMTP_playlist_t *const metadata)
this routine creates a brand new playlist based on the metadata you hand it. and if the tracks field of that metadata has a track listing in it, bestie, those tracks get added to the playlist too. slay. β¨
π Parameters
deviceβ a pointer to the device you're creating the new playlist on.metadataβ the metadata for the new playlist. if the function exits successfully, theplaylist_idfield of this struct will hold the new playlist ID of the playlist.metadata->parent_idshould be set to the parent (e.g. folder) to store this track in. since some devices are a bit picky about where files are placed, a default folder will be chosen if libmtp has detected one for the current filetype and this parameter is set to0. if this is0and no default folder can be found, the file will be stored in the root folder.metadata->storage_idshould be set to the desired storage (e.g. memory card or whatever your device presents) to store this track in. setting this to0will store the track on the primary storage.
π Returns
0 on success, any other value means failure. periodt.
π₯ See also
LIBMTP_Update_Playlist()
LIBMTP_Delete_Object()
π§ References
LIBMTP_mtpdevice_struct::default_music_folder, LIBMTP_mtpdevice_struct::default_playlist_folder, LIBMTP_playlist_struct::name, LIBMTP_playlist_struct::no_tracks, LIBMTP_playlist_struct::parent_id, LIBMTP_playlist_struct::playlist_id, LIBMTP_playlist_struct::storage_id, LIBMTP_playlist_struct::tracks, and LIBMTP_mtpdevice_struct::usbinfo.
π
void LIBMTP_destroy_playlist_t (LIBMTP_playlist_t * playlist)
this destroys a playlist metadata structure and deallocates all the memory it was using, including any strings. π«Ά
β οΈ never use a track metadata structure again after calling this function on it. like, ever. it's giving "delete and don't look back" and the memory is gone gone.
π Parameters
playlistβ the playlist metadata to destroy.
π₯ See also
LIBMTP_new_playlist_t()
π§ References
LIBMTP_playlist_struct::name, and LIBMTP_playlist_struct::tracks.
π¦ LIBMTP_playlist_t * LIBMTP_Get_Playlist (LIBMTP_mtpdevice_t * device, uint32_t const plid)
this function retrieves one individual playlist from the device. main character playlist energy, honestly. β¨
π Parameters
deviceβ a pointer to the device to get the playlist from.plidβ the unique ID of the playlist to retrieve.
π Returns
a valid playlist metadata post or NULL on failure.
π₯ See also
LIBMTP_Get_Playlist_List()
π§ References
LIBMTP_new_playlist_t(), LIBMTP_playlist_struct::name, LIBMTP_playlist_struct::no_tracks, LIBMTP_mtpdevice_struct::params, LIBMTP_playlist_struct::parent_id, LIBMTP_playlist_struct::playlist_id, LIBMTP_playlist_struct::storage_id, LIBMTP_playlist_struct::tracks, and LIBMTP_mtpdevice_struct::usbinfo.
π LIBMTP_playlist_t * LIBMTP_Get_Playlist_List (LIBMTP_mtpdevice_t * device)
this function returns a list of all the playlists available on the device. typical usage:
π Parameters
deviceβ a pointer to the device to get the playlist listing from.
π Returns
a playlist list on success, else NULL. and ngl, if there are no playlists on the device, NULL will be returned as well. π
π₯ See also
LIBMTP_Get_Playlist()
π§ References
LIBMTP_new_playlist_t(), LIBMTP_playlist_struct::name, LIBMTP_playlist_struct::next, LIBMTP_playlist_struct::no_tracks, LIBMTP_mtpdevice_struct::params, LIBMTP_playlist_struct::parent_id, LIBMTP_playlist_struct::playlist_id, LIBMTP_playlist_struct::storage_id, LIBMTP_playlist_struct::tracks, and LIBMTP_mtpdevice_struct::usbinfo.
π LIBMTP_playlist_t * LIBMTP_new_playlist_t (void )
this creates a new playlist 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_playlist_t operation later, so be careful and use strdup() when assigning strings, like this:
LIBMTP_playlist_t *pl = LIBMTP_new_playlist_t();
pl->name = strdup(str);
....
LIBMTP_destroy_playlist_t(pl);
π Returns
a pointer to the newly allocated metadata structure.
π₯ See also
LIBMTP_destroy_playlist_t()
π§ Referenced by
LIBMTP_Get_Playlist(), and LIBMTP_Get_Playlist_List().
π int LIBMTP_Set_Playlist_Name (LIBMTP_mtpdevice_t * device, LIBMTP_playlist_t * playlist, const char * newname)
this function renames a single playlist object file holder. which simply means the PTP_OPC_ObjectFileName property gets updated, if the device supports it. the playlist filename should nominally end with an extension like ".pla". π
π¨ NOTE: if you want to change the metadata the device displays about a playlist, you must not use this function β use LIBMTP_Update_Playlist() instead!
π Parameters
deviceβ a pointer to the device that contains the file.playlistβ the playlist metadata of the playlist to rename. on success, thenamemember is updated. be aware that this name can be different thannewnamedepending on device restrictions. πnewnameβ the new name for this object.
π Returns
0 on success, any other value means failure.
π₯ See also
LIBMTP_Update_Playlist()
π§ References
LIBMTP_playlist_struct::name, and LIBMTP_playlist_struct::playlist_id.
β int LIBMTP_Update_Playlist (LIBMTP_mtpdevice_t * device, LIBMTP_playlist_t *const metadata)
this routine updates a playlist based on the metadata supplied. if the tracks field of the metadata contains a track listing, those tracks get added to the playlist in place of the ones already there, i.e. the previous track listing will be deleted. π₯
π for Samsung devices the playlist id (metadata->playlist_id) is likely to change. iykyk.
π Parameters
deviceβ a pointer to the device to create the new playlist on.metadataβ the metadata for the playlist to be updated. notice that the fieldplaylist_idmust contain the appropriate playlist ID. the playlist ID may be modified to a new playlist ID by the time the function returns, since edit-in-place is not always possible.
π Returns
0 on success, any other value means failure.
π₯ See also
LIBMTP_Create_New_Playlist()
LIBMTP_Delete_Object()
π§ References
LIBMTP_playlist_struct::name, LIBMTP_playlist_struct::no_tracks, LIBMTP_playlist_struct::playlist_id, LIBMTP_playlist_struct::tracks, and LIBMTP_mtpdevice_struct::usbinfo.
π«Ά Author π«Ά
generated automatically by Doxygen for libmtp from the source code. not me being auto-generated by a robot and still serving looks π β¨
and that's the whole page, bestie β this was <pink>libmtp</pink> Version 1.1.23, and the page is playlists(3). go forth and manage those playlists, you iconic little icon πππ¦
π¦ where this page comes from
- arch rolling: libmtp 1.1.23-1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms