Bug 138836

Summary: the media script lacks support for Audacious
Product: [Applications] konversation Reporter: Stephan Sokolow <kde_bugzilla_2>
Component: generalAssignee: Konversation Developers <konversation-devel>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: 1.0.1   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Patch to add Audacious to the media script

Description Stephan Sokolow 2006-12-15 06:25:53 UTC
Version:           1.0.1 (using KDE 3.5.5, Gentoo)
Compiler:          Target: i686-pc-linux-gnu
OS:                Linux (i686) release 2.6.17-gentoo-r4-20060825

The media script supports XMMS yet it doesn't support it's de facto successor, Audacious. 

I've attached a patch against the version from Konversation 1.0.1 which adds support via audtool.
Comment 1 Stephan Sokolow 2006-12-15 06:26:30 UTC
Created attachment 18937 [details]
Patch to add Audacious to the media script
Comment 2 Peter Simonsson 2006-12-23 00:47:26 UTC
Thanks for the patch, commited to rev 615866, will be in 1.1.
Comment 3 Peter Simonsson 2010-07-01 16:20:11 UTC
commit 84ea76455b9ee77d54e7a604bdba99594803d9e0
Author: Peter Simonsson <peter.simonsson@gmail.com>
Date:   Fri Dec 22 23:46:15 2006 +0000

    add support for audacious to media, patch Stephan Sokolow
    
    FEATURE: 138836
    
    svn path=/trunk/extragear/network/konversation/; revision=615866

diff --git a/scripts/media b/scripts/media
index f7daf70..ff7c271 100755
--- a/scripts/media
+++ b/scripts/media
@@ -44,7 +44,7 @@ formatVariables={'audio': 'is listening to', 'video': 'is watching'}
 ## If you add a new player, you must add it here or it won't get checked when in audio-only or video-only modes.
 playerRankings= {
     'video' :['kaffeine','kmplayer', 'noatun', 'kdetv'],
-    'audio' :['amarok', 'juk', 'noatun', 'kscd', 'kaffeine', 'kmplayer', 'xmms', 'yammi']
+    'audio' :['amarok', 'juk', 'noatun', 'kscd', 'kaffeine', 'kmplayer', 'Audacious', 'xmms', 'yammi']
 }
 
 ## Title, album and artist fields to be quoted depending on contents
@@ -273,6 +273,20 @@ try:
 except ImportError:
     XmmsPlayer=Player
 
+class AudaciousPlayer(Player):
+    def __init__(self, display_name):
+        Player.__init__(self, display_name)
+
+    def isRunning(self):
+        self.running = not os.system('audtool current-song')
+	return self.running
+
+    def getData(self):
+        if self.isRunning() and not os.system('audtool playback-playing'):
+            # get the title of the currently playing track
+            return (self.reEncodeString(os.popen('audtool current-song').read().strip()),'','')
+
+
 def playing(playerList, mode=None):
     for i in playerList:
         s=i.get(mode)
@@ -334,7 +348,7 @@ DCOPPlayer("Kaffeine","kaffeine","KaffeineIface title","KaffeineIface artist","K
 KMPLayer("KMPlayer","kmplayer","kmplayer-mainwindow#1 caption",playerType="video audio"),
 DCOPPlayer("KsCD","kscd","CDPlayer currentTrackTitle","CDPlayer currentArtist","CDPlayer currentAlbum"),
 DCOPPlayer("kdetv","kdetv","KdetvIface channelName",playerType='video'),
-XmmsPlayer('XMMS'),
+AudaciousPlayer('Audacious'), XmmsPlayer('XMMS'),
 DCOPPlayer("Yammi","yammi","YammiPlayer songTitle","YammiPlayer songArtist","YammiPlayer songAlbum")
 ]