C# Class Libmpc.Mpc

The Mpc class implements all commands for the MPD. It takes care of command building and parsing the response into .net objects.
Afficher le fichier Open project: sakya/wpfmpdclient Class Usage Examples

Méthodes publiques

Méthode Description
Add ( string filename ) : void

Adds a file to the playlist.

AddId ( string filename ) : int

Adds a file to the playlist and returns the id.

ChannelSendMessage ( string channel, string message ) : bool

Send a message to the specified channel.

ChannelSubscribe ( string channel ) : bool

Subscribe to a channel. The channel is created if it does not exist already. The name may consist of alphanumeric ASCII characters plus underscore, dash, dot and colon.

ChannelUnsubscribe ( string channel ) : bool

Unsubscribe from a channel.

Channels ( ) : List

Returns a list of all channels

Clear ( ) : void

Clears the playlist.

ClearError ( ) : void

Clears the error message set in the MPD.

Commands ( ) : List

Returns which commands the current user has access to.

Crossfade ( int seconds ) : void

Sets the seconds to crossfade between songs.

CurrentSong ( ) : MpdFile

Returns the information of the current song.

Delete ( int nr ) : void

Deletes the track with the given index from the current playlist.

DeleteId ( int id ) : void

Deletes the track with the given id from the current playlist.

DisableOutput ( int id ) : bool

Disables an MPD output.

EnableOutput ( int id ) : bool

Enables an MPD output.

Find ( string>.Dictionary search ) : List

Returns all files in the database who's attribute matches the given tokens. Works like the Search command but is case sensitive.

Find ( ScopeSpecifier scopeSpecifier, string token ) : List

Returns all files in the database who's attribute matches the given token. Works like the Search command but is case sensitive.

Idle ( Subsystems subsystems ) : void

Puts the client in idle mode for the given subsystems

You cannot send other commands to a client in idle mode

List ( ScopeSpecifier scopeSpecifier ) : List

Returns all values found in files of the MPD for the given attribute.

List ( ScopeSpecifier resultTag, ScopeSpecifier searchTag, string searchValue ) : List

Returns all values for the given attribute found in files of the MPD where another attribute matches a given value.

ListAll ( string path ) : List

Returns the names of all files and directory found under the given path.

ListAllInfo ( string path ) : List

Returns the information of all files found in the given path and its subdirectories.

ListPlaylist ( string name ) : List

Returns the filenames of the tracks in the given playlist.

ListPlaylistInfo ( string name ) : List

Return the meta data of the tracks in the given playlist.

ListPlaylists ( ) : List

Returns a list of the playlist directory.

Load ( string name ) : void

Loads the playlist with the given name.

LsInfo ( ) : MpdDirectoryListing

Returns the directory listing of the root directory.

LsInfo ( string path ) : MpdDirectoryListing

Returns the directory listing of the given path.

Move ( int oldNr, int newNr ) : void

Moves a track within the playlist.

MoveId ( int id, int nr ) : void

Moves a track within the playlist.

Mpc ( ) : System

Creates a new Mpc.

Next ( ) : void

Starts the playback of the next song in the playlist-

NotCommands ( ) : List

Returns which commands the current user does has access to.

Outputs ( ) : MpdOutput[]

Lists all outputs of the MPD.

Password ( string password ) : bool

Send the password to the server allow access to the server if enabled in the MPD.

Pause ( bool pause ) : void

Sets the MPD to pause or resume the playback.

Ping ( ) : void

Sends a ping command to the server and waits for the response.

PlChangesPosId ( int version ) : int>>.List

Returns the ids and positions of the changed tracks in the playlist since the given version.

Play ( ) : void

Starts the playback of the current item in the playlist.

Play ( int nr ) : void

Starts the playback of the item with the given index in the playlist.

PlayId ( ) : void

Starts the playback of the track in the playlist with the id 0.

PlayId ( int id ) : void

Starts the playback of the track in the playlist with the given id.

PlaylistAdd ( string name, string file ) : void

Add a file to a playlist.

PlaylistClear ( string name ) : void

Clears all tracks from a playlist.

PlaylistDelete ( string name, int id ) : void

Delete a file from a playlist.

PlaylistFind ( ScopeSpecifier scopeSpecifier, string token ) : List

Returns the meta data for all tracks in the current playlist whos attribute equals the given value.

PlaylistId ( ) : List

Returns the meta data of the items in the current playlist.

PlaylistId ( int id ) : MpdFile

Returns the meta data of a track in the current playlist.

PlaylistInfo ( ) : List

Returns the meta data of the items in the current playlist.

PlaylistInfo ( int nr ) : MpdFile

Returns the meta data of a track in the current playlist.

PlaylistMove ( string name, int id, int nr ) : void

Moves a track in a playlist.

