Bug 120362 - /media not showing artist or album info for Kaffeine
Summary: /media not showing artist or album info for Kaffeine
Status: RESOLVED FIXED
Alias: None
Product: konversation
Classification: Applications
Component: general (show other bugs)
Version: 0.18
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konversation Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-18 04:49 UTC by Chris
Modified: 2006-01-19 04:41 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris 2006-01-18 04:49:27 UTC
Version:           0.18 (using KDE KDE 3.5.0)
Installed from:    Gentoo Packages
Compiler:          Gcc 3.4.4 
OS:                Linux

The /media command only shows the current song title if it's being played from Kaffeine, despite the ability to grab the album and artist name through dcop. I made a small patch against the media script in 0.18 (I don't know much of anything about perl, but this works so..).

--- old_media	2006-01-17 19:33:38.000000000 -0800
+++ media	2006-01-17 19:33:11.000000000 -0800
@@ -59,7 +59,7 @@
     }
     else
     {
-	return "/me is playing $title";
+	return "/me is playing \x{266B} $title \x{266B}";
     }
 }
 
@@ -115,20 +115,25 @@
 
 if($kaffeine)
 {
-    my $string=`dcop kaffeine KaffeineIface title`;
-    chomp $string;
-    
-    if($string)
+    my $title=`dcop kaffeine KaffeineIface title`;
+    my $artist=`dcop kaffeine KaffeineIface artist`;
+    my $album=`dcop kaffeine KaffeineIface album`;
+
+    chomp $title;
+    chomp $artist;
+    chomp $album;
+
+    if($title)
     {
-	utf8::decode($string);
-	exec 'dcop', $port, 'Konversation', 'say', $server, $target, "/me is playing \x{266B} $string \x{266B} \[Kaffeine\]";
+        my $string = pretty_print($title,$artist,$album)." [Kaffeine]";
+        exec 'dcop', $port, 'Konversation', 'say', $server, $target, $string;
     }
     else
     {
-	if($error)
-	{
-	    $error=join(',',$error,"Kaffeine");
-	}
+        if($error)
+        {
+            $error=join(',',$error,"Kaffeine");
+        }
         else
         {
             $error="Kaffeine";
Comment 1 Eike Hein 2006-01-18 05:29:46 UTC
We've got a new version written in Python in the repository. Since it's easy to swap out, I'd ask you to test it: http://websvn.kde.org/*checkout*/trunk/extragear/network/konversation/scripts/media?rev=497755

... and tell us if the problem still persists.
Comment 2 Chris 2006-01-18 06:07:58 UTC
It does still have the problem. This should fix it (not knowing much of anything about Python either, but it works for me):

--- old_media	2006-01-17 20:56:53.000000000 -0800
+++ media	2006-01-17 20:59:51.000000000 -0800
@@ -80,10 +80,12 @@
 
     kaffeine = check_running('kaffeine')
     if kaffeine:
-        string = os.popen('dcop '+kaffeine+' KaffeineIface title').readline().rstrip('\n')
+        title = os.popen('dcop '+kaffeine+' KaffeineIface title').readline().rstrip('\n')
+        artist = os.popen('dcop '+kaffeine+' KaffeineIface artist').readline().rstrip('\n')
+        album = os.popen('dcop '+kaffeine+' KaffeineIface album').readline().rstrip('\n')
 
-        if string:
-            string=pretty_print(string)+' [Kaffeine]'
+        if title:
+            string=pretty_print(title,artist,album)+' [Kaffeine]'
             Popen(['dcop', port, 'Konversation', 'say', server, target, string]).communicate()
             sys.exit(0)
         else:
Comment 3 Eike Hein 2006-01-19 04:41:07 UTC
SVN commit 499936 by hein:

Improved Kaffeine support in the media script. Patch by Chris. Thanks!
BUG:120362


 M  +1 -0      ChangeLog  
 M  +7 -5      scripts/media  


--- trunk/extragear/network/konversation/ChangeLog #499935:499936
@@ -70,6 +70,7 @@
 - Status bar now showing context-relevant information (link URLs, menu item descriptions)
 - Changed hard-coded channel join taskbar notification into a configurable notification event
 - Yammi media player is now supported by media script
+- Improved Kaffeine support in the media script
 - QUIT events for users are now shown in any queries you have open with them
 - Fixed nickname context menu actions not working in queries
 - Redesigned tab notifications allowing for colored LEDs or text labels, the color being configurable per event class
--- trunk/extragear/network/konversation/scripts/media #499935:499936
@@ -79,11 +79,13 @@
                 bad_apps = ['JuK']
 
     kaffeine = check_running('kaffeine')
-    if kaffeine:
-        string = os.popen('dcop '+kaffeine+' KaffeineIface title').readline().rstrip('\n')
-
-        if string:
-            string=pretty_print(string)+' [Kaffeine]'
+    if kaffeine:        
+        title = os.popen('dcop '+kaffeine+' KaffeineIface title').readline().rstrip('\n')
+        artist = os.popen('dcop '+kaffeine+' KaffeineIface artist').readline().rstrip('\n')
+        album = os.popen('dcop '+kaffeine+' KaffeineIface album').readline().rstrip('\n') 
+       
+        if title:
+            string=pretty_print(title,artist,album)+' [Kaffeine]' 
             Popen(['dcop', port, 'Konversation', 'say', server, target, string]).communicate()
             sys.exit(0)
         else: