podflow 20250415.2__tar.gz → 20250417.1__tar.gz

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.
Files changed (110) hide show
  1. {podflow-20250415.2 → podflow-20250417.1}/PKG-INFO +3 -1
  2. {podflow-20250415.2 → podflow-20250417.1}/README.md +2 -0
  3. {podflow-20250415.2 → podflow-20250417.1}/podflow/__init__.py +1 -1
  4. {podflow-20250415.2 → podflow-20250417.1}/podflow/bilibili/build.py +9 -3
  5. {podflow-20250415.2 → podflow-20250417.1}/podflow/bilibili/get.py +81 -17
  6. podflow-20250417.1/podflow/httpfs/progress_bar.py +32 -0
  7. {podflow-20250415.2 → podflow-20250417.1}/podflow/main_podcast.py +28 -33
  8. {podflow-20250415.2 → podflow-20250417.1}/podflow/makeup/make_up_file.py +3 -6
  9. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/create_main_rss.py +3 -8
  10. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/get_original_rss.py +1 -14
  11. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/get_youtube_and_bilibili_video_format.py +2 -4
  12. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/optimize_download.py +2 -10
  13. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/update_youtube_bilibili_rss.py +3 -6
  14. {podflow-20250415.2 → podflow-20250417.1}/podflow/templates/index.html +83 -45
  15. {podflow-20250415.2 → podflow-20250417.1}/podflow/upload/linked_client.py +2 -0
  16. {podflow-20250415.2 → podflow-20250417.1}/podflow/youtube/build.py +6 -1
  17. {podflow-20250415.2 → podflow-20250417.1}/podflow/youtube/get.py +12 -14
  18. {podflow-20250415.2 → podflow-20250417.1}/podflow.egg-info/PKG-INFO +3 -1
  19. {podflow-20250415.2 → podflow-20250417.1}/podflow.egg-info/SOURCES.txt +1 -0
  20. {podflow-20250415.2 → podflow-20250417.1}/setup.py +1 -1
  21. {podflow-20250415.2 → podflow-20250417.1}/MANIFEST.in +0 -0
  22. {podflow-20250415.2 → podflow-20250417.1}/podflow/basic/__init__.py +0 -0
  23. {podflow-20250415.2 → podflow-20250417.1}/podflow/basic/file_save.py +0 -0
  24. {podflow-20250415.2 → podflow-20250417.1}/podflow/basic/folder_build.py +0 -0
  25. {podflow-20250415.2 → podflow-20250417.1}/podflow/basic/get_duration.py +0 -0
  26. {podflow-20250415.2 → podflow-20250417.1}/podflow/basic/get_file_list.py +0 -0
  27. {podflow-20250415.2 → podflow-20250417.1}/podflow/basic/get_html_dict.py +0 -0
  28. {podflow-20250415.2 → podflow-20250417.1}/podflow/basic/http_client.py +0 -0
  29. {podflow-20250415.2 → podflow-20250417.1}/podflow/basic/list_merge_tidy.py +0 -0
  30. {podflow-20250415.2 → podflow-20250417.1}/podflow/basic/qr_code.py +0 -0
  31. {podflow-20250415.2 → podflow-20250417.1}/podflow/basic/split_dict.py +0 -0
  32. {podflow-20250415.2 → podflow-20250417.1}/podflow/basic/time_format.py +0 -0
  33. {podflow-20250415.2 → podflow-20250417.1}/podflow/basic/time_print.py +0 -0
  34. {podflow-20250415.2 → podflow-20250417.1}/podflow/basic/time_stamp.py +0 -0
  35. {podflow-20250415.2 → podflow-20250417.1}/podflow/basic/vary_replace.py +0 -0
  36. {podflow-20250415.2 → podflow-20250417.1}/podflow/basic/write_log.py +0 -0
  37. {podflow-20250415.2 → podflow-20250417.1}/podflow/bilibili/__init__.py +0 -0
  38. {podflow-20250415.2 → podflow-20250417.1}/podflow/bilibili/login.py +0 -0
  39. {podflow-20250415.2 → podflow-20250417.1}/podflow/config/__init__.py +0 -0
  40. {podflow-20250415.2 → podflow-20250417.1}/podflow/config/build_original.py +0 -0
  41. {podflow-20250415.2 → podflow-20250417.1}/podflow/config/channge_icon.py +0 -0
  42. {podflow-20250415.2 → podflow-20250417.1}/podflow/config/correct_channelid.py +0 -0
  43. {podflow-20250415.2 → podflow-20250417.1}/podflow/config/correct_config.py +0 -0
  44. {podflow-20250415.2 → podflow-20250417.1}/podflow/config/get_channelid.py +0 -0
  45. {podflow-20250415.2 → podflow-20250417.1}/podflow/config/get_channelid_id.py +0 -0
  46. {podflow-20250415.2 → podflow-20250417.1}/podflow/config/get_config.py +0 -0
  47. {podflow-20250415.2 → podflow-20250417.1}/podflow/download/__init__.py +0 -0
  48. {podflow-20250415.2 → podflow-20250417.1}/podflow/download/convert_bytes.py +0 -0
  49. {podflow-20250415.2 → podflow-20250417.1}/podflow/download/delete_part.py +0 -0
  50. {podflow-20250415.2 → podflow-20250417.1}/podflow/download/dl_aideo_video.py +0 -0
  51. {podflow-20250415.2 → podflow-20250417.1}/podflow/download/show_progress.py +0 -0
  52. {podflow-20250415.2 → podflow-20250417.1}/podflow/download/wait_animation.py +0 -0
  53. {podflow-20250415.2 → podflow-20250417.1}/podflow/download/youtube_and_bilibili_download.py +0 -0
  54. {podflow-20250415.2 → podflow-20250417.1}/podflow/download_and_build.py +0 -0
  55. {podflow-20250415.2 → podflow-20250417.1}/podflow/ffmpeg_judge.py +0 -0
  56. {podflow-20250415.2 → podflow-20250417.1}/podflow/httpfs/__init__.py +0 -0
  57. {podflow-20250415.2 → podflow-20250417.1}/podflow/httpfs/app_bottle.py +0 -0
  58. {podflow-20250415.2 → podflow-20250417.1}/podflow/httpfs/browser.py +0 -0
  59. {podflow-20250415.2 → podflow-20250417.1}/podflow/httpfs/get_channelid.py +0 -0
  60. {podflow-20250415.2 → podflow-20250417.1}/podflow/httpfs/port_judge.py +0 -0
  61. {podflow-20250415.2 → podflow-20250417.1}/podflow/httpfs/to_html.py +0 -0
  62. {podflow-20250415.2 → podflow-20250417.1}/podflow/main.py +0 -0
  63. {podflow-20250415.2 → podflow-20250417.1}/podflow/main_upload.py +0 -0
  64. {podflow-20250415.2 → podflow-20250417.1}/podflow/makeup/__init__.py +0 -0
  65. {podflow-20250415.2 → podflow-20250417.1}/podflow/makeup/del_makeup_format_fail.py +0 -0
  66. {podflow-20250415.2 → podflow-20250417.1}/podflow/makeup/make_up_file_format_mod.py +0 -0
  67. {podflow-20250415.2 → podflow-20250417.1}/podflow/makeup/make_up_file_mod.py +0 -0
  68. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/__init__.py +0 -0
  69. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/backup_zip_save.py +0 -0
  70. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/display_qrcode_and_url.py +0 -0
  71. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/fail_message_initialize.py +0 -0
  72. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/format_time.py +0 -0
  73. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/get_media_name.py +0 -0
  74. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/get_video_format.py +0 -0
  75. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/get_video_format_multithread.py +0 -0
  76. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/media_format.py +0 -0
  77. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/original_rss_fail_print.py +0 -0
  78. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/rss_create_hash.py +0 -0
  79. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/save_rss.py +0 -0
  80. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/title_correction.py +0 -0
  81. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/update_information_display.py +0 -0
  82. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/want_retry.py +0 -0
  83. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/xml_item.py +0 -0
  84. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/xml_original_item.py +0 -0
  85. {podflow-20250415.2 → podflow-20250417.1}/podflow/message/xml_rss.py +0 -0
  86. {podflow-20250415.2 → podflow-20250417.1}/podflow/netscape/__init__.py +0 -0
  87. {podflow-20250415.2 → podflow-20250417.1}/podflow/netscape/bulid_netscape.py +0 -0
  88. {podflow-20250415.2 → podflow-20250417.1}/podflow/netscape/get_cookie_dict.py +0 -0
  89. {podflow-20250415.2 → podflow-20250417.1}/podflow/parse_arguments.py +0 -0
  90. {podflow-20250415.2 → podflow-20250417.1}/podflow/remove/__init__.py +0 -0
  91. {podflow-20250415.2 → podflow-20250417.1}/podflow/remove/remove_dir.py +0 -0
  92. {podflow-20250415.2 → podflow-20250417.1}/podflow/remove/remove_file.py +0 -0
  93. {podflow-20250415.2 → podflow-20250417.1}/podflow/repair/__init__.py +0 -0
  94. {podflow-20250415.2 → podflow-20250417.1}/podflow/repair/reverse_log.py +0 -0
  95. {podflow-20250415.2 → podflow-20250417.1}/podflow/upload/__init__.py +0 -0
  96. {podflow-20250415.2 → podflow-20250417.1}/podflow/upload/add_upload.py +0 -0
  97. {podflow-20250415.2 → podflow-20250417.1}/podflow/upload/build_hash.py +0 -0
  98. {podflow-20250415.2 → podflow-20250417.1}/podflow/upload/get_upload_original.py +0 -0
  99. {podflow-20250415.2 → podflow-20250417.1}/podflow/upload/linked_server.py +0 -0
  100. {podflow-20250415.2 → podflow-20250417.1}/podflow/upload/login.py +0 -0
  101. {podflow-20250415.2 → podflow-20250417.1}/podflow/upload/time_key.py +0 -0
  102. {podflow-20250415.2 → podflow-20250417.1}/podflow/upload/update_upload.py +0 -0
  103. {podflow-20250415.2 → podflow-20250417.1}/podflow/upload/upload_server.py +0 -0
  104. {podflow-20250415.2 → podflow-20250417.1}/podflow/youtube/__init__.py +0 -0
  105. {podflow-20250415.2 → podflow-20250417.1}/podflow/youtube/login.py +0 -0
  106. {podflow-20250415.2 → podflow-20250417.1}/podflow.egg-info/dependency_links.txt +0 -0
  107. {podflow-20250415.2 → podflow-20250417.1}/podflow.egg-info/entry_points.txt +0 -0
  108. {podflow-20250415.2 → podflow-20250417.1}/podflow.egg-info/requires.txt +0 -0
  109. {podflow-20250415.2 → podflow-20250417.1}/podflow.egg-info/top_level.txt +0 -0
  110. {podflow-20250415.2 → podflow-20250417.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: podflow
3
- Version: 20250415.2
3
+ Version: 20250417.1
4
4
  Summary: A podcast server that includes YouTube and BiliBili
5
5
  Home-page: https://github.com/gruel-zxz/podflow
6
6
  Author: gruel_zxz
@@ -16,6 +16,8 @@ Description: # Podflow
16
16
 
17
17
  YouTube的cookies需要使用chrome插件导出Netscape格式并保存到channel_data文件夹中
18
18
 
19
+ 图形界面请访问 `/index`
20
+
19
21
  PS:可能存在大量未知bug,改进中并尝试加入抖音……
20
22
 
21
23
  ### 安装方法
@@ -8,6 +8,8 @@
8
8
 
9
9
  YouTube的cookies需要使用chrome插件导出Netscape格式并保存到channel_data文件夹中
10
10
 
11
+ 图形界面请访问 `/index`
12
+
11
13
  PS:可能存在大量未知bug,改进中并尝试加入抖音……
12
14
 
13
15
  ### 安装方法
@@ -125,7 +125,7 @@ class Application_gVar:
125
125
  "podflow": [], # 主窗口信息列表
126
126
  "http": [], # httpfs窗口信息列表
127
127
  "enter": True, # 是否换行
128
- "schedule": [], # 进度条信息列表
128
+ "schedule": [0, "准备中"], # 进度条信息列表
129
129
  }
130
130
 
131
131
 
@@ -6,11 +6,10 @@ import html
6
6
  import contextlib
7
7
  from datetime import datetime, timezone
8
8
  from podflow import gVar
9
- from podflow.message.xml_rss import xml_rss
10
- from podflow.basic.file_save import file_save
11
9
  from podflow.message.xml_item import xml_item
12
10
  from podflow.bilibili.get import get_bilibili_cid
13
11
  from podflow.message.format_time import format_time
12
+ from podflow.httpfs.progress_bar import progress_bar
14
13
  from podflow.basic.get_file_list import get_file_list
15
14
  from podflow.message.xml_original_item import xml_original_item
16
15
 
@@ -23,6 +22,7 @@ def get_items_list(
23
22
  items_counts,
24
23
  output_dir,
25
24
  items_list,
25
+ ratio_part,
26
26
  ):
27
27
  pubDate = datetime.fromtimestamp(item["created"], timezone.utc).strftime(
28
28
  "%Y-%m-%dT%H:%M:%S%z"
@@ -63,6 +63,7 @@ def get_items_list(
63
63
  title_change,
64
64
  )
65
65
  items_list.append(f"{xml_item_text}<!-- {output_dir} -->")
66
+ progress_bar(ratio_part[0], ratio_part[1])
66
67
  elif guid_edgeinfos and items_counts[guid] == len(guid_edgeinfos):
67
68
  cid_edgeinfos = {
68
69
  guid_edgeinfo["cid"]: guid_edgeinfo["title"]
@@ -100,6 +101,7 @@ def get_items_list(
100
101
  title_change,
101
102
  )
102
103
  items_list.append(f"{xml_item_text}<!-- {output_dir} -->")
104
+ progress_bar(ratio_part[0], ratio_part[1])
103
105
  else:
104
106
  xml_item_text = xml_item(
105
107
  item["bvid"],
@@ -113,10 +115,11 @@ def get_items_list(
113
115
  title_change,
114
116
  )
115
117
  items_list.append(f"{xml_item_text}<!-- {output_dir} -->")
118
+ progress_bar(ratio_part[0], ratio_part[1])
116
119
 
117
120
 
118
121
  # 生成哔哩哔哩对应channel的需更新的items模块
119
- def bilibili_xml_items(output_dir):
122
+ def bilibili_xml_items(output_dir, ratio_part):
120
123
  channelid_bilibili_value = gVar.channelid_bilibili[
121
124
  gVar.channelid_bilibili_ids[output_dir]
122
125
  ]
@@ -141,6 +144,7 @@ def bilibili_xml_items(output_dir):
141
144
  items_counts,
142
145
  output_dir,
143
146
  items_list,
147
+ ratio_part,
144
148
  )
145
149
  if item["description"] and item["description"][0] == "『":
146
150
  original_judgment = False
@@ -162,6 +166,7 @@ def bilibili_xml_items(output_dir):
162
166
  items_list.append(
163
167
  f"{xml_original_item(xml, channelid_title, original_judgment, title_change)}<!-- {output_dir} -->"
164
168
  )
169
+ progress_bar(ratio_part[0], ratio_part[1])
165
170
  xml_num += 1
166
171
  if xml_num >= entry_count:
167
172
  break
@@ -182,6 +187,7 @@ def bilibili_xml_items(output_dir):
182
187
  items_counts,
183
188
  output_dir,
184
189
  items_list,
190
+ ratio_part,
185
191
  )
186
192
  # 生成对应xml
187
193
  description = html.escape(output_dir_value["content"]["sign"])
@@ -12,6 +12,7 @@ from hashlib import md5
12
12
  from functools import reduce
13
13
  from podflow import gVar
14
14
  from podflow.basic.http_client import http_client
15
+ from podflow.httpfs.progress_bar import progress_bar
15
16
  from podflow.basic.get_file_list import get_file_list
16
17
  from podflow.basic.list_merge_tidy import list_merge_tidy
17
18
 
@@ -19,10 +20,70 @@ from podflow.basic.list_merge_tidy import list_merge_tidy
19
20
  # WBI签名模块
20
21
  def WBI_signature(params={}, img_key="", sub_key=""):
21
22
  mixinKeyEncTab = [
22
- 46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49,
23
- 33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40,
24
- 61, 26, 17, 0, 1, 60, 51, 30, 4, 22, 25, 54, 21, 56, 59, 6, 63, 57, 62, 11,
25
- 36, 20, 34, 44, 52,
23
+ 46,
24
+ 47,
25
+ 18,
26
+ 2,
27
+ 53,
28
+ 8,
29
+ 23,
30
+ 32,
31
+ 15,
32
+ 50,
33
+ 10,
34
+ 31,
35
+ 58,
36
+ 3,
37
+ 45,
38
+ 35,
39
+ 27,
40
+ 43,
41
+ 5,
42
+ 49,
43
+ 33,
44
+ 9,
45
+ 42,
46
+ 19,
47
+ 29,
48
+ 28,
49
+ 14,
50
+ 39,
51
+ 12,
52
+ 38,
53
+ 41,
54
+ 13,
55
+ 37,
56
+ 48,
57
+ 7,
58
+ 16,
59
+ 24,
60
+ 55,
61
+ 40,
62
+ 61,
63
+ 26,
64
+ 17,
65
+ 0,
66
+ 1,
67
+ 60,
68
+ 51,
69
+ 30,
70
+ 4,
71
+ 22,
72
+ 25,
73
+ 54,
74
+ 21,
75
+ 56,
76
+ 59,
77
+ 6,
78
+ 63,
79
+ 57,
80
+ 62,
81
+ 11,
82
+ 36,
83
+ 20,
84
+ 34,
85
+ 44,
86
+ 52,
26
87
  ]
27
88
 
28
89
  def getMixinKey(orig: str):
@@ -302,7 +363,9 @@ def bilibili_json_update(bilibili_key, bilibili_value):
302
363
  else:
303
364
  return bilibili_card_json["code"]
304
365
  # 查询哔哩哔哩用户投稿视频明细
305
- for num in range(math.ceil(gVar.channelid_bilibili[bilibili_value]["update_size"] / 25)):
366
+ for num in range(
367
+ math.ceil(gVar.channelid_bilibili[bilibili_value]["update_size"] / 25)
368
+ ):
306
369
  num += 1
307
370
  bilibili_entry, bilibili_list = get_bilibili_vlist(
308
371
  bilibili_key,
@@ -325,6 +388,7 @@ def bilibili_rss_update(
325
388
  rss_update_lock,
326
389
  ):
327
390
  bilibili_content_bvid_backward = [] # 初始化向后更新的内容列表
391
+ last_size = gVar.channelid_bilibili[bilibili_value]["last_size"]
328
392
  # 获取已下载文件列表
329
393
  bilibili_content_bvid_original = get_file_list(
330
394
  bilibili_key, gVar.channelid_bilibili[bilibili_value]["media"]
@@ -358,13 +422,13 @@ def bilibili_rss_update(
358
422
  "content": bilibili_space,
359
423
  "type": "int",
360
424
  } # 设置为整型内容
361
- gVar.xmls_quantity[bilibili_key]["update"] = 0
425
+ bilibili_space_new = guids
362
426
  elif bilibili_space is None:
363
427
  gVar.channelid_bilibili_rss[bilibili_key] = {
364
428
  "content": bilibili_space_original,
365
429
  "type": "json",
366
430
  } # 使用原始json内容
367
- gVar.xmls_quantity[bilibili_key]["update"] = 0
431
+ bilibili_space_new = guids
368
432
  else:
369
433
  gVar.channelid_bilibili_rss[bilibili_key] = {
370
434
  "content": bilibili_space,
@@ -377,7 +441,6 @@ def bilibili_rss_update(
377
441
  bilibili_content_bvid = bilibili_space["list"][
378
442
  : gVar.channelid_bilibili[bilibili_value]["update_size"]
379
443
  ]
380
- gVar.xmls_quantity[bilibili_key]["update"] = len(bilibili_content_bvid)
381
444
  bilibili_space_new = list_merge_tidy(
382
445
  bilibili_content_bvid, guids
383
446
  ) # 合并新内容和原内容
@@ -387,7 +450,9 @@ def bilibili_rss_update(
387
450
  for exclude in bilibili_content_bvid
388
451
  if exclude not in bilibili_content_bvid_original # 筛选新增的内容
389
452
  ]:
390
- gVar.channelid_bilibili_ids_update[bilibili_key] = bilibili_value # 需要更新ID
453
+ gVar.channelid_bilibili_ids_update[bilibili_key] = (
454
+ bilibili_value # 需要更新ID
455
+ )
391
456
  gVar.bilibili_content_bvid_update[bilibili_key] = (
392
457
  bilibili_content_bvid # 更新新增内容
393
458
  )
@@ -395,9 +460,9 @@ def bilibili_rss_update(
395
460
  if (
396
461
  gVar.channelid_bilibili[bilibili_value]["BackwardUpdate"] and guids
397
462
  ): # 如果设置了向后更新
398
- backward_update_size = gVar.channelid_bilibili[bilibili_value][
399
- "last_size"
400
- ] - len(bilibili_space_new) # 计算需要向后更新的数量
463
+ backward_update_size = last_size - len(
464
+ bilibili_space_new
465
+ ) # 计算需要向后更新的数量
401
466
  if backward_update_size > 0:
402
467
  backward_update_size = min(
403
468
  backward_update_size,
@@ -483,10 +548,9 @@ def bilibili_rss_update(
483
548
  gVar.bilibili_content_bvid_backward_update[bilibili_key] = (
484
549
  bilibili_content_bvid_backward # 更新最终的向后更新内容
485
550
  )
486
- gVar.xmls_quantity[bilibili_key]["backward"] = len(bilibili_content_bvid_backward)
551
+ gVar.xmls_quantity[bilibili_key] = min(last_size, len(bilibili_space_new)) + len(
552
+ bilibili_content_bvid_backward
553
+ )
487
554
  # 更新进度条
488
555
  with rss_update_lock:
489
- ratio = gVar.index_message["schedule"][1] + ratio_thread
490
- if ratio > 0.09:
491
- ratio = 0.09
492
- gVar.index_message["schedule"][1] = ratio
556
+ progress_bar(ratio_thread, 0.09)
@@ -0,0 +1,32 @@
1
+ # podflow/httpfs/progress_bar.py
2
+ # coding: utf-8
3
+
4
+ import random
5
+ from podflow import gVar
6
+
7
+
8
+ def progress_update(
9
+ ratio,
10
+ added=False,
11
+ refresh=0,
12
+ num=0
13
+ ):
14
+ state = {
15
+ 1: "准备中",
16
+ 2: "构建中",
17
+ 3: "已完成",
18
+ }
19
+ if num != 0:
20
+ ratio +=random.uniform(0, num)
21
+ if added:
22
+ ratio += gVar.index_message["schedule"][1]
23
+ gVar.index_message["schedule"][1] = ratio
24
+ if refresh != 0:
25
+ gVar.index_message["schedule"][0] = state[refresh]
26
+
27
+
28
+ def progress_bar(ratio_part, maximum):
29
+ ratio = gVar.index_message["schedule"][1] + ratio_part
30
+ if ratio > maximum:
31
+ ratio = maximum
32
+ progress_update(ratio)
@@ -4,7 +4,6 @@
4
4
  import sys
5
5
  import json
6
6
  import time
7
- import random
8
7
  import urllib
9
8
  import subprocess
10
9
 
@@ -18,6 +17,7 @@ from podflow.basic.time_print import time_print
18
17
  # 网络和 HTTP 模块
19
18
  from podflow.httpfs.browser import open_url
20
19
  from podflow.httpfs.port_judge import port_judge
20
+ from podflow.httpfs.progress_bar import progress_update
21
21
  from podflow.httpfs.app_bottle import bottle_app_instance
22
22
 
23
23
  # 下载和视频处理模块
@@ -49,8 +49,8 @@ from podflow.makeup.del_makeup_format_fail import del_makeup_format_fail
49
49
  from podflow.makeup.make_up_file_format_mod import make_up_file_format_mod
50
50
 
51
51
  # 移除模块
52
- from podflow.remove.remove_file import remove_file
53
52
  from podflow.remove.remove_dir import remove_dir
53
+ from podflow.remove.remove_file import remove_file
54
54
 
55
55
  # 处理 YouTube 信息模块
56
56
  from podflow.youtube.build import print_fail_youtube
@@ -109,32 +109,27 @@ def main_podcast():
109
109
  # 主流程
110
110
  while parse.update_num > 0 or parse.update_num == -1: # 循环主更新
111
111
  # 主进度条
112
- gVar.index_message["schedule"] = ["准备中", 0]
112
+ progress_update(0, refresh=1)
113
113
  # 暂停进程打印
114
114
  gVar.server_process_print_flag[0] = "pause"
115
115
  # 获取YouTube cookie
116
116
  gVar.youtube_cookie = get_youtube_cookie(gVar.channelid_youtube_ids_original)
117
- gVar.index_message["schedule"][1] = 0.01 + random.uniform(0, 0.0049)
117
+ progress_update(0.01 ,num=0.0049)
118
118
  # 更新哔哩哔哩data
119
119
  gVar.channelid_bilibili_ids, gVar.bilibili_data = get_bilibili_data(
120
120
  gVar.channelid_bilibili_ids_original
121
121
  )
122
- gVar.index_message["schedule"][1] = 0.02 + random.uniform(0, 0.0049)
122
+ progress_update(0.02, num=0.0049)
123
123
  # 恢复进程打印
124
124
  bottle_app_instance.cherry_print()
125
125
  # 获取原始xml字典和rss文本
126
- (
127
- gVar.xmls_original,
128
- gVar.hash_rss_original,
129
- gVar.xmls_original_fail,
130
- gVar.xmls_quantity,
131
- ) = get_original_rss()
132
- gVar.index_message["schedule"][1] = 0.025 + random.uniform(0, 0.0024)
126
+ gVar.xmls_original, gVar.hash_rss_original, gVar.xmls_original_fail = get_original_rss()
127
+ progress_update(0.025, num=-0.0024)
133
128
  # 暂停进程打印
134
129
  gVar.server_process_print_flag[0] = "pause"
135
130
  # 连接上传服务器
136
131
  upload_url = connect_upload_server()
137
- gVar.index_message["schedule"][1] = 0.03 + random.uniform(0, 0.0024)
132
+ progress_update(0.03, num=0.0024)
138
133
  # 恢复进程打印
139
134
  bottle_app_instance.cherry_print()
140
135
  # 登陆上传服务器
@@ -144,20 +139,20 @@ def main_podcast():
144
139
  gVar.config["upload"] = False
145
140
  else:
146
141
  gVar.config["upload"] = False
147
- gVar.index_message["schedule"][1] = 0.035 + random.uniform(0, 0.0024)
142
+ progress_update(0.035, num=0.0024)
148
143
  # 初始化原始上传信息
149
144
  get_upload_original()
150
- gVar.index_message["schedule"][1] = 0.04
145
+ progress_update(0.04)
151
146
  # 更新Youtube和哔哩哔哩频道xml
152
147
  update_youtube_bilibili_rss()
153
- gVar.index_message["schedule"][1] = 0.1
148
+ progress_update(0.1)
154
149
  # 判断是否有更新内容
155
150
  if gVar.channelid_youtube_ids_update or gVar.channelid_bilibili_ids_update:
156
151
  gVar.update_generate_rss = True
157
152
  if gVar.update_generate_rss:
158
153
  # 根据日出日落修改封面(只适用原封面)
159
154
  channge_icon()
160
- gVar.index_message["schedule"][1] = 0.11 + random.uniform(0, 0.0049)
155
+ progress_update(0.11, num=0.0049)
161
156
  # 输出需要更新的信息
162
157
  update_information_display(
163
158
  gVar.channelid_youtube_ids_update,
@@ -171,12 +166,12 @@ def main_podcast():
171
166
  gVar.bilibili_content_bvid_backward_update,
172
167
  "BiliBili",
173
168
  )
174
- gVar.index_message["schedule"][1] = 0.12
169
+ progress_update(0.12)
175
170
  # 暂停进程打印
176
171
  gVar.server_process_print_flag[0] = "pause"
177
172
  # 获取视频格式信息
178
173
  get_video_format()
179
- gVar.index_message["schedule"][1] = 0.199
174
+ progress_update(0.199)
180
175
  # 恢复进程打印
181
176
  bottle_app_instance.cherry_print()
182
177
  # 优化下载顺序
@@ -184,63 +179,63 @@ def main_podcast():
184
179
  # 删除中断下载的媒体文件
185
180
  if gVar.config["delete_incompletement"]:
186
181
  delete_part(gVar.channelid_youtube_ids | gVar.channelid_bilibili_ids)
187
- gVar.index_message["schedule"] = ["构建中", 0.20]
182
+ progress_update(0.20, refresh=2)
188
183
  # 暂停进程打印
189
184
  gVar.server_process_print_flag[0] = "pause"
190
185
  # 下载并构建YouTube和哔哩哔哩视频
191
186
  download_and_build()
192
- gVar.index_message["schedule"][1] = 0.8
187
+ progress_update(0.8)
193
188
  # 添加新媒体至上传列表
194
189
  add_upload()
195
- gVar.index_message["schedule"][1] = 0.81 + random.uniform(0, 0.0049)
190
+ progress_update(0.81, num=0.0049)
196
191
  # 恢复进程打印
197
192
  bottle_app_instance.cherry_print()
198
193
  # 打印无法保留原节目信息
199
194
  original_rss_fail_print(gVar.xmls_original_fail)
200
- gVar.index_message["schedule"][1] = 0.82 + random.uniform(0, 0.0049)
195
+ progress_update(0.82, num=0.0049)
201
196
  # 打印无法获取youtube信息
202
197
  print_fail_youtube()
203
- gVar.index_message["schedule"][1] = 0.83 + random.uniform(0, 0.0049)
198
+ progress_update(0.83, num=0.0049)
204
199
  if gVar.config["remove_media"]:
205
200
  # 删除不在rss中的媒体文件
206
201
  remove_file()
207
202
  # 删除已抛弃的媒体文件夹
208
203
  remove_dir()
209
- gVar.index_message["schedule"][1] = 0.84
204
+ progress_update(0.84)
210
205
  # 补全缺失媒体文件到字典
211
206
  make_up_file()
212
- gVar.index_message["schedule"][1] = 0.85
207
+ progress_update(0.85)
213
208
  # 按参数获取需要补全的最大个数
214
209
  gVar.make_up_file_format = split_dict(
215
210
  gVar.make_up_file_format,
216
211
  gVar.config["completion_count"],
217
212
  True,
218
213
  )[0]
219
- gVar.index_message["schedule"][1] = 0.86 + random.uniform(0, 0.0049)
214
+ progress_update(0.86, num=0.0049)
220
215
  # 暂停进程打印
221
216
  gVar.server_process_print_flag[0] = "pause"
222
217
  # 补全在rss中缺失的媒体格式信息
223
218
  make_up_file_format_mod()
224
- gVar.index_message["schedule"][1] = 0.90 + random.uniform(0, 0.0049)
219
+ progress_update(0.90, num=0.0049)
225
220
  # 恢复进程打印
226
221
  bottle_app_instance.cherry_print()
227
- gVar.index_message["schedule"][1] = 0.91 + random.uniform(0, 0.0049)
222
+ progress_update(0.91, num=0.0049)
228
223
  # 删除无法补全的媒体
229
224
  del_makeup_format_fail()
230
- gVar.index_message["schedule"][1] = 0.92 + random.uniform(0, 0.0049)
225
+ progress_update(0.92, num=0.0049)
231
226
  # 暂停进程打印
232
227
  gVar.server_process_print_flag[0] = "pause"
233
228
  # 保存rss文件模块
234
229
  save_rss()
235
- gVar.index_message["schedule"][1] = 0.93 + random.uniform(0, 0.0049)
230
+ progress_update(0.93, num=0.0049)
236
231
  # 下载补全Youtube和哔哩哔哩视频模块
237
232
  make_up_file_mod()
238
- gVar.index_message["schedule"][1] = 0.99 + random.uniform(0, 0.0099)
233
+ progress_update(0.99, num=0.0099)
239
234
  # 恢复进程打印
240
235
  bottle_app_instance.cherry_print()
241
236
  # 更新并保存上传列表
242
237
  update_upload()
243
- gVar.index_message["schedule"] = ["已完成", 1]
238
+ progress_update(1, refresh=3)
244
239
  else:
245
240
  time_print("频道无更新内容")
246
241
  # 清空变量内数据
@@ -3,6 +3,7 @@
3
3
 
4
4
  import os
5
5
  from podflow import gVar
6
+ from podflow.httpfs.progress_bar import progress_bar
6
7
 
7
8
 
8
9
  # 补全缺失媒体文件到字典模块
@@ -36,8 +37,7 @@ def make_up_file():
36
37
  video_id_format["quality"] = video_quality
37
38
  gVar.make_up_file_format[main] = video_id_format
38
39
  # 更新进度条
39
- ratio = gVar.index_message["schedule"][1] + ratio_part
40
- gVar.index_message["schedule"][1] = ratio
40
+ progress_bar(ratio_part, 0.85)
41
41
 
42
42
  for output_dir, name in channelid_bilibili_ids.items():
43
43
  bilibili_os_list = os.listdir(f"channel_audiovisual/{output_dir}")
@@ -61,7 +61,4 @@ def make_up_file():
61
61
  video_id_format["quality"] = video_quality
62
62
  gVar.make_up_file_format[main] = video_id_format
63
63
  # 更新进度条
64
- ratio = gVar.index_message["schedule"][1] + ratio_part
65
- if ratio > 0.85:
66
- ratio = 0.85
67
- gVar.index_message["schedule"][1] = ratio
64
+ progress_bar(ratio_part, 0.85)
@@ -29,7 +29,7 @@ def create_main_rss():
29
29
  }
30
30
  all_channelid = list(gVar.all_items.keys())
31
31
 
32
- ratio_part = 0.6 / len(all_channelid) if all_channelid else 0
32
+ ratio_part = 0.6 / sum(gVar.xmls_quantity.values()) if all_channelid else 0
33
33
 
34
34
  while all_channelid:
35
35
  for index, output_dir in enumerate(all_channelid):
@@ -39,7 +39,7 @@ def create_main_rss():
39
39
  if output_dir in channelid_youtube_ids:
40
40
  output_dir_youtube = channelid_youtube_ids[output_dir]
41
41
  channelid_youtube_value = gVar.channelid_youtube[output_dir_youtube]
42
- items = youtube_xml_items(output_dir)
42
+ items = youtube_xml_items(output_dir, [ratio_part, 0.8])
43
43
  items["DisplayRSSaddress"] = channelid_youtube_value[
44
44
  "DisplayRSSaddress"
45
45
  ]
@@ -56,7 +56,7 @@ def create_main_rss():
56
56
  channelid_bilibili_value = gVar.channelid_bilibili[
57
57
  output_dir_bilibili
58
58
  ]
59
- items = bilibili_xml_items(output_dir)
59
+ items = bilibili_xml_items(output_dir, [ratio_part, 0.8])
60
60
  items["DisplayRSSaddress"] = channelid_bilibili_value[
61
61
  "DisplayRSSaddress"
62
62
  ]
@@ -68,10 +68,5 @@ def create_main_rss():
68
68
  "bilibili", items["items"]
69
69
  )
70
70
  gVar.all_items[output_dir] = items
71
- # 主进度条更新
72
- ratio = gVar.index_message["schedule"][1] + ratio_part
73
- if ratio > 0.8:
74
- ratio = 0.8
75
- gVar.index_message["schedule"][1] = ratio
76
71
  del all_channelid[index]
77
72
  break
@@ -30,7 +30,6 @@ def rss_create_hash(data):
30
30
  # 获取原始xml模块
31
31
  def get_original_rss():
32
32
  xmls_original_fail = []
33
- xmls_quantity = {}
34
33
  # 获取原始总xml文件
35
34
  try:
36
35
  with open(
@@ -62,21 +61,9 @@ def get_original_rss():
62
61
  f"<!-- {{{channelid_key}}} -->\n"
63
62
  )[1]
64
63
  get_xmls_original[channelid_key] = get_xmls_original_key
65
- xmls_quantity[channelid_key] = {
66
- "original": len(
67
- get_xmls_original_key.split(f"<!-- {channelid_key} -->")
68
- )
69
- }
70
64
  except FileNotFoundError: # 文件不存在直接更新
71
65
  xmls_original_fail.append(channelid_key)
72
- xmls_quantity[channelid_key] = {"original": 0}
73
- else:
74
- xmls_quantity[channelid_key] = {
75
- "original": len(
76
- get_xmls_original[channelid_key].split(f"<!-- {channelid_key} -->")
77
- )
78
- }
79
66
  # 生成原始rss的哈希值
80
67
  hash_rss_original = rss_create_hash(rss_original)
81
68
 
82
- return get_xmls_original, hash_rss_original, xmls_original_fail, xmls_quantity
69
+ return get_xmls_original, hash_rss_original, xmls_original_fail
@@ -3,6 +3,7 @@
3
3
 
4
4
  from podflow import gVar
5
5
  from podflow.basic.write_log import write_log
6
+ from podflow.httpfs.progress_bar import progress_bar
6
7
  from podflow.message.media_format import media_format
7
8
 
8
9
 
@@ -107,7 +108,4 @@ def get_youtube_and_bilibili_video_format(
107
108
  del gVar.video_id_update_format[id_num]
108
109
  with ratio_part_lock:
109
110
  # 主进度条更新
110
- ratio = gVar.index_message["schedule"][1] + ratio_part
111
- if ratio > 0.199:
112
- ratio = 0.199
113
- gVar.index_message["schedule"][1] = ratio
111
+ progress_bar(ratio_part, 0.199)
@@ -10,18 +10,10 @@ from podflow.basic.time_print import time_print
10
10
  def optimize_download():
11
11
  xmls_quantity = gVar.xmls_quantity
12
12
  video_id_update_format = gVar.video_id_update_format
13
- channel_sums = {}
14
13
  sorted_video_id_update_format = {}
15
- time_print("开始计算频道媒体数量")
16
- # 计算每个频道的总和
17
- for channel_id, values in xmls_quantity.items():
18
- total = values["original"] + values["update"] + values["backward"]
19
- channel_sums[channel_id] = total
20
- gVar.xmls_quantity[channel_id]["total"] = total
21
- time_print("开始对频道进行排序")
22
- # 按总和从大到小排序
23
- sorted_channels = sorted(channel_sums.items(), key=lambda x: x[1], reverse=True)
24
14
  time_print("开始优化下载顺序")
15
+ # 按总和从大到小排序
16
+ sorted_channels = sorted(xmls_quantity.items(), key=lambda x: x[1], reverse=True)
25
17
  # 根据总和排序数据
26
18
  for channel_id, _ in sorted_channels:
27
19
  for key, value in video_id_update_format.items():
@@ -9,6 +9,7 @@ from podflow.basic.write_log import write_log
9
9
  from podflow.youtube.get import youtube_rss_update
10
10
  from podflow.basic.folder_build import folder_build
11
11
  from podflow.bilibili.get import bilibili_rss_update
12
+ from podflow.httpfs.progress_bar import progress_bar
12
13
 
13
14
 
14
15
  # 更新Youtube和哔哩哔哩频道xml多线程模块
@@ -115,8 +116,7 @@ def update_youtube_bilibili_rss():
115
116
  del gVar.channelid_youtube_ids[youtube_key]
116
117
  write_log(f"YouTube频道 {youtube_value} 无法更新")
117
118
  # 更新进度条
118
- ratio = gVar.index_message["schedule"][1] + ratio_part
119
- gVar.index_message["schedule"][1] = ratio
119
+ progress_bar(ratio_part, 0.1)
120
120
 
121
121
  # 更新哔哩哔哩频道
122
122
  for bilibili_key, bilibili_value in gVar.channelid_bilibili_ids.copy().items():
@@ -136,7 +136,4 @@ def update_youtube_bilibili_rss():
136
136
  # 构建频道文件夹
137
137
  folder_build(bilibili_key, "channel_audiovisual")
138
138
  # 更新进度条
139
- ratio = gVar.index_message["schedule"][1] + ratio_part
140
- if ratio > 0.1:
141
- ratio = 0.1
142
- gVar.index_message["schedule"][1] = ratio
139
+ progress_bar(ratio_part, 0.1)