From 3a8eda86e84bfdbe3ac542bf9552b3ddac4962c2 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 13 Mar 2022 19:36:38 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- need/plugins.py | 69 ++++++++++++++++++++++++++++++++++--------------- need/yang.py | 4 +-- need/yang.ui | 6 ++--- pikpakdown.py | 9 ++++--- 4 files changed, 58 insertions(+), 30 deletions(-) diff --git a/need/plugins.py b/need/plugins.py index 3655840..7fb1c30 100644 --- a/need/plugins.py +++ b/need/plugins.py @@ -8,6 +8,7 @@ import pythoncom import re import requests +import os from urllib.parse import urlparse #推送aria2单任务 @@ -77,6 +78,8 @@ def thread_Thunder(file_id): app_config = json.loads(f.read()) f.close() + + if type(file_id)==list: down_name_list=[] down_url_list=[] @@ -163,6 +166,17 @@ def thread_IDM(file_id,IDM): jsonFile.close() app_config = data + if app_config['Download_path'] != "": + the_down_path = f"{app_config['Download_path']}" + + if not os.path.exists(the_down_path): + os.makedirs(the_down_path) + else: + parent_path = os.getcwd() + the_down_path = f"{parent_path}/下载" + + if not os.path.exists(the_down_path): + os.makedirs(the_down_path) Popen([IDM]) @@ -192,7 +206,7 @@ def thread_IDM(file_id,IDM): print(f"INFO ({new_time}):推送IDM:{down_name}") - Popen([IDM, '/d', down_url, "/p", data['Download_path'], '/f', down_name, '/n', '/a']) + Popen([IDM, '/d', down_url, "/p", the_down_path, '/f', down_name, '/n', '/a']) new_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) @@ -212,7 +226,7 @@ def thread_IDM(file_id,IDM): print(f"INFO ({new_time}):推送IDM:识别为文件夹:{down_name},开始获取目录信息") - for name, url, size, path in get_folder_all_file(folder_id=file_id, path=f"{data['Download_path']}/{down_name}/"): + for name, url, size, path in get_folder_all_file(folder_id=file_id, path=f"{the_down_path}/{down_name}/"): down_name = f"{name}" @@ -259,7 +273,7 @@ def thread_IDM(file_id,IDM): down_key = re.findall("(.*?)/download.*", down_url, re.S)[0] down_url = down_url.replace(down_key, str(app_config['download_url_word'])) - Popen([IDM, '/d', down_url,"/p",data['Download_path'], '/f', down_name, '/n', '/s']) + Popen([IDM, '/d', down_url,"/p",the_down_path, '/f', down_name, '/n', '/s']) def thread_pot(file_id,Pot): @@ -362,6 +376,9 @@ def thread_aria2(file_id): # 读取数据并分割。 最后一个为空,所以去除 app_config = json.loads(f.read()) f.close() + + + if type(file_id) == list: for a in file_id: @@ -437,7 +454,17 @@ def thread_Bitcomet(file_id,thread_url): app_config = data + if app_config['Download_path'] != "": + the_down_path = f"{app_config['Download_path']}" + + if not os.path.exists(the_down_path): + os.makedirs(the_down_path) + else: + parent_path = os.getcwd() + the_down_path = f"{parent_path}/下载" + if not os.path.exists(the_down_path): + os.makedirs(the_down_path) if type(file_id) == list: down_name_list = [] @@ -467,9 +494,9 @@ def thread_Bitcomet(file_id,thread_url): down_key = re.findall("(.*?)/download.*", down_url, re.S)[0] domain_key_list = ["https://vod0051-aliyun18-vip-lixian.mypikpak.com", - "https://vod0037-aliyun18-vip-lixian.mypikpak.com", - "https://vod0039-aliyun18-vip-lixian.mypikpak.com", - "https://vod0038-aliyun18-vip-lixian.mypikpak.com", + "https://vod0037-aliyun17-vip-lixian.mypikpak.com", + "https://vod0039-aliyun17-vip-lixian.mypikpak.com", + "https://vod0038-aliyun17-vip-lixian.mypikpak.com", "https://vod0049-aliyun18-vip-lixian.mypikpak.com", "https://vod0050-aliyun18-vip-lixian.mypikpak.com", "https://vod0041-hwyun02-vip-lixian.mypikpak.com", @@ -497,7 +524,7 @@ def thread_Bitcomet(file_id,thread_url): mirror_url = mirror_url + down_url.replace(down_key, a) + "&\n" postdata = { "url": f"{down_url}", - "save_path": data['Download_path'], + "save_path": the_down_path, "connection": "200", "file_name": down_name, "referrer": "", @@ -505,7 +532,7 @@ def thread_Bitcomet(file_id,thread_url): "cookie": "", "mirror_url_list": mirror_url } - html = requests.post(url=f"{thread_url}/panel/task_add_httpftp_result", data=postdata) + html = requests.post(url=f"{thread_url}/panel/task_add_httpftp_result",data=postdata,proxies=None) if html.status_code == 502: print(f"Error ({new_time}):推送Bitcomet失败:url链接不正确") @@ -529,7 +556,7 @@ def thread_Bitcomet(file_id,thread_url): print(f"INFO ({new_time}):推送Bitcomet:识别为文件夹:{down_name},开始获取目录信息") for name, url, size, path in get_folder_all_file(folder_id=file_id, - path=f"{data['Download_path']}/{down_name}/"): + path=f"{the_down_path}/{down_name}/"): down_name = f"{name}" the_filesize = size @@ -586,7 +613,7 @@ def thread_Bitcomet(file_id,thread_url): mirror_url = mirror_url + down_url.replace(down_key, a) + "&\n" postdata = { "url": f"{down_url}", - "save_path": data['Download_path'], + "save_path": down_path, "connection": "200", "file_name": down_name, "referrer": "", @@ -594,7 +621,7 @@ def thread_Bitcomet(file_id,thread_url): "cookie": "", "mirror_url_list": mirror_url } - html = requests.post(url=f"{thread_url}/panel/task_add_httpftp_result", data=postdata) + html = requests.post(url=f"{thread_url}/panel/task_add_httpftp_result",data=postdata,proxies=None) if html.status_code == 502: print(f"Error ({new_time}):推送Bitcomet失败:url链接不正确") @@ -657,7 +684,7 @@ def thread_Bitcomet(file_id,thread_url): mirror_url = mirror_url + down_url.replace(down_key, a) + "&\n" postdata = { "url": f"{down_url}", - "save_path": data['Download_path'], + "save_path": the_down_path, "connection": "200", "file_name": down_name, "referrer": "", @@ -665,7 +692,7 @@ def thread_Bitcomet(file_id,thread_url): "cookie": "", "mirror_url_list": mirror_url } - html = requests.post(url=f"{thread_url}/panel/task_add_httpftp_result",data=postdata) + html = requests.post(url=f"{thread_url}/panel/task_add_httpftp_result",data=postdata,proxies=None) if html.status_code == 502: print(f"Error ({new_time}):推送Bitcomet失败:url链接不正确") @@ -824,12 +851,12 @@ def run(self): '''{ - "url": "https://vod0050-aliyun18-vip-lixian.mypikpak.com/download/?fid=8EjS5VME9cYbtDuEjGR1jTR*tQ63D*k2AAAAAA4OkA0TjTLRQTm**q7CT4pd6men&mid=666&threshold=251&tid=EA093CE26197A2C675AF5F3187FBC387&srcid=0&verno=2&pk=xdrive&e=1646573332&g=0E0E900D138D32D14139BEFAAEC24F8A5DEA67A7&i=F048D2E55304F5C61BB43B848C64758D347EB50E&ui=YRdkHHI8ZU8Ap0ER&t=0&hy=1&ms=6300000&th=0&pt=1&f=921243575&spr=flow&fileid=VMnBPVQjMRShWd-IisrphFm0o1&fext=rar&userid=YRdkHHI8ZU8Ap0ER&clientid=YNxT9w7GMdWvEOKa&projectid=2wks56c31dc80sxm5p9&vip=PVIP&clientver=&at=D9235013033155DEC13D1848EC498E8C", - "save_path": "C:\\Users\\weicy\\Downloads\\Telegram+Desktop", - "connection": "200", - "file_name": "1.mp4", - "referrer": "", - "user_agent": "", - "cookie": "", - "mirror_url_list": "https://vod0051-aliyun18-vip-lixian.mypikpak.com/download/?fid=8EjS5VME9cYbtDuEjGR1jTR*tQ63D*k2AAAAAA4OkA0TjTLRQTm**q7CT4pd6men&mid=666&threshold=251&tid=EA093CE26197A2C675AF5F3187FBC387&srcid=0&verno=2&pk=xdrive&e=1646573332&g=0E0E900D138D32D14139BEFAAEC24F8A5DEA67A7&i=F048D2E55304F5C61BB43B848C64758D347EB50E&ui=YRdkHHI8ZU8Ap0ER&t=0&hy=1&ms=6300000&th=0&pt=1&f=921243575&spr=flow&fileid=VMnBPVQjMRShWd-IisrphFm0o1&fext=rar&userid=YRdkHHI8ZU8Ap0ER&clientid=YNxT9w7GMdWvEOKa&projectid=2wks56c31dc80sxm5p9&vip=PVIP&clientver=&at=D9235013033155DEC13D1848EC498E8C\r\nhttps://vod0049-aliyun18-vip-lixian.mypikpak.com/download/?fid=8EjS5VME9cYbtDuEjGR1jTR*tQ63D*k2AAAAAA4OkA0TjTLRQTm**q7CT4pd6men&mid=666&threshold=251&tid=EA093CE26197A2C675AF5F3187FBC387&srcid=0&verno=2&pk=xdrive&e=1646573332&g=0E0E900D138D32D14139BEFAAEC24F8A5DEA67A7&i=F048D2E55304F5C61BB43B848C64758D347EB50E&ui=YRdkHHI8ZU8Ap0ER&t=0&hy=1&ms=6300000&th=0&pt=1&f=921243575&spr=flow&fileid=VMnBPVQjMRShWd-IisrphFm0o1&fext=rar&userid=YRdkHHI8ZU8Ap0ER&clientid=YNxT9w7GMdWvEOKa&projectid=2wks56c31dc80sxm5p9&vip=PVIP&clientver=&at=D9235013033155DEC13D1848EC498E8C" + "url": "https://vod0050-aliyun18-vip-lixian.mypikpak.com/download/?fid=8EjS5VME9cYbtDuEjGR1jTR*tQ63D*k2AAAAAA4OkA0TjTLRQTm**q7CT4pd6men&mid=666&threshold=251&tid=EA093CE26197A2C675AF5F3187FBC387&srcid=0&verno=2&pk=xdrive&e=1646573332&g=0E0E900D138D32D14139BEFAAEC24F8A5DEA67A7&i=F048D2E55304F5C61BB43B848C64758D347EB50E&ui=YRdkHHI8ZU8Ap0ER&t=0&hy=1&ms=6300000&th=0&pt=1&f=921243575&spr=flow&fileid=VMnBPVQjMRShWd-IisrphFm0o1&fext=rar&userid=YRdkHHI8ZU8Ap0ER&clientid=YNxT9w7GMdWvEOKa&projectid=2wks56c31dc80sxm5p9&vip=PVIP&clientver=&at=D9235013033155DEC13D1848EC498E8C", + "save_path": "C:\\Users\\weicy\\Downloads\\Telegram+Desktop", + "connection": "200", + "file_name": "1.mp4", + "referrer": "", + "user_agent": "", + "cookie": "", + "mirror_url_list": "https://vod0051-aliyun18-vip-lixian.mypikpak.com/download/?fid=8EjS5VME9cYbtDuEjGR1jTR*tQ63D*k2AAAAAA4OkA0TjTLRQTm**q7CT4pd6men&mid=666&threshold=251&tid=EA093CE26197A2C675AF5F3187FBC387&srcid=0&verno=2&pk=xdrive&e=1646573332&g=0E0E900D138D32D14139BEFAAEC24F8A5DEA67A7&i=F048D2E55304F5C61BB43B848C64758D347EB50E&ui=YRdkHHI8ZU8Ap0ER&t=0&hy=1&ms=6300000&th=0&pt=1&f=921243575&spr=flow&fileid=VMnBPVQjMRShWd-IisrphFm0o1&fext=rar&userid=YRdkHHI8ZU8Ap0ER&clientid=YNxT9w7GMdWvEOKa&projectid=2wks56c31dc80sxm5p9&vip=PVIP&clientver=&at=D9235013033155DEC13D1848EC498E8C\r\nhttps://vod0049-aliyun18-vip-lixian.mypikpak.com/download/?fid=8EjS5VME9cYbtDuEjGR1jTR*tQ63D*k2AAAAAA4OkA0TjTLRQTm**q7CT4pd6men&mid=666&threshold=251&tid=EA093CE26197A2C675AF5F3187FBC387&srcid=0&verno=2&pk=xdrive&e=1646573332&g=0E0E900D138D32D14139BEFAAEC24F8A5DEA67A7&i=F048D2E55304F5C61BB43B848C64758D347EB50E&ui=YRdkHHI8ZU8Ap0ER&t=0&hy=1&ms=6300000&th=0&pt=1&f=921243575&spr=flow&fileid=VMnBPVQjMRShWd-IisrphFm0o1&fext=rar&userid=YRdkHHI8ZU8Ap0ER&clientid=YNxT9w7GMdWvEOKa&projectid=2wks56c31dc80sxm5p9&vip=PVIP&clientver=&at=D9235013033155DEC13D1848EC498E8C" }''' \ No newline at end of file diff --git a/need/yang.py b/need/yang.py index 5bfe6f0..0e89471 100644 --- a/need/yang.py +++ b/need/yang.py @@ -831,7 +831,7 @@ def setupUi(self, Form): self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName("scrollArea") self.configscrollAreaWidgetContents = QtWidgets.QWidget() - self.configscrollAreaWidgetContents.setGeometry(QtCore.QRect(0, -713, 1245, 1252)) + self.configscrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 1013, 1252)) self.configscrollAreaWidgetContents.setObjectName("configscrollAreaWidgetContents") self.verticalLayout_9 = QtWidgets.QVBoxLayout(self.configscrollAreaWidgetContents) self.verticalLayout_9.setObjectName("verticalLayout_9") @@ -1730,7 +1730,7 @@ def setupUi(self, Form): def retranslateUi(self, Form): _translate = QtCore.QCoreApplication.translate Form.setWindowTitle(_translate("Form", "PikPakDown")) - self.titlelabel.setText(_translate("Form", "PikPakDown v2.2.8")) + self.titlelabel.setText(_translate("Form", "PikPakDown v2.2.9")) self.pingtitlelabel.setText(_translate("Form", "连接情况:")) self.pinginfo_label.setText(_translate("Form", "检测中")) self.tohidepushButton.setText(_translate("Form", "-")) diff --git a/need/yang.ui b/need/yang.ui index 40e9107..7c6d26f 100644 --- a/need/yang.ui +++ b/need/yang.ui @@ -82,7 +82,7 @@ border-bottom:6px ridge #E0E0E0; - PikPakDown v2.2.8 + PikPakDown v2.2.9 @@ -1182,8 +1182,8 @@ QScrollBar::add-line:horizontal { 0 - -713 - 1245 + 0 + 1013 1252 diff --git a/pikpakdown.py b/pikpakdown.py index 3a1043a..e501d44 100644 --- a/pikpakdown.py +++ b/pikpakdown.py @@ -142,7 +142,7 @@ def read_config(): from subprocess import Popen import subprocess -import cgitb + upload_task=[] @@ -3067,7 +3067,8 @@ def check_network_back(self,num): # 退出APP def start_exit_app(self): - exit() + sys.exit() + # 离线下载界面 def offline_page(self): @@ -6015,10 +6016,10 @@ def start_choose_idm(self): QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling) #崩溃错误捕获 - log_dir = os.path.join(os.getcwd(), 'log') + '''log_dir = os.path.join(os.getcwd(), 'log') if not os.path.exists(log_dir): os.mkdir(log_dir) - cgitb.enable(format='text', logdir=log_dir) + cgitb.enable(format='text', logdir=log_dir)''' app = QtWidgets.QApplication(sys.argv)