xtn-tools-pro 1.0.0.7.6__py3-none-any.whl → 1.0.0.7.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xtn_tools_pro/task_pro/go_fun_v3.py +35 -10
- {xtn_tools_pro-1.0.0.7.6.dist-info → xtn_tools_pro-1.0.0.7.8.dist-info}/METADATA +1 -1
- {xtn_tools_pro-1.0.0.7.6.dist-info → xtn_tools_pro-1.0.0.7.8.dist-info}/RECORD +6 -6
- {xtn_tools_pro-1.0.0.7.6.dist-info → xtn_tools_pro-1.0.0.7.8.dist-info}/LICENSE +0 -0
- {xtn_tools_pro-1.0.0.7.6.dist-info → xtn_tools_pro-1.0.0.7.8.dist-info}/WHEEL +0 -0
- {xtn_tools_pro-1.0.0.7.6.dist-info → xtn_tools_pro-1.0.0.7.8.dist-info}/top_level.txt +0 -0
@@ -29,14 +29,16 @@ class GoFunTaskV3:
|
|
29
29
|
port = ini_dict.get('port', 0) # 端口
|
30
30
|
task = ini_dict.get('task', '') # 任务
|
31
31
|
auto = ini_dict.get('auto', '') # token
|
32
|
+
proxies_dict = ini_dict.get('proxies_dict', {}) # 自定义代理
|
32
33
|
processes_num = ini_dict.get('processes_num', 0) # 进程数
|
33
34
|
thread_num = ini_dict.get('thread_num', 0) # 线程数
|
34
35
|
restart_time = ini_dict.get('restart_time', 0) # 间隔x秒强制重启
|
35
|
-
restart_time =
|
36
|
+
restart_time = 60 * 60 if restart_time <= 0 else restart_time # 间隔x秒强制重启时间不传默认60分钟
|
36
37
|
update_proxies_time = ini_dict.get('update_proxies_time', 0) # 间隔x秒更新代理
|
37
38
|
upload_task_time = ini_dict.get('upload_task_time', 0) # 回写间隔
|
38
|
-
download_not_task_time = ini_dict.get('download_not_task_time', 0) # 当遇到下载任务接口返回空任务时,间隔x
|
39
|
-
|
39
|
+
download_not_task_time = ini_dict.get('download_not_task_time', 0) # 当遇到下载任务接口返回空任务时,间隔x秒再继续请求
|
40
|
+
download_task_qsize = ini_dict.get('download_task_qsize', 10) # 触发下载任务队列的最低阈值(当下载队列小于等于x时就立刻请求下载任务接口获取任务),默认10个
|
41
|
+
download_task_qsize = 10 if download_task_qsize < 0 else download_task_qsize # 触发下载任务队列的最低阈值(当下载队列小于等于x时就立刻请求下载任务接口获取任务),默认10个
|
40
42
|
|
41
43
|
# 默认进程数和线程数
|
42
44
|
processes_num = 1 if processes_num <= 0 else processes_num
|
@@ -60,6 +62,7 @@ class GoFunTaskV3:
|
|
60
62
|
"port": int(port),
|
61
63
|
"task": task,
|
62
64
|
"auto": auto,
|
65
|
+
"proxies_dict": proxies_dict,
|
63
66
|
"processes_num": int(processes_num),
|
64
67
|
"thread_num": int(thread_num),
|
65
68
|
"restart_time": int(restart_time),
|
@@ -70,6 +73,7 @@ class GoFunTaskV3:
|
|
70
73
|
"update_proxy_url": update_proxy_url, # 更新代理地址
|
71
74
|
"external_ip": external_ip,
|
72
75
|
"download_not_task_time": download_not_task_time,
|
76
|
+
"download_task_qsize": download_task_qsize,
|
73
77
|
}
|
74
78
|
|
75
79
|
logger.debug(
|
@@ -83,7 +87,7 @@ class GoFunTaskV3:
|
|
83
87
|
self.upload_queue = multiprocessing.Queue()
|
84
88
|
manager = multiprocessing.Manager() # 进程1
|
85
89
|
self.manager_info = manager.dict()
|
86
|
-
self.proxies_dict = manager.dict()
|
90
|
+
self.proxies_dict = proxies_dict if proxies_dict else manager.dict()
|
87
91
|
|
88
92
|
# 获取任务
|
89
93
|
thread_download_task = threading.Thread(target=self.__download_task,
|
@@ -95,10 +99,11 @@ class GoFunTaskV3:
|
|
95
99
|
args=(self.upload_queue, self.__ini_info, logger))
|
96
100
|
thread_upload_task.start()
|
97
101
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
+
if not self.proxies_dict:
|
103
|
+
# 维护代理
|
104
|
+
thread_update_proxy = threading.Thread(target=self.__update_proxy,
|
105
|
+
args=(self.proxies_dict, self.manager_info, self.__ini_info, logger))
|
106
|
+
thread_update_proxy.start()
|
102
107
|
|
103
108
|
# go_task_fun_cnt = 0
|
104
109
|
# go_task_fun_task_process = None
|
@@ -149,7 +154,8 @@ class GoFunTaskV3:
|
|
149
154
|
logger.info("检测到已达强制重启间隔,正在重启...")
|
150
155
|
self.manager_info["gofun_kill_status"] = True
|
151
156
|
|
152
|
-
logger.info(
|
157
|
+
logger.info(
|
158
|
+
f"主线程正常...进程数:{len(go_process_list)}...gofun(True不存在|False正常):{self.manager_info['gofun_kill_status']}")
|
153
159
|
time.sleep(10)
|
154
160
|
|
155
161
|
def __get_external_ip(self):
|
@@ -176,6 +182,7 @@ class GoFunTaskV3:
|
|
176
182
|
auto = ini_info["auto"]
|
177
183
|
task = ini_info["task"]
|
178
184
|
download_not_task_time = ini_info["download_not_task_time"]
|
185
|
+
download_task_qsize = ini_info["download_task_qsize"]
|
179
186
|
headers = {"Authorization": auto}
|
180
187
|
params = {"taskType": task}
|
181
188
|
|
@@ -184,7 +191,7 @@ class GoFunTaskV3:
|
|
184
191
|
try:
|
185
192
|
qsize = download_queue.qsize()
|
186
193
|
logger.info(f"当前队列剩余任务数:{qsize}")
|
187
|
-
if qsize
|
194
|
+
if qsize > download_task_qsize:
|
188
195
|
time.sleep(download_not_task_time)
|
189
196
|
continue
|
190
197
|
resp = requests.get(download_url, headers=headers, params=params, timeout=5)
|
@@ -360,3 +367,21 @@ class GoFunTaskV3:
|
|
360
367
|
except Exception as e:
|
361
368
|
self.logger.critical(f"update_upload_task 更新任务 {self.upload_queue, task_item} 报错 {e}")
|
362
369
|
return False
|
370
|
+
|
371
|
+
def help(self):
|
372
|
+
help_txt = """
|
373
|
+
参数说明:
|
374
|
+
host:必填,域名
|
375
|
+
port:选填,端口
|
376
|
+
task:必填,任务类型
|
377
|
+
auto:必填,token
|
378
|
+
proxies_dict:选填,默认为空,为空时会启动获取代理接口获取代理,不为空时则不启动该接口而是一直使用用户传递过来的代理
|
379
|
+
update_proxies_time:选填,默认为0,间隔x秒更新代理,0则每次启动时获取一次之后就不在请求代理接口
|
380
|
+
processes_num:选填,进程数,默认1
|
381
|
+
thread_num:选填,线程数,默认1
|
382
|
+
restart_time:选填,间隔x秒强制重启,默认60分钟
|
383
|
+
upload_task_time:选填,回写间隔,默认0
|
384
|
+
download_not_task_time:选填,默认0,当遇到下载任务接口返回空任务时,间隔x秒再继续请求
|
385
|
+
download_task_qsize:选填,默认10,触发下载任务队列的最低阈值(当下载队列小于等于x时就立刻请求下载任务接口获取任务),默认10个
|
386
|
+
"""
|
387
|
+
self.logger.info(help_txt)
|
@@ -12,7 +12,7 @@ xtn_tools_pro/proxy/proxy.py,sha256=No6E1pFY5yx2F4976pXPrLtq-QEVp79KupzcufjSN58,
|
|
12
12
|
xtn_tools_pro/task_pro/__init__.py,sha256=nK3U47hWwE1H875ieEToH9r-jzXHS-PXk8cDstOvRE8,418
|
13
13
|
xtn_tools_pro/task_pro/go_fun.py,sha256=hWEt2uJ9FCvJH7PhVZttS-11A7J6zbRKwX7c5YLYQag,19144
|
14
14
|
xtn_tools_pro/task_pro/go_fun_v2.py,sha256=SgcXgtEBGSVL1V2LyqO0z8Md2H8JZxucYrLLIwqtiLM,18489
|
15
|
-
xtn_tools_pro/task_pro/go_fun_v3.py,sha256=
|
15
|
+
xtn_tools_pro/task_pro/go_fun_v3.py,sha256=Pd_FFKxd7GdiNxc-3x7U0q7OBBHD7N5QH692XchwWts,17883
|
16
16
|
xtn_tools_pro/utils/__init__.py,sha256=I1_n_NP23F2lBqlF4EOlnOdLYxM8M4pbn63UhJN1hRE,418
|
17
17
|
xtn_tools_pro/utils/crypto.py,sha256=oyzFqWum_oimUtzhfVCELQhdMjxDbLu-nOWfcNmazcc,4087
|
18
18
|
xtn_tools_pro/utils/file_utils.py,sha256=obaBP7CaBCsXxzqGeWzV2l0yw7vicgKOaXzmpMV8ips,2567
|
@@ -22,8 +22,8 @@ xtn_tools_pro/utils/retry.py,sha256=0wjHsR5DBBKpv4naMfxiky8kprrZes4WURIfFQ4H708,
|
|
22
22
|
xtn_tools_pro/utils/set_data.py,sha256=IthfAclck7AbaxOIKOgJZ2wdcfEmlvC-C63Tywcr4bA,11180
|
23
23
|
xtn_tools_pro/utils/sql.py,sha256=EAKzbkZP7Q09j15Gm6o0_uq0qgQmcCQT6EAawbpp4v0,6263
|
24
24
|
xtn_tools_pro/utils/time_utils.py,sha256=TUtzG61PeVYXhaQd6pBrXAdlz7tBispNIRQRcGhE2No,4859
|
25
|
-
xtn_tools_pro-1.0.0.7.
|
26
|
-
xtn_tools_pro-1.0.0.7.
|
27
|
-
xtn_tools_pro-1.0.0.7.
|
28
|
-
xtn_tools_pro-1.0.0.7.
|
29
|
-
xtn_tools_pro-1.0.0.7.
|
25
|
+
xtn_tools_pro-1.0.0.7.8.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
|
+
xtn_tools_pro-1.0.0.7.8.dist-info/METADATA,sha256=iL7cELlsKjZXE79i-3a39WXwE7drXBsjOvmv4_KpoPM,498
|
27
|
+
xtn_tools_pro-1.0.0.7.8.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
28
|
+
xtn_tools_pro-1.0.0.7.8.dist-info/top_level.txt,sha256=jyB3FLDEr8zE1U7wHczTgIbvUpALhR-ULF7RVEO7O2U,14
|
29
|
+
xtn_tools_pro-1.0.0.7.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|