49
49
return self.iface.Status() == "playing" #Note: self.iface.Playing() returns True even if it's paused
51
return commands.getoutput("audtool playback-status") == "playing"
51
return commands.getoutput("audtool2 playback-status") == "playing"
53
# In this plugin we have to override isRunning and getStatus.
54
# Audacious in old versions didn't use D-Bus and used an external
55
# program called audtool2 to comunicate. Now newer versions can use D-Bus.
58
def isRunning( self ):
61
if len(commands.getoutput("audtool2 version")) > 0:
53
65
def getStatus( self ):
54
66
'''check if everything is OK to start the plugin
55
67
return a tuple whith a boolean and a message
56
68
if OK -> ( True , 'some message' )
57
69
else -> ( False , 'error message' )'''
59
71
if os.name != 'posix':
60
return ( False, _( 'This plugin only works in posix systems' ) ) #no posix here
62
if not self.is_on_path( 'audtool' ) and not self.iface:
63
return ( False, _( 'audtool is not on the path and you don\'t have dbus enabled.' ) ) #no audtool here
72
return ( False, _( 'This plugin only works in posix systems' ) )
74
# We can't work if we don't have D-Bus and there is no audtool2
75
if self.bus == None and not self.is_on_path( 'audtool2' ):
76
return ( False, _( 'audtool2 is not on the path and you don\'t have dbus enabled.' ) )
65
return ( True, 'Ok' ) #ok, run baby!
67
80
def getCurrentSong( self ):
69
82
if self.isPlaying():
70
song = commands.getoutput( "audtool current-song" )
83
song = commands.getoutput( "audtool2 current-song" )
71
84
fsong = '\\0Music\\01\\0' + song + '\\0\\0'
80
93
if self.isPlaying():
81
94
songPosition = self.iface.Position()
82
95
artist = self.iface.SongTuple(songPosition, "artist")
83
title = self.iface.SongTuple(songPosition, "title")
84
album = self.iface.SongTuple(songPosition, "album")
85
if self.artist != artist or self.title != title or self.album != album:
89
self.filename = self.iface.SongTitle(songPosition)
91
else: # Just stopped, paused, ... set the data as empty strings
92
if self.artist != "" or self.title != "" or self.album != "":
96
title = self.iface.SongTuple(songPosition, "title")
97
album = self.iface.SongTuple(songPosition, "album")
98
if self.artist != artist or self.title != title or self.album != album:
102
self.filename = self.iface.SongTitle(songPosition)
104
else: # Just stopped, paused, ... set the data as empty strings
105
if self.artist != "" or self.title != "" or self.album != "":
100
111
elif self.isPlaying():
101
112
currentSong = self.getCurrentSong()
102
113
if self.playingNow != currentSong: