implement argv handler and basic mpc commands
This commit is contained in:
@@ -119,15 +119,20 @@ void MPDConnection::SetErrorHandler(ErrorHandler handler, void *data)
|
||||
itsErrorHandlerUserdata = data;
|
||||
}
|
||||
|
||||
void MPDConnection::UpdateStatus()
|
||||
void MPDConnection::GetStatus()
|
||||
{
|
||||
CheckForErrors();
|
||||
|
||||
if (itsOldStatus)
|
||||
mpd_freeStatus(itsOldStatus);
|
||||
itsOldStatus = itsCurrentStatus;
|
||||
mpd_sendStatusCommand(itsConnection);
|
||||
itsCurrentStatus = mpd_getStatus(itsConnection);
|
||||
}
|
||||
|
||||
void MPDConnection::UpdateStatus()
|
||||
{
|
||||
CheckForErrors();
|
||||
|
||||
GetStatus();
|
||||
|
||||
if (!itsMaxPlaylistLength)
|
||||
itsMaxPlaylistLength = GetPlaylistLength();
|
||||
@@ -182,6 +187,15 @@ void MPDConnection::UpdateDirectory(const string &path) const
|
||||
}
|
||||
}
|
||||
|
||||
void MPDConnection::Execute(const string &command) const
|
||||
{
|
||||
if (isConnected)
|
||||
{
|
||||
mpd_executeCommand(itsConnection, command.c_str());
|
||||
mpd_finishCommand(itsConnection);
|
||||
}
|
||||
}
|
||||
|
||||
void MPDConnection::Play() const
|
||||
{
|
||||
if (isConnected)
|
||||
@@ -842,7 +856,7 @@ int MPDConnection::CheckForErrors()
|
||||
itsErrorHandler(this, itsConnection->error, itsConnection->errorStr, itsErrorHandlerUserdata);
|
||||
itsErrorCode = itsConnection->error;
|
||||
}
|
||||
itsLastErrorMessage = itsConnection->errorStr;
|
||||
itsErrorMessage = itsConnection->errorStr;
|
||||
mpd_clearError(itsConnection);
|
||||
}
|
||||
return itsErrorCode;
|
||||
|
||||
Reference in New Issue
Block a user