PlaylistSearch ( ScopeSpecifier scopeSpecifier, string token ) : List

Returns the meta data for all tracks in the current playlist whos attribute contains the given value.

Plchanges ( int version ) : List

Returns all changed tracks in the playlist since the given version.

Previous ( ) : void

Starts the playback of the previous track in the playlist.

Random ( bool random ) : void

Sets the MPD to random or sequential playback.

ReadChannelsMessages ( ) : List

Reads messages for this client.

Rename ( string oldName, string newName ) : void

Renames a playlist.

Repeat ( bool repeat ) : void

Sets if the MPD should repeat the playlist.

Rm ( string name ) : void

Removes the playlist with the given name.

Save ( string name ) : void

Saves the current playlist with the given name.

Search ( ScopeSpecifier scopeSpecifier, string token ) : List

Returns all files in the database who's attribute matches the given token. Works like the Find command but is case insensitive.

Seek ( int nr, int time ) : void

Starts playback of a given song at the give position.

SeekId ( int id, int time ) : void

Starts playback of a given song at the give position.

SetVol ( int vol ) : void

Sets the output volume of the MPD.

Shuffle ( ) : void

Shuffles the current playlist.

Stats ( ) : MpdStatistics

Requests the current statistics from the MPD,

Status ( ) : MpdStatus

Returns the current status of the MPD.

Stop ( ) : void

Stops the playback of the MPD.

Swap ( int nr1, int nr2 ) : void

Swaps the to tracks in the current playlist.

SwapId ( int id1, int id2 ) : void

Swaps the to tracks in the current playlist.

TagTypes ( ) : string[]

Returns the list of tag types the MPD supports.

Update ( ) : int

Starts an update of the MPD database.

Private Methods

Méthode Description
EscapeString ( string input ) : string
IdleThread ( object state ) : void
OnSubsystemsChangedHandler ( MpcConnection connection, Mpc subsystems ) : void
getConnection ( ) : MpcConnection
onMpcConnectionConnected ( MpcConnection connection ) : void
onMpcConnectionDisconnected ( MpcConnection connection ) : void
toTag ( ScopeSpecifier scopeSpecifier ) : string

Method Details

Add() public méthode

Adds a file to the playlist.
public Add ( string filename ) : void
filename string The name and path of the file to add.
Résultat void

AddId() public méthode

Adds a file to the playlist and returns the id.
public AddId ( string filename ) : int
filename string The name and path of the file to add.
Résultat int

ChannelSendMessage() public méthode

Send a message to the specified channel.
public ChannelSendMessage ( string channel, string message ) : bool
channel string
message string
Résultat bool

ChannelSubscribe() public méthode

Subscribe to a channel. The channel is created if it does not exist already. The name may consist of alphanumeric ASCII characters plus underscore, dash, dot and colon.
public ChannelSubscribe ( string channel ) : bool
channel string
Résultat bool

ChannelUnsubscribe() public méthode

Unsubscribe from a channel.
public ChannelUnsubscribe ( string channel ) : bool
channel string
Résultat bool

Channels() public méthode

Returns a list of all channels
public Channels ( ) : List
Résultat List

Clear() public méthode

Clears the playlist.
public Clear ( ) : void
Résultat void

ClearError() public méthode

Clears the error message set in the MPD.
public ClearError ( ) : void
Résultat void

Commands() public méthode

Returns which commands the current user has access to.
public Commands ( ) : List
Résultat List

Crossfade() public méthode

Sets the seconds to crossfade between songs.
public Crossfade ( int seconds ) : void
seconds int The seconds to crossfade between songs.
Résultat void

CurrentSong() public méthode

Returns the information of the current song.
public CurrentSong ( ) : MpdFile
Résultat MpdFile

Delete() public méthode

Deletes the track with the given index from the current playlist.
public Delete ( int nr ) : void
nr int The index of the track to remove from the playlist.
Résultat void

DeleteId() public méthode

Deletes the track with the given id from the current playlist.
public DeleteId ( int id ) : void
id int The id of the track to remove from the playlist.
Résultat void

DisableOutput() public méthode

Disables an MPD output.
public DisableOutput ( int id ) : bool
id int The id of the output.
Résultat bool

EnableOutput() public méthode

Enables an MPD output.
public EnableOutput ( int id ) : bool
id int The id of the output.
Résultat bool

Find() public méthode

Returns all files in the database who's attribute matches the given tokens. Works like the Search command but is case sensitive.
public Find ( string>.Dictionary search ) : List
search string>.Dictionary The values the files attribute must have to be included in the result.
Résultat List

Find() public méthode

Returns all files in the database who's attribute matches the given token. Works like the Search command but is case sensitive.
public Find ( ScopeSpecifier scopeSpecifier, string token ) : List
scopeSpecifier ScopeSpecifier Specifies the attribute to search for.
token string The value the files attribute must have to be included in the result.
Résultat List

