Freya  0.0.1
A Gtk3 MPD Client
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions
MPD::Client Class Reference

The client implements concrete commands of the MPD Protocol. More...

#include <Client.hh>

Inheritance diagram for MPD::Client:
[legend]
Collaboration diagram for MPD::Client:
[legend]

Public Member Functions

 Client ()
 Instance the client.
 ~Client ()
 Disconnects also.
void connect ()
 Connect to the MPD Server specified in the config.
void disconnect ()
 Disconnects from the currently connected server.
bool playback_next ()
 Go to next song.
bool playback_prev ()
 Go the prev song.
bool playback_stop ()
 Stop playback.
bool playback_play ()
 Resume from stopmode.
bool playback_pause ()
 Toggle pause-state.
void playback_seek (unsigned song_id, unsigned abs_time)
 Seek forward in song song_id, to abs_time from start.
void playback_crossfade (unsigned seconds)
 Set blending between songs in seconds.
void toggle_random ()
 Toggle randome mode.
void toggle_consume ()
 Toggle consume mode (song gets deleted from playlist after playing)
void toggle_repeat ()
 Toggle repeat mode (repeat playlist)
void toggle_single ()
 Toggle single mode (stops playing after one song)
void play_song_at_id (unsigned song_id)
 Play song at ID (not the Pos in the Queue!)

Save the current queue as playlist of name

Parameters:
name
void playlist_save (const char *name)
void queue_add (const char *url)
 Add song from the database to the queue.
void queue_clear ()
 Clears entire queue.
void queue_delete (unsigned pos)
 Deletes song in the queue.
unsigned database_update (const char *path)
 Update the database.
unsigned database_rescan (const char *path)
 Full rescan of the database.
void set_volume (unsigned vol)
 set the volume
void fill_queue (AbstractItemlist &data_model)
 Fetches the playlist from the mpd server.
void fill_queue_changes (AbstractItemlist &data_model, unsigned last_version, unsigned &first_pos)
void fill_playlists (AbstractItemlist &data_model)
 Fetches all playlists from the server.
void fill_outputs (AbstractItemlist &data_model)
 Fetches all available outputs from the server.
void fill_filelist (AbstractItemlist &data_model, const char *path)
 Fetches a list of files in the database.
bool send_command (const char *command)
 Send a command to the server.
bool ping ()
 Pings server.

Detailed Description

The client implements concrete commands of the MPD Protocol.

Definition at line 44 of file Client.hh.


Constructor & Destructor Documentation

Instance the client.

If settings.connection.autoconnect is set to true This also connects already anc calls force_update() Use is_connected() to check if beign connected.

Disconnects also.


Member Function Documentation

Connect to the MPD Server specified in the config.

See also BaseClient

Here is the caller graph for this function:

unsigned MPD::Client::database_rescan ( const char *  path)

Full rescan of the database.

This is a very expensive operation and might take some time.

Parameters:
pathan optional path, "/" means everything.
Returns:
an update id
unsigned MPD::Client::database_update ( const char *  path)

Update the database.

Add new files to mpd's database

Parameters:
patha certain path, or "/" for everything
Returns:
an update id

Disconnects from the currently connected server.

If already disconnected it does plain nothing. If connection was lost violently BaseClient will try to periodically reconnect.

Here is the caller graph for this function:

void MPD::Client::fill_filelist ( AbstractItemlist &  data_model,
const char *  path 
) [virtual]

Fetches a list of files in the database.

Parameters:
data_modelA user defined class, that inherits from AbstractSonglist
pathA certain path, or NULL which will add /

Implements MPD::AbstractItemGenerator.

void MPD::Client::fill_outputs ( AbstractItemlist &  data_model) [virtual]

Fetches all available outputs from the server.

Parameters:
data_modelA user defined class, that inherits from AbstractSonglist

Implements MPD::AbstractItemGenerator.

void MPD::Client::fill_playlists ( AbstractItemlist &  data_model) [virtual]

Fetches all playlists from the server.

Parameters:
data_modelA user defined class, that inherits from AbstractSonglist

Implements MPD::AbstractItemGenerator.

void MPD::Client::fill_queue ( AbstractItemlist &  data_model) [virtual]

Fetches the playlist from the mpd server.

Parameters:
data_modelA user defined class, that inherits from AbstractSonglist
Returns:
the number of filled items.

Implements MPD::AbstractItemGenerator.

void MPD::Client::fill_queue_changes ( AbstractItemlist &  data_model,
unsigned  last_version,
unsigned &  first_pos 
) [virtual]
Parameters:
data_modelA user defined class, that inherits from AbstractSonglist
last_versionThe changes since this version
first_posThe position of the song that changed first is stored here

Implements MPD::AbstractItemGenerator.

Pings server.

Returns:
true if it responds correctly

Here is the caller graph for this function:

void MPD::Client::play_song_at_id ( unsigned  song_id)

Play song at ID (not the Pos in the Queue!)

Parameters:
song_id
void MPD::Client::playback_crossfade ( unsigned  seconds)

Set blending between songs in seconds.

Parameters:
seconds

Go to next song.

Returns:
true on success

Toggle pause-state.

When playing it gets paused, when being paused it starts playing.

Returns:
true on success

Resume from stopmode.

Returns:
true on success

Go the prev song.

Returns:
true on success
void MPD::Client::playback_seek ( unsigned  song_id,
unsigned  abs_time 
)

Seek forward in song song_id, to abs_time from start.

Parameters:
song_idThe song to seek in
abs_timeTime in seconds starting from 0

Stop playback.

Will remember the current song. You have to call playback_play() to "unstop"

Returns:
true on success
void MPD::Client::playlist_save ( const char *  name)
void MPD::Client::queue_add ( const char *  url)

Add song from the database to the queue.

Parameters:
urla path to the song, does not start with /

Clears entire queue.

void MPD::Client::queue_delete ( unsigned  pos)

Deletes song in the queue.

Parameters:
pos
bool MPD::Client::send_command ( const char *  command)

Send a command to the server.

The output will be printed in the cmd, it is therefore just useful for debugging purpose

Parameters:
commandSee the protocol reference: http://www.musicpd.org/doc/protocol/index.html
Returns:
true on succesfull execution
void MPD::Client::set_volume ( unsigned  vol)

set the volume

Parameters:
volMust be in [0-100]

Toggle consume mode (song gets deleted from playlist after playing)

Here is the caller graph for this function:

Toggle randome mode.

Here is the caller graph for this function:

Toggle repeat mode (repeat playlist)

Here is the caller graph for this function:

Toggle single mode (stops playing after one song)

Here is the caller graph for this function:


The documentation for this class was generated from the following file: