def init_notification(self, playingsong):
        '''第一次桌面通知时加入图片'''

        logger.debug('init_notification')

        old_title = playingsong['title']
        self.cover_file = tempfile.NamedTemporaryFile(
            suffix='.jpg', dir=self._tempdir)
        if not self.get_pic(playingsong, self.cover_file.name):
            return
        title = playingsong['title']
        if old_title != title:
            # 已切换至下一首歌
            return
        self.has_cover = True
        content = playingsong['artist'] + ' - ' + playingsong['albumtitle']
        send_notification(title.decode('utf-8'),
                          content.decode('utf-8'),
                          self.cover_file.name)
def init_notification ( self , playingsong ) : logger . debug ( 'init_notification' ) old_title = playingsong [ 'title' ] self . cover_file = tempfile . NamedTemporaryFile ( suffix = '.jpg' , dir = self . _tempdir ) if not self . get_pic ( playingsong , self . cover_file . name ) : return title = playingsong [ 'title' ] if old_title != title : return self . has_cover = True content = playingsong [ 'artist' ] + ' - ' + playingsong [ 'albumtitle' ] send_notification ( title . decode ( 'utf-8' ) , content . decode ( 'utf-8' ) , self . cover_file . name )
第一次桌面通知时加入图片