Idle() public méthode

Puts the client in idle mode for the given subsystems
You cannot send other commands to a client in idle mode
public Idle ( Subsystems subsystems ) : void
subsystems Subsystems The subsystems to listen to.
Résultat void

List() public méthode

Returns all values found in files of the MPD for the given attribute.
public List ( ScopeSpecifier scopeSpecifier ) : List
scopeSpecifier ScopeSpecifier The attribute who's values are requested.
Résultat List

List() public méthode

Returns all values for the given attribute found in files of the MPD where another attribute matches a given value.
public List ( ScopeSpecifier resultTag, ScopeSpecifier searchTag, string searchValue ) : List
resultTag ScopeSpecifier The attribute whos values are returns.
searchTag ScopeSpecifier The attribute whos value should match a given value for the file to be included in the result.
searchValue string The value the searchTag attribute must match for the file to be included in the result.
Résultat List

ListAll() public méthode

Returns the names of all files and directory found under the given path.
public ListAll ( string path ) : List
path string The path whos subdirectories and their files are requested.
Résultat List

ListAllInfo() public méthode

Returns the information of all files found in the given path and its subdirectories.
public ListAllInfo ( string path ) : List
path string The path of which the file information is requested.
Résultat List

ListPlaylist() public méthode

Returns the filenames of the tracks in the given playlist.
public ListPlaylist ( string name ) : List
name string The playlist whos filename are requested.
Résultat List

ListPlaylistInfo() public méthode

Return the meta data of the tracks in the given playlist.
public ListPlaylistInfo ( string name ) : List
name string The playlist whos files meta data are requested.
Résultat List

ListPlaylists() public méthode

Returns a list of the playlist directory.
public ListPlaylists ( ) : List
Résultat List

Load() public méthode

Loads the playlist with the given name.
public Load ( string name ) : void
name string The name of the playlist to load.
Résultat void

LsInfo() public méthode

Returns the directory listing of the root directory.
public LsInfo ( ) : MpdDirectoryListing
Résultat MpdDirectoryListing

LsInfo() public méthode

Returns the directory listing of the given path.
public LsInfo ( string path ) : MpdDirectoryListing
path string The path whos listing is requested.
Résultat MpdDirectoryListing

Move() public méthode

Moves a track within the playlist.
public Move ( int oldNr, int newNr ) : void
oldNr int The old index of the track in the playlist.
newNr int The new index of the track in the playlist.
Résultat void

MoveId() public méthode

Moves a track within the playlist.
public MoveId ( int id, int nr ) : void
id int The id of the track to move.
nr int The new index of the track in the playlist.
Résultat void

Mpc() public méthode

Creates a new Mpc.
public Mpc ( ) : System
Résultat System

Next() public méthode

Starts the playback of the next song in the playlist-
public Next ( ) : void
Résultat void

NotCommands() public méthode

Returns which commands the current user does has access to.
public NotCommands ( ) : List
Résultat List

Outputs() public méthode

Lists all outputs of the MPD.
public Outputs ( ) : MpdOutput[]
Résultat MpdOutput[]

Password() public méthode

Send the password to the server allow access to the server if enabled in the MPD.
public Password ( string password ) : bool
password string The password to authorize to the server.
Résultat bool

Pause() public méthode

Sets the MPD to pause or resume the playback.
public Pause ( bool pause ) : void
pause bool If the playback should be paused or resumed.
Résultat void

Ping() public méthode

Sends a ping command to the server and waits for the response.
public Ping ( ) : void
Résultat void

PlChangesPosId() public méthode

Returns the ids and positions of the changed tracks in the playlist since the given version.
public PlChangesPosId ( int version ) : int>>.List
version int
Résultat int>>.List

Play() public méthode

Starts the playback of the current item in the playlist.
public Play ( ) : void
Résultat void

Play() public méthode

Starts the playback of the item with the given index in the playlist.
public Play ( int nr ) : void
nr int The index of the track in the playlist to start playing.
Résultat void

PlayId() public méthode

Starts the playback of the track in the playlist with the id 0.
public PlayId ( ) : void
Résultat void

PlayId() public méthode

Starts the playback of the track in the playlist with the given id.
public PlayId ( int id ) : void
id int The id of the track to start playing.
Résultat void

PlaylistAdd() public méthode

Add a file to a playlist.
public PlaylistAdd ( string name, string file ) : void
name string The name of the playlist.
file string The path and name of the file to add.
Résultat void

PlaylistClear() public méthode

Clears all tracks from a playlist.
public PlaylistClear ( string name ) : void
name string The name of the playlist to clear.
Résultat void

PlaylistDelete() public méthode

