~ubuntu-branches/ubuntu/oneiric/emesene/oneiric-proposed

« back to all changes in this revision

Viewing changes to plugins_base/currentSong/Exaile.py

  • Committer: Bazaar Package Importer
  • Author(s): Devid Antonio Filoni
  • Date: 2010-04-14 01:33:51 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20100414013351-r2icbt5gs4ai71j8
Tags: 1.6.1-0ubuntu1
* New upstream release (LP: #562646).
* Fix missing-debian-source-format lintian warning.
* Refresh 20_dont_build_own_libmimic.patch patch.
* Bump Standards-Version to 3.8.4.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    def setInterface( self ):
35
35
        proxy_obj = self.bus.get_object( IFACE_NAME, IFACE_PATH )
36
36
        self.iface = self.module.Interface( proxy_obj, IFACE_NAME )
37
 
        
38
 
    def getCoverPath( self ):
39
 
        if self.iface:
40
 
            return ""
41
 
        else:
42
 
            return None
43
 
     
44
 
    def setCurrentSongData( self ):
45
 
        if self.iface and self.isNameActive(IFACE_NAME):
46
 
            self.artist = self.iface.GetTrackAttr('artist')
47
 
            self.title = self.iface.GetTrackAttr('title')
48
 
            self.album = self.iface.GetTrackAttr('album')
49
 
            if self.artist == None:
50
 
                self.artist = ""
51
 
            if self.title == None:
52
 
                self.title = ""
53
 
            if self.album == None:
54
 
                self.album = ""
55
 
        if not self.isPlaying():
56
 
                self.artist = ""
57
 
                self.title = ""
58
 
                self.album = ""
59
 
        
60
 
 
61
 
    def getVersion( self ):
62
 
        try:
63
 
            self.iface.GetVersion()
64
 
        except:
65
 
            return False
66
 
        
67
 
        return True
68
 
    
69
 
    def isPlaying( self ):
70
 
        trackInfo = str(self.iface.Query())
71
 
        if string.split(trackInfo, ", ")[0] == "status: playing":
72
 
            self.playing = True
73
 
            return True
74
 
        else:
75
 
            self.playing = False
76
 
            return False
 
37
                        
 
38
    def isPlaying(self):
 
39
        if self.isRunning():
 
40
            trackInfo = str(self.iface.Query())
 
41
            if string.split(trackInfo, ", ")[0] == "status: playing":
 
42
                return True
 
43
        return False
77
44
        
78
45
    def check( self ):
79
 
        if not self.iface or not self.isNameActive(IFACE_NAME):
80
 
            return
81
 
        
82
 
        if self.artist != self.iface.GetTrackAttr('artist') or \
83
 
           self.title != self.iface.GetTrackAttr('title') or \
84
 
           self.album != self.iface.GetTrackAttr('album') or \
85
 
           self.playing != self.isPlaying():
86
 
            self.setCurrentSongData()
 
46
        if not self.isRunning():
 
47
            return False
 
48
        
 
49
        artist = ""
 
50
        title = ""
 
51
        album = ""
 
52
        
 
53
        if self.isPlaying():
 
54
            artist = self.iface.GetTrackAttr('artist')
 
55
            if artist == None:
 
56
                artist = ""
 
57
            
 
58
            title = self.iface.GetTrackAttr('title')
 
59
            if title == None:
 
60
                title = ""
 
61
            
 
62
            album = self.iface.GetTrackAttr('album')
 
63
            if album == None:
 
64
                album = ""
 
65
            
 
66
        if self.artist != artist or self.title != title or self.album != album:
 
67
            self.artist = artist
 
68
            self.title = title            
 
69
            self.album = album
87
70
            return True
88
 
            
 
71
 
89
72
        return False
90
73