def download_pic(self): try: video = SqlUtils._select_("SELECT identifier,img_url from video where hash = " + '\''+ self.video_hash+'\'') is_success_download_img = CommonUtils.download_img(video[0][0], video[0][1]) if is_success_download_img: sql = "UPDATE video SET is_download = ? WHERE hash = ?" SqlUtils.update_video(sql, (2, self.video_hash)) # self.statusbar.showMessage("图片下载成功", 5000) print("2222") except Exception as e: print(e)
def _downlowd_img(self): try: video_list = SqlUtils._select_( "SELECT identifier,img_url,hash from video where is_download = 1 and type = 1" ) for video in video_list: if not (os.path.exists('cache/coverimg/' + video[0] + '.jpg')): is_success_download_img = CommonUtils.download_img( video[0], video[1]) if is_success_download_img: sql = "UPDATE video SET is_download = ? WHERE hash = ?" SqlUtils.update_video(sql, (2, video[2])) self.status_text_label.setText(video[0] + " : 图片下载成功") # self.statusbar.showMessage("图片下载成功", 5000) print("2222") sql = "UPDATE video SET is_download = ? WHERE hash = ?" SqlUtils.update_video(sql, (2, video[2])) self.status_text_label.setText("所有图片下载完成") except Exception as e: print("下载异常,请重试: " + str(e)) pass