Delete a file from a playlist.
public PlaylistDelete ( string name, int id ) : void
name string The name of the playlist
id int The id of the track to delete.
Résultat void

PlaylistFind() public méthode

Returns the meta data for all tracks in the current playlist whos attribute equals the given value.
public PlaylistFind ( ScopeSpecifier scopeSpecifier, string token ) : List
scopeSpecifier ScopeSpecifier The attribute to search for the given value.
token string The value to search for in the given attribute.
Résultat List

PlaylistId() public méthode

Returns the meta data of the items in the current playlist.
public PlaylistId ( ) : List
Résultat List

PlaylistId() public méthode

Returns the meta data of a track in the current playlist.
public PlaylistId ( int id ) : MpdFile
id int The id of the track in the playlist.
Résultat MpdFile

PlaylistInfo() public méthode

Returns the meta data of the items in the current playlist.
public PlaylistInfo ( ) : List
Résultat List

PlaylistInfo() public méthode

Returns the meta data of a track in the current playlist.
public PlaylistInfo ( int nr ) : MpdFile
nr int The index of the track in the playlist.
Résultat MpdFile

PlaylistMove() public méthode

Moves a track in a playlist.
public PlaylistMove ( string name, int id, int nr ) : void
name string The name of the playlist.
id int The id of the track to move.
nr int The position to move the track to.
Résultat void

PlaylistSearch() public méthode

Returns the meta data for all tracks in the current playlist whos attribute contains the given value.
public PlaylistSearch ( ScopeSpecifier scopeSpecifier, string token ) : List
scopeSpecifier ScopeSpecifier The attribute to search for the given value.
token string The value to search for in the given attribute.
Résultat List

Plchanges() public méthode

Returns all changed tracks in the playlist since the given version.
public Plchanges ( int version ) : List
version int The version number.
Résultat List

Previous() public méthode

Starts the playback of the previous track in the playlist.
public Previous ( ) : void
Résultat void

Random() public méthode

Sets the MPD to random or sequential playback.
public Random ( bool random ) : void
random bool If the MPD playlist should be played randomly.
Résultat void

ReadChannelsMessages() public méthode

Reads messages for this client.
public ReadChannelsMessages ( ) : List
Résultat List

Rename() public méthode

Renames a playlist.
public Rename ( string oldName, string newName ) : void
oldName string The old name of the playlist.
newName string The new name of the playlist.
Résultat void

Repeat() public méthode

Sets if the MPD should repeat the playlist.
public Repeat ( bool repeat ) : void
repeat bool If the MPD should repeat the playlist.
Résultat void

Rm() public méthode

Removes the playlist with the given name.
public Rm ( string name ) : void
name string The name of the playlist to remove.
Résultat void

Save() public méthode

Saves the current playlist with the given name.
public Save ( string name ) : void
name string The name to the save the currenty playlist.
Résultat void

Search() public méthode

Returns all files in the database who's attribute matches the given token. Works like the Find command but is case insensitive.
public Search ( ScopeSpecifier scopeSpecifier, string token ) : List
scopeSpecifier ScopeSpecifier Specifies the attribute to search for.
token string The value the files attribute must have to be included in the result.
Résultat List

Seek() public méthode

Starts playback of a given song at the give position.
public Seek ( int nr, int time ) : void
nr int The index of the song in the playlist.
time int The number of seconds to start playback on.
Résultat void

SeekId() public méthode

Starts playback of a given song at the give position.
public SeekId ( int id, int time ) : void
id int The id of the song in the playlist.
time int The number of seconds to start playback on.
Résultat void

SetVol() public méthode

Sets the output volume of the MPD.
public SetVol ( int vol ) : void
vol int The output volume of the MPD between 0 and 100.
Résultat void

Shuffle() public méthode

Shuffles the current playlist.
public Shuffle ( ) : void
Résultat void

Stats() public méthode

Requests the current statistics from the MPD,
public Stats ( ) : MpdStatistics
Résultat MpdStatistics

Status() public méthode

Returns the current status of the MPD.
public Status ( ) : MpdStatus
Résultat MpdStatus

Stop() public méthode

Stops the playback of the MPD.
public Stop ( ) : void
Résultat void

Swap() public méthode

Swaps the to tracks in the current playlist.
public Swap ( int nr1, int nr2 ) : void
nr1 int The index of the first track.
nr2 int The index of the second track.
Résultat void

SwapId() public méthode

Swaps the to tracks in the current playlist.
public SwapId ( int id1, int id2 ) : void
id1 int The id of the first track.
id2 int The id of the second track.
Résultat void

TagTypes() public méthode

Returns the list of tag types the MPD supports.
public TagTypes ( ) : string[]
Résultat string[]

Update() public méthode

Starts an update of the MPD database.
public Update ( ) : int
Résultat int