diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2012-06-10 04:06:46 +0200 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2012-06-10 04:06:46 +0200 |
commit | f670853164f8a23f3656fa9de72b12b962b9bcaa (patch) | |
tree | 8f136364b01798d490d93a232766c84b22ad0c40 /kopete/plugins | |
parent | e03e17387883311c44e4d572c53dc19a9abd21e9 (diff) | |
download | tdenetwork-f670853164f8a23f3656fa9de72b12b962b9bcaa.tar.gz tdenetwork-f670853164f8a23f3656fa9de72b12b962b9bcaa.zip |
Improve Kaffeine support in Kopete now listening plugin
Diffstat (limited to 'kopete/plugins')
-rw-r--r-- | kopete/plugins/nowlistening/nlkaffeine.cpp | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/kopete/plugins/nowlistening/nlkaffeine.cpp b/kopete/plugins/nowlistening/nlkaffeine.cpp index c2b70ba3..77dd84cb 100644 --- a/kopete/plugins/nowlistening/nlkaffeine.cpp +++ b/kopete/plugins/nowlistening/nlkaffeine.cpp @@ -40,7 +40,7 @@ void NLKaffeine::update() m_newTrack = false; TQString newTrack; bool error = true; // Asume we have a error first. - TQCString kaffeineIface("Kaffeine"), kaffeineGetTrack("getTitle()"); + TQCString kaffeineIface("KaffeineIface"), kaffeineGetTrack("title()"); // see if kaffeine is registered with DCOP if ( m_client->isApplicationRegistered( "kaffeine" ) ) @@ -52,10 +52,10 @@ void NLKaffeine::update() if ( !m_client->call( "kaffeine", kaffeineIface, "isPlaying()", data, replyType, replyData ) ) { - kdDebug ( 14307 ) << k_funcinfo << " Trying DCOP interface of Kaffeine >= 0.5" << endl; - // Trying with the new Kaffeine DCOP interface (>=0.5) - kaffeineIface = "KaffeineIface"; - kaffeineGetTrack = "title()"; + kdDebug ( 14307 ) << k_funcinfo << " Trying DCOP interface of Kaffeine < 0.5" << endl; + // Trying with the old Kaffeine DCOP interface (<0.5) + kaffeineIface = "Kaffeine"; + kaffeineGetTrack = "getTitle()"; if( !m_client->call( "kaffeine", kaffeineIface, "isPlaying()", data, replyType, replyData ) ) { kdDebug( 14307 ) << k_funcinfo << " DCOP error on Kaffeine." << endl; @@ -94,6 +94,31 @@ void NLKaffeine::update() m_newTrack = true; m_track = newTrack; } + if ( kaffeineIface == "Kaffeine" ) + { + // old Kaffeine DCOP interface (<0.5) + return; + } + + if ( m_client->call( "kaffeine", kaffeineIface, "album()", data, + replyType, replyData ) ) + { + TQDataStream reply( replyData, IO_ReadOnly ); + + if ( replyType == TQSTRING_OBJECT_NAME_STRING ) { + reply >> m_album; + } + } + + if ( m_client->call( "kaffeine", kaffeineIface, "artist()", data, + replyType, replyData ) ) + { + TQDataStream reply( replyData, IO_ReadOnly ); + + if ( replyType == TQSTRING_OBJECT_NAME_STRING ) { + reply >> m_artist; + } + } } else kdDebug ( 14307 ) << "Kaffeine is not running!\n" << endl; |