Michael Larouche escreveu:
Le décembre 3, 2008 10:53:17 AM Tiago Salem Herrmann, vous avez écrit :
Ah, ok.. the only problem is that if we do not set nowlistening to
append or to replace the status message with the current song, the
protocol will never receive a notification, and then we cant handle
metadata, and if we set to append or replace we do receive metadata but
the personal status message is replaced as well.
Is there a solution for that?
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel
the NowListening plugin should be modified to not include metadata when it is
in "append to status message" mode.
Then in your protocol, test if the metadata are present.
Hi,
I've made some patches to fix this bug, to fix a dbus call to amarok in
nowlistening and to add nowlistening support to wlm.
Is it ok to commit them?
thanks.
Index: kopete/plugins/nowlistening/nlamarok.cpp
===================================================================
--- kopete/plugins/nowlistening/nlamarok.cpp (revision 892150)
+++ kopete/plugins/nowlistening/nlamarok.cpp (working copy)
@@ -57,10 +57,11 @@
return;
// See if amarok is currently playing.
- QDBusReply<int> statusReply = m_client->call("PositionGet");
- if( statusReply.isValid() )
+ QDBusMessage statusReply = m_client->call("GetStatus");
+ if( statusReply.type() == QDBusMessage::ReplyMessage )
{
- if( statusReply.value() )
+ // 2 means that amarok is stopped
+ if(statusReply.arguments().at(0).toInt() != 2)
{
m_playing = true;
}
Index: kopete/plugins/nowlistening/nowlisteningplugin.cpp
===================================================================
--- kopete/plugins/nowlistening/nowlisteningplugin.cpp (revision 892150)
+++ kopete/plugins/nowlistening/nowlisteningplugin.cpp (working copy)
@@ -245,10 +245,6 @@
void NowListeningPlugin::slotAdvertCurrentMusic()
{
- // Do anything when statusAdvertising is off.
- if( !NowListeningConfig::self()->statusAdvertising() &&
!NowListeningConfig::self()->appendStatusAdvertising() )
- return;
-
// This slot is called every 5 seconds, so we check if we have a new
track playing.
if( newTrackPlaying() )
{
@@ -286,11 +282,23 @@
{
Kopete::StatusMessage currentStatusMessage =
a->myself()->statusMessage();
- if(isPlaying)
+ // do not add metadata when replace/append to status is
set
+ if( !NowListeningConfig::self()->statusAdvertising() &&
+
!NowListeningConfig::self()->appendStatusAdvertising() )
{
- currentStatusMessage.addMetaData("title",
track);
- currentStatusMessage.addMetaData("artist",
artist);
- currentStatusMessage.addMetaData("album",
album);
+ // we dont have removeMetaData(), so we create
a new status
+ Kopete::StatusMessage tmpStatusMessage;
+
tmpStatusMessage.setMessage(a->myself()->statusMessage().message());
+
tmpStatusMessage.setTitle(a->myself()->statusMessage().title());
+
+ if(isPlaying)
+ {
+ tmpStatusMessage.addMetaData("title",
track);
+ tmpStatusMessage.addMetaData("artist",
artist);
+ tmpStatusMessage.addMetaData("album",
album);
+ }
+ a->setStatusMessage(tmpStatusMessage);
+ continue;
}
if(
NowListeningConfig::self()->appendStatusAdvertising() )
Index: kopete/protocols/wlm/wlmaccount.cpp
===================================================================
--- kopete/protocols/wlm/wlmaccount.cpp (revision 892150)
+++ kopete/protocols/wlm/wlmaccount.cpp (working copy)
@@ -137,16 +137,35 @@
if (isConnected ())
{
MSN::personalInfo pInfo;
+ pInfo.mediaIsEnabled = 0;
QTextCodec::setCodecForCStrings (QTextCodec::codecForName ("utf8"));
if (reason.message().isEmpty ())
pInfo.PSM = "";
else
pInfo.PSM = reason.message().toAscii ().data ();
-// pInfo.mediaType="Music";
- pInfo.mediaIsEnabled = 0;
-// pInfo.mediaFormat="{0} - {1}";
-// pInfo.mediaLines.push_back("Artist");
-// pInfo.mediaLines.push_back("Song");
+
+ // we have both artist and title
+ if( reason.hasMetaData("artist") && reason.hasMetaData("title") )
+ {
+ pInfo.mediaIsEnabled = 1;
+ pInfo.mediaType="Music";
+ pInfo.mediaLines.push_back(
reason.metaData("artist").toString().toAscii().data() );
+ pInfo.mediaLines.push_back(
reason.metaData("title").toString().toAscii().data() );
+ pInfo.mediaFormat="{0} - {1}";
+ m_server->cb.mainConnection->setPersonalStatus (pInfo);
+ return;
+ }
+
+ // we have only the title
+ if( reason.hasMetaData("title") )
+ {
+ pInfo.mediaIsEnabled = 1;
+ pInfo.mediaType="Music";
+ pInfo.mediaFormat="{0}";
+ pInfo.mediaLines.push_back(
reason.metaData("title").toString().toAscii().data() );
+ m_server->cb.mainConnection->setPersonalStatus (pInfo);
+ return;
+ }
m_server->cb.mainConnection->setPersonalStatus (pInfo);
}
}
_______________________________________________
kopete-devel mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kopete-devel