C# Класс Libmpc.Mpc

The Mpc class implements all commands for the MPD. It takes care of command building and parsing the response into .net objects.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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

Описание методов

Add() публичный Метод

Adds a file to the playlist.
public Add ( string filename ) : void
filename string The name and path of the file to add.
Результат void

AddId() публичный Метод

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.
Результат int

ChannelSendMessage() публичный Метод

Send a message to the specified channel.
public ChannelSendMessage ( string channel, string message ) : bool
channel string
message string
Результат bool

ChannelSubscribe() публичный Метод

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
Результат bool

ChannelUnsubscribe() публичный Метод

Unsubscribe from a channel.
public ChannelUnsubscribe ( string channel ) : bool
channel string
Результат bool

Channels() публичный Метод

Returns a list of all channels
public Channels ( ) : List
Результат List

Clear() публичный Метод

Clears the playlist.
public Clear ( ) : void
Результат void

ClearError() публичный Метод

Clears the error message set in the MPD.
public ClearError ( ) : void
Результат void

Commands() публичный Метод

Returns which commands the current user has access to.
public Commands ( ) : List
Результат List

Crossfade() публичный Метод

Sets the seconds to crossfade between songs.
public Crossfade ( int seconds ) : void
seconds int The seconds to crossfade between songs.
Результат void

CurrentSong() публичный Метод

Returns the information of the current song.
public CurrentSong ( ) : MpdFile
Результат MpdFile

Delete() публичный Метод

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.
Результат void

DeleteId() публичный Метод

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.
Результат void

DisableOutput() публичный Метод

Disables an MPD output.
public DisableOutput ( int id ) : bool
id int The id of the output.
Результат bool

EnableOutput() публичный Метод

Enables an MPD output.
public EnableOutput ( int id ) : bool
id int The id of the output.
Результат bool

Find() публичный Метод

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.
Результат List

Find() публичный Метод

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.
Результат List

Idle() публичный Метод

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.
Результат void

List() публичный Метод

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.
Результат List

List() публичный Метод

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.
Результат List

ListAll() публичный Метод

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.
Результат List

ListAllInfo() публичный Метод

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.
Результат List

ListPlaylist() публичный Метод

Returns the filenames of the tracks in the given playlist.
public ListPlaylist ( string name ) : List
name string The playlist whos filename are requested.
Результат List

ListPlaylistInfo() публичный Метод

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.
Результат List

ListPlaylists() публичный Метод

Returns a list of the playlist directory.
public ListPlaylists ( ) : List
Результат List

Load() публичный Метод

Loads the playlist with the given name.
public Load ( string name ) : void
name string The name of the playlist to load.
Результат void

LsInfo() публичный Метод

Returns the directory listing of the root directory.
public LsInfo ( ) : MpdDirectoryListing
Результат MpdDirectoryListing

LsInfo() публичный Метод

Returns the directory listing of the given path.
public LsInfo ( string path ) : MpdDirectoryListing
path string The path whos listing is requested.
Результат MpdDirectoryListing

Move() публичный Метод

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.
Результат void

MoveId() публичный Метод

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.
Результат void

Mpc() публичный Метод

Creates a new Mpc.
public Mpc ( ) : System
Результат System

Next() публичный Метод

Starts the playback of the next song in the playlist-
public Next ( ) : void
Результат void

NotCommands() публичный Метод

Returns which commands the current user does has access to.
public NotCommands ( ) : List
Результат List

Outputs() публичный Метод

Lists all outputs of the MPD.
public Outputs ( ) : MpdOutput[]
Результат MpdOutput[]

Password() публичный Метод

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.
Результат bool

Pause() публичный Метод

Sets the MPD to pause or resume the playback.
public Pause ( bool pause ) : void
pause bool If the playback should be paused or resumed.
Результат void

Ping() публичный Метод

Sends a ping command to the server and waits for the response.
public Ping ( ) : void
Результат void

PlChangesPosId() публичный Метод

Returns the ids and positions of the changed tracks in the playlist since the given version.
public PlChangesPosId ( int version ) : int>>.List
version int
Результат int>>.List

Play() публичный Метод

Starts the playback of the current item in the playlist.
public Play ( ) : void
Результат void

Play() публичный Метод

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.
Результат void

PlayId() публичный Метод

Starts the playback of the track in the playlist with the id 0.
public PlayId ( ) : void
Результат void

PlayId() публичный Метод

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.
Результат void

PlaylistAdd() публичный Метод

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.
Результат void

PlaylistClear() публичный Метод

Clears all tracks from a playlist.
public PlaylistClear ( string name ) : void
name string The name of the playlist to clear.
Результат void

PlaylistDelete() публичный Метод

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.
Результат void

PlaylistFind() публичный Метод

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.
Результат List

PlaylistId() публичный Метод

Returns the meta data of the items in the current playlist.
public PlaylistId ( ) : List
Результат List

PlaylistId() публичный Метод

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.
Результат MpdFile

PlaylistInfo() публичный Метод

Returns the meta data of the items in the current playlist.
public PlaylistInfo ( ) : List
Результат List

PlaylistInfo() публичный Метод

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.
Результат MpdFile

PlaylistMove() публичный Метод

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.
Результат void

PlaylistSearch() публичный Метод

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.
Результат List

Plchanges() публичный Метод

Returns all changed tracks in the playlist since the given version.
public Plchanges ( int version ) : List
version int The version number.
Результат List

Previous() публичный Метод

Starts the playback of the previous track in the playlist.
public Previous ( ) : void
Результат void

Random() публичный Метод

Sets the MPD to random or sequential playback.
public Random ( bool random ) : void
random bool If the MPD playlist should be played randomly.
Результат void

ReadChannelsMessages() публичный Метод

Reads messages for this client.
public ReadChannelsMessages ( ) : List
Результат List

Rename() публичный Метод

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.
Результат void

Repeat() публичный Метод

Sets if the MPD should repeat the playlist.
public Repeat ( bool repeat ) : void
repeat bool If the MPD should repeat the playlist.
Результат void

Rm() публичный Метод

Removes the playlist with the given name.
public Rm ( string name ) : void
name string The name of the playlist to remove.
Результат void

Save() публичный Метод

Saves the current playlist with the given name.
public Save ( string name ) : void
name string The name to the save the currenty playlist.
Результат void

Search() публичный Метод

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.
Результат List

Seek() публичный Метод

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.
Результат void

SeekId() публичный Метод

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.
Результат void

SetVol() публичный Метод

Sets the output volume of the MPD.
public SetVol ( int vol ) : void
vol int The output volume of the MPD between 0 and 100.
Результат void

Shuffle() публичный Метод

Shuffles the current playlist.
public Shuffle ( ) : void
Результат void

Stats() публичный Метод

Requests the current statistics from the MPD,
public Stats ( ) : MpdStatistics
Результат MpdStatistics

Status() публичный Метод

Returns the current status of the MPD.
public Status ( ) : MpdStatus
Результат MpdStatus

Stop() публичный Метод

Stops the playback of the MPD.
public Stop ( ) : void
Результат void

Swap() публичный Метод

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.
Результат void

SwapId() публичный Метод

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.
Результат void

TagTypes() публичный Метод

Returns the list of tag types the MPD supports.
public TagTypes ( ) : string[]
Результат string[]

Update() публичный Метод

Starts an update of the MPD database.
public Update ( ) : int
Результат int