From f670853164f8a23f3656fa9de72b12b962b9bcaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sun, 10 Jun 2012 04:06:46 +0200 Subject: Improve Kaffeine support in Kopete now listening plugin --- kopete/plugins/nowlistening/nlkaffeine.cpp | 35 +++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'kopete') 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; -- cgit v1.2.1