musicus mpd client 0.1d
Functions
General MPD

Functions

gboolean mpd_is_connected (MpdObj *obj)
MpdData * mpd_data_get_next_keep (MpdData *data)
mpd_Song * mpd_get_current_song (MpdObj *obj)
mpd_Connection * mpd_object_get_connection (MpdObj *obj)
void mpd_status_changed_cb (MpdObj *obj, ChangedStatusType what, gpointer data)
void mpd_play_state_update (MpdObj *obj)
int mpd_get_db_length ()
int mpd_get_pl_length ()
int mpd_get_current_song_pos ()
int mpd_get_current_play_time ()
int mpd_get_current_song_time ()
int mpd_get_current_song_string (char *song, int strlen)
int mpd_get_current_title_string (char *title, int strlen)
int mpd_get_current_album_string (char *album, int strlen)
int mpd_get_current_artist_string (char *artist, int strlen)
int mpd_get_current_track_string (char *track, int strlen)
gboolean mpd_has_current_song_changed ()
gboolean mpd_has_playlist_changed ()
gboolean mpd_has_play_state_changed ()
int mpd_play_state ()
void msi_fill (MpdInfo *mi)
void msi_clear (MpdInfo *mi)

Detailed Description

MPD related general actions such as connection issues, status changes etc.


Function Documentation

MpdData* mpd_data_get_next_keep ( MpdData *  data)

Convenience function if a MpdData list is used more than once

Parameters:
dataa pointer to a MpdData list
Returns:
a pointer to the next element in the list (keeping the current element intact)
int mpd_get_current_album_string ( char *  album,
int  strlen 
)

Get the album name from which current song comes or "n/a" if no song is playing

Parameters:
*albuma pointer to a char array of length strlen
strlenthe length of the array to which album points
Returns:
0
int mpd_get_current_artist_string ( char *  artist,
int  strlen 
)

Get the artist name from which current song comes or "n/a" if no artist tag for the current song.

Parameters:
*artista pointer to a char array of length strlen
strlenthe length of the array to which `artist` points
Returns:
0
int mpd_get_current_play_time ( )

Get the current play time of the song which is playing

Returns:
the current play time (the time of the song that has been played)
mpd_Song* mpd_get_current_song ( MpdObj *  obj)

Gets the currently playing song. Clients don't need to free the result but must check the connection to the daemon

Parameters:
obja pointer to a connected MpdObj
Returns:
a pointer to the current song
int mpd_get_current_song_pos ( )

Get the current playlist from mpd

Returns:
a pointer to a MpdPlContainer which contains the current playlist
int mpd_get_current_song_string ( char *  song,
int  strlen 
)

Get a string describing the current song in the following format:
if playing||paused:

  • if {artist_name} != NULL: "{artist name} - {song name}"
  • else: "{song name}"

else: "mpd not playing"

Parameters:
*songa pointer to an char array of length strlen
strlenthe length of the array to which song points
Returns:
0
int mpd_get_current_song_time ( )

Get the total time of the current song

Returns:
the total time of the current song
int mpd_get_current_title_string ( char *  title,
int  strlen 
)

Get the title of the current song or "n/a" if no song is playing

Parameters:
*titlea pointer to a char array of length strlen
strlenthe length of the array to which title points
Returns:
0
int mpd_get_current_track_string ( char *  track,
int  strlen 
)

Gets the track tag of the current song.

Parameters:
*tracka pointer to a char array of length strlen
strlenthe length of the array to which track points
Returns:
0
int mpd_get_db_length ( )

Gets the number of entries in the MPD database

Returns:
number of entries in the MPD database
int mpd_get_pl_length ( )

Gets the number of songs in the current playlist

Returns:
number of songs in the current playlist
gboolean mpd_has_current_song_changed ( )

Returns TRUE if the current song has changed

Returns:
TRUE if changed, FALSE if not
gboolean mpd_has_play_state_changed ( )

Returns TRUE if the play state has changed

Returns:
TRUE if changed, FALSE if not
gboolean mpd_has_playlist_changed ( )

Returns TRUE if the playlist has changed

Returns:
TRUE if changed, FALSE if not
gboolean mpd_is_connected ( MpdObj *  obj)

Checks if there is a connection to mpd

Parameters:
obja pointer to a MpdObj
Returns:
TRUE if connected, FALSE if not
mpd_Connection* mpd_object_get_connection ( MpdObj *  obj)

Gets the mpd_Connection from the supplied MpdObj

Parameters:
objthe MpdObj you want the connection from
Returns:
the mpd_Connection associated with `obj`
int mpd_play_state ( )

Returns the play state of MPD:

  • 0 == stopped, whatever
  • 1 == playing
  • 2 == paused
Returns:
the play state as indicated above
void mpd_play_state_update ( MpdObj *  obj)

Updates the MpdPlayState fields in mpd_info, does not check if connection to mpd is ok, the caller has to ensure that.

Parameters:
obja pointer to the MpdObj from which the state info should be fetched
void mpd_status_changed_cb ( MpdObj *  obj,
ChangedStatusType  what,
gpointer  data 
)

A callback function which is registered with libmpd using the mpd_signal_connect_status_changed() function and gets called every time the status of the daemon changes

Parameters:
objpointer to the calling MpdObj
whata code of the changed property
dataadditional data
void msi_clear ( MpdInfo mi)

clears the mi.msi field

Parameters:
mia MpdInfo struct
void msi_fill ( MpdInfo mi)

fills the mi.msi field (MpdStateInfo) with information obtained from the MpdObj mi.obj

Parameters:
mia MpdInfo struct
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines