def downloadLyric(self,keyword): """Download lyric when necessary.""" listUrl = baiduMusic.generateUrl(keyword) if listUrl: try: templst = baiduMusic.generateList(listUrl)[1:4] suffix,title,artist = templst[0][0],templst[1][0],templst[2][0] mp3Url = 'http://music.baidu.com/' + suffix baiduMusic.downloadLrcFile(mp3Url,title,artist,self.lrcLocation) except: pass
def run(self): if len(self.args) == 7: # 添加自己定义的reportHook之后,返回一次信息线程就结束了? time模块问题. self.mp3name,self.mp3status = baiduMusic.downloadMp3File(self.args[0] + '/download',self.args[1],self.args[2],self.args[3],self.args[5],self.args[6]) self.lrcname,self.lrcstatus = baiduMusic.downloadLrcFile(self.args[0],self.args[1],self.args[2],self.args[4],self.args[5],self.args[6]) if not (self.mp3name and self.lrcname): self.wait()