1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-19 20:34:22 +02:00

Add method to return the current volume

This commit is contained in:
Uwe L. Korn
2014-03-07 14:08:50 +00:00
parent 6579007791
commit bd8ae956d5

View File

@@ -115,6 +115,14 @@ Api_v1_5::playback( QxtWebRequestEvent* event, const QString& command )
e->contentType = "application/json";
m_service->postEvent( e );
}
else if ( command == "volume" )
{
QByteArray json = QString( "{ \"result\": \"ok\", \"volume\": %1}" ).arg( AudioEngine::instance()->volume() ).toUtf8();
QxtWebPageEvent * e = new QxtWebPageEvent( event->sessionID, event->requestID, json );
e->headers.insert( "Access-Control-Allow-Origin", "*" );
e->contentType = "application/json";
m_service->postEvent( e );
}
else
{
m_service->sendJsonError( event, "No such playback command." );