From bd8ae956d538bbed93598eea0ea317376445af81 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Fri, 7 Mar 2014 14:08:50 +0000 Subject: [PATCH] Add method to return the current volume --- src/libtomahawk-playdarapi/Api_v1_5.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libtomahawk-playdarapi/Api_v1_5.cpp b/src/libtomahawk-playdarapi/Api_v1_5.cpp index f8887cc6f..499133329 100644 --- a/src/libtomahawk-playdarapi/Api_v1_5.cpp +++ b/src/libtomahawk-playdarapi/Api_v1_5.cpp @@ -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." );