~ubuntu-branches/ubuntu/karmic/emesene/karmic

« back to all changes in this revision

Viewing changes to plugins_base/CurrentSong.py

  • Committer: Bazaar Package Importer
  • Author(s): Laurent Bigonville
  • Date: 2009-08-24 10:58:29 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090824105829-rlawufckorou1exz
Tags: 1.5-1ubuntu1
* Merge from debian unstable, remaining changes (LP: #417371):
  - Add check_notifications.patch to check if the current notification
    system supports actions
  - Drop python-dcop suggests, not in the archive anymore
* Drop debian/patches/currentSong_plugin_support_amarok2.patch:
  merged upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
import Plugin
26
26
import currentSong
27
27
 
28
 
from emesenecommon import PATH
 
28
import paths
29
29
 
30
30
AMAZON_KEY = '12DR2PGAQT303YTEWP02'
31
31
SEARCH_URL = 'http://webservices.amazon.com/onca/xml?' + \
33
33
    '&Operation=ItemSearch&SearchIndex=Music&Artist=%s&' + \
34
34
    'ResponseGroup=Images&Keywords=%s'
35
35
 
36
 
COVERART_PATH = PATH.HOME_DIR + PATH.DIR_SEP + '.covers' + PATH.DIR_SEP 
 
36
COVERART_PATH = os.path.join(paths.HOME_DIR, '.covers', '')
37
37
 
38
38
class MainClass( Plugin.Plugin ):
39
39
    '''Main plugin class'''
 
40
    description = _( 'Show a personal message with the current song' \
 
41
    ' played in multiple players.' )
 
42
    authors = { 'Mariano Guerra' : 'luismarianoguerra gmail com' }
 
43
    website = 'http://emesene.org'
 
44
    displayName = _( 'CurrentSong' )
 
45
    name = 'CurrentSong'
40
46
    
41
47
    def __init__( self, controller, msn ):
42
48
        '''Constructor'''
90
96
        
91
97
        self.timeout = gobject.timeout_add(self.period, self.action)
92
98
        self.Slash.register('currentsong', self.currentSongHandler, \
93
 
            'currentsong command')
 
99
            _('currentsong command'))
94
100
        self.Slash.register('np', self.nowplaying, \
95
 
            'Send what you are listening to')
 
101
            _('Send what you are listening to'))
96
102
        
97
103
        self.controller.mainWindow.userPanel.mediaButton.show()
98
104
 
119
125
        name = None
120
126
        param = None
121
127
        
122
 
        try:    
 
128
        try:
123
129
            cmd = slashAction.getParams().split(" ", 1)
124
130
            name = cmd[0]
125
131
            param = cmd[1]
137
143
    
138
144
    def nowplaying(self, slashAction):
139
145
        if self.player.cmd_Show(True)[0] == False:
140
 
            slashAction.outputText('Not playing')
 
146
            slashAction.outputText(_('Not playing'))
141
147
        else:
142
 
            slashAction.outputText('now playing: '+ \
 
148
            slashAction.outputText(_('now playing: ')+ \
143
149
                self.player.cmd_Show(True)[1], True)
144
150
 
145
151
    def stop( self ):    
187
193
            # dx note: wtf?
188
194
 
189
195
            if force or check: 
 
196
                self.player.setStyle(self.config.getPluginValue( self.name, 'style', \
 
197
                '%title - %artist (%album)' ))
190
198
                currentsong = self.player.getCurrentSong()\
191
199
                    .decode("utf-8", "replace").encode("utf-8")
192
200
                sdict = self.player.getSongDict()
425
433
        if hasattr(self.player, 'status'):
426
434
            status = self.player.status
427
435
        else:
428
 
            status = 'unknown'
 
436
            status = _('unknown')
429
437
 
430
438
        if self.statusLabel:
431
439
            self.statusLabel.set_markup(_('Status:') + ' <b>%s</b>' % status)
448
456
        crtkey = gtk.CellRendererText()
449
457
        crtvalue = gtk.CellRendererText()
450
458
 
451
 
        col1 = gtk.TreeViewColumn(_("Type"), crtkey, text=0)
452
 
        col2 = gtk.TreeViewColumn(_("Value"), crtvalue, text=1)
 
459
        col1 = gtk.TreeViewColumn(_('Type'), crtkey, text=0)
 
460
        col2 = gtk.TreeViewColumn(_('Value'), crtvalue, text=1)
453
461
        tree.append_column(col1)
454
462
        tree.append_column(col2)
455
463
        for item in log: