(self, name)
接受name信息，由这个引擎进行搜索。
接受name信息，由这个引擎进行搜索。
接受name信息，由这个引擎进行搜索。
def search(self, name):
        """接受name信息，由这个引擎进行搜索。"""
        searchEngineer = self.searchEngineers[name]
        data = yield from aAsync(searchEngineer.search, self.searchArea.text)
        if not data['songCount']:
            songsIds = []
            data['songs'] = []
        else: 
            songsIds = [i['id'] for i in data['songs']]

            if name == '网易云':
                songsDetail = {i:'http' for i in songsIds}
            elif name == '虾米' or name == 'QQ':
                songsDetail = {i['id']:i['mp3Url'] for i in data['songs']}

            # 进行重新编辑方便索引。
            songs = data['songs']
            data['songs'] = [{'name':i['name'], 
            'artists': i['ar'], 
            'picUrl': i['al']['picUrl'],
            'mp3Url': songsDetail[i['id']],
            'duration': i['dt'],
            'music_id':i['id'],
            'lyric': i.get('lyric')} for i in songs]

        songsCount = data['songCount']

        # 总数是0即没有找到。
        if not songsCount:
            songs = []
        else:
            songs = data['songs'] 

        self.setSingsData(songs)
def search ( self , name ) : searchEngineer = self . searchEngineers [ name ] data = yield from aAsync ( searchEngineer . search , self . searchArea . text ) if not data [ 'songCount' ] : songsIds = [ ] data [ 'songs' ] = [ ] else : songsIds = [ i [ 'id' ] for i in data [ 'songs' ] ] if name == '网易云': songsDetail = { i : 'http' for i in songsIds } elif name == '虾米' or  am  ==  QQ : songsDetail = { i [ 'id' ] : i [ 'mp3Url' ] for i in data [ 'songs' ] } # 进行重新编辑方便索引。 songs = data [ 'songs' ] data [ 'songs' ] = [ { 'name' : i [ 'name' ] , 'artists' : i [ 'ar' ] , 'picUrl' : i [ 'al' ] [ 'picUrl' ] , 'mp3Url' : songsDetail [ i [ 'id' ] ] , 'duration' : i [ 'dt' ] , 'music_id' : i [ 'id' ] , 'lyric' : i . get ( 'lyric' ) } for i in songs ] songsCount = data [ 'songCount' ] # 总数是0即没有找到。 if not songsCount : songs = [ ] else : songs = data [ 'songs' ] self . setSingsData ( songs )