xtn-tools-pro 1.0.1.2.4__py3-none-any.whl → 1.0.1.2.6__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.
@@ -166,7 +166,7 @@ class GoFunTaskV3:
166
166
  获取当前网络ip
167
167
  :return:
168
168
  """
169
- while True:
169
+ for _ in range(10):
170
170
  try:
171
171
  rp = requests.get('https://httpbin.org/ip')
172
172
  rp_json = rp.json()
@@ -174,6 +174,7 @@ class GoFunTaskV3:
174
174
  return rp_json['origin']
175
175
  except Exception as e:
176
176
  self.logger.critical(f"获取当前网络ip{e}")
177
+ return "0.0.0.0"
177
178
 
178
179
  def __download_task(self, download_queue, manager_info, ini_info, logger):
179
180
  """
@@ -370,6 +371,33 @@ class GoFunTaskV3:
370
371
  self.logger.critical(f"get_download_task 获取下载任务 {self.download_queue, block, timeout} 报错 {e}")
371
372
  return False
372
373
 
374
+ def get_download_task_list(self, block=False, timeout=1, get_cnt=1):
375
+ """
376
+ 获取下载任务
377
+ :param block: 是否阻塞等待 True阻塞/False不阻塞
378
+ :param timeout:
379
+ :param get_cnt: 获取任务的个数
380
+ :return:
381
+ error_code:1001 队列为空;
382
+ """
383
+ task_item_list = []
384
+ for _ in range(get_cnt):
385
+ try:
386
+ task_item = self.download_queue.get(block=block, timeout=timeout)
387
+ task_item["success"] = True
388
+ task_item_list.append(task_item)
389
+ except queue.Empty as e:
390
+ # 捕获队列为空的异常
391
+ # self.logger.info(f"get_download_task 获取下载任务 {download_queue, block, timeout} 报错 队列为空: {e}")
392
+ # return {"error": "队列为空", "error_code": 1001}
393
+ break
394
+ except Exception as e:
395
+ self.logger.critical(f"get_download_task 获取下载任务 {self.download_queue, block, timeout} 报错 {e}")
396
+ # return False
397
+ break
398
+
399
+ return task_item_list
400
+
373
401
  def update_upload_task(self, task_item):
374
402
  """
375
403
  更新任务
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xtn-tools-pro
3
- Version: 1.0.1.2.4
3
+ Version: 1.0.1.2.6
4
4
  Summary: xtn 开发工具
5
5
  Author: xtn
6
6
  Author-email: czw011122@gmail.com
@@ -51,7 +51,7 @@ xtn_tools_pro/task_pro/__init__.py,sha256=nK3U47hWwE1H875ieEToH9r-jzXHS-PXk8cDst
51
51
  xtn_tools_pro/task_pro/go_fun.py,sha256=hWEt2uJ9FCvJH7PhVZttS-11A7J6zbRKwX7c5YLYQag,19144
52
52
  xtn_tools_pro/task_pro/go_fun_air_v1.py,sha256=25gHmW5aAV6nMY9Y6-wD7uQ_wqE39dr-eaegqVbYKM8,11035
53
53
  xtn_tools_pro/task_pro/go_fun_v2.py,sha256=SgcXgtEBGSVL1V2LyqO0z8Md2H8JZxucYrLLIwqtiLM,18489
54
- xtn_tools_pro/task_pro/go_fun_v3.py,sha256=qhsLr9vKDDNp6zqqN2GazCwHQpAhxjlNg7Juj0lyhkA,19616
54
+ xtn_tools_pro/task_pro/go_fun_v3.py,sha256=_I92M7ubCknrgNfVe9PDw8KbSaqM3DgOPnurGVbRAf4,20807
55
55
  xtn_tools_pro/utils/__init__.py,sha256=I1_n_NP23F2lBqlF4EOlnOdLYxM8M4pbn63UhJN1hRE,418
56
56
  xtn_tools_pro/utils/audio_video.py,sha256=3Im3tGOW6IbmqDcrE1SJUg6eGyLGEyq11Qu6TCutJJw,1115
57
57
  xtn_tools_pro/utils/crypto.py,sha256=kjbmkH6oj3guegDyzD6aW8rDOpKhApma1VnQN02KfcE,5157
@@ -63,9 +63,9 @@ xtn_tools_pro/utils/set_data.py,sha256=BzCLbEDO83csDHBey8kP7SoE6kx6EjqE7OqRBY7k8
63
63
  xtn_tools_pro/utils/shell.py,sha256=s6sJedxLLQokcI1hF5YSD3qgGUPK0brNcP-D3-yv54I,3790
64
64
  xtn_tools_pro/utils/sql.py,sha256=EAKzbkZP7Q09j15Gm6o0_uq0qgQmcCQT6EAawbpp4v0,6263
65
65
  xtn_tools_pro/utils/time_utils.py,sha256=TUtzG61PeVYXhaQd6pBrXAdlz7tBispNIRQRcGhE2No,4859
66
- xtn_tools_pro-1.0.1.2.4.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
67
- xtn_tools_pro-1.0.1.2.4.dist-info/METADATA,sha256=90MNJQPrJg_RYhFDGfrqtgZjgpCaLkabPvfw27n1yMc,574
68
- xtn_tools_pro-1.0.1.2.4.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
69
- xtn_tools_pro-1.0.1.2.4.dist-info/entry_points.txt,sha256=t8CtXWOgw7nRDW3XNlZh8MT_P4l8EzsFnyWi5b3ovrc,68
70
- xtn_tools_pro-1.0.1.2.4.dist-info/top_level.txt,sha256=jyB3FLDEr8zE1U7wHczTgIbvUpALhR-ULF7RVEO7O2U,14
71
- xtn_tools_pro-1.0.1.2.4.dist-info/RECORD,,
66
+ xtn_tools_pro-1.0.1.2.6.dist-info/LICENSE,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
67
+ xtn_tools_pro-1.0.1.2.6.dist-info/METADATA,sha256=-29b6WhWWVpz32c9_NRlpK2q9LWacucoN0-X14Odn94,574
68
+ xtn_tools_pro-1.0.1.2.6.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
69
+ xtn_tools_pro-1.0.1.2.6.dist-info/entry_points.txt,sha256=t8CtXWOgw7nRDW3XNlZh8MT_P4l8EzsFnyWi5b3ovrc,68
70
+ xtn_tools_pro-1.0.1.2.6.dist-info/top_level.txt,sha256=jyB3FLDEr8zE1U7wHczTgIbvUpALhR-ULF7RVEO7O2U,14
71
+ xtn_tools_pro-1.0.1.2.6.dist-info/RECORD,,