[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.1/kdenetwork/kopete/plugins/nowlistening
From:       Dennis Nienhüser <earthwings () gentoo ! org>
Date:       2008-07-14 18:06:34
Message-ID: 1216058794.818624.23807.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 832452 by nienhueser:

Support the new dbus interface of amarok 2.0. Backport of commits 832447 and 832450, \
will be in KDE 4.1.0.


 M  +15 -20    nlamarok.cpp  


--- branches/KDE/4.1/kdenetwork/kopete/plugins/nowlistening/nlamarok.cpp \
#832451:832452 @@ -6,8 +6,8 @@
     Copyright (c) 2002,2003,2004 by Will Stephenson \
<will@stevello.free-online.co.uk>  Kopete
 	Copyright (c) 2002,2003,2004 by the Kopete developers  <kopete-devel@kde.org>
-	
-	Purpose: 
+
+	Purpose:
 	This class abstracts the interface to amaroK by
 	implementing NLMediaPlayer
 
@@ -33,7 +33,7 @@
 {
 	m_type = Audio;
 	m_name = "amaroK";
-	m_client = new QDBusInterface("org.kde.amarok", "/Player");
+	m_client = new QDBusInterface("org.mpris.amarok", "/Player");
 }
 
 NLamaroK::~NLamaroK()
@@ -51,8 +51,8 @@
 	if( !m_client->isValid() )
 		return;
 
-	// See if amaroK is currently playing.
-	QDBusReply<int> statusReply = m_client->call("status");
+	// See if amarok is currently playing.
+	QDBusReply<int> statusReply = m_client->call("PositionGet");
 	if( statusReply.isValid() )
 	{
 		if( statusReply.value() )
@@ -61,13 +61,17 @@
 		}
 	}
 
-	// Fetch title
-	QDBusReply<QString> newTrackReply = m_client->call("title");
-	if( newTrackReply.isValid() )
+	QDBusReply<QVariantMap> metaDataReply = m_client->call("GetMetadata");
+	if (!metaDataReply.isValid())
 	{
-		newTrack = newTrackReply.value();
+		return;
 	}
 
+	const QVariantMap &metaData = metaDataReply.value();
+
+	// Fetch title
+	newTrack = metaData["title"].toString();
+
 	if ( newTrack != m_track )
 	{
 		m_newTrack = true;
@@ -75,17 +79,8 @@
 	}
 
 	// Fetch album
-	QDBusReply<QString> albumReply = m_client->call("album");
-	if( albumReply.isValid() )
-	{
-		m_album = albumReply.value();
-	}
+	m_album = metaData["album"].toString();
 
 	// Fetch artist
-	QDBusReply<QString> artistReply = m_client->call("artist");
-	if( artistReply.isValid() )
-	{
-		m_artist = artistReply.value();
-	}
+	m_artist = metaData["artist"].toString();
 }
-


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic