podflow 20250413.3__tar.gz → 20250415__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.
- {podflow-20250413.3 → podflow-20250415}/PKG-INFO +1 -1
- {podflow-20250413.3 → podflow-20250415}/podflow/__init__.py +2 -1
- {podflow-20250413.3 → podflow-20250415}/podflow/basic/time_stamp.py +2 -2
- {podflow-20250413.3 → podflow-20250415}/podflow/bilibili/get.py +17 -2
- {podflow-20250413.3 → podflow-20250415}/podflow/httpfs/to_html.py +10 -11
- {podflow-20250413.3 → podflow-20250415}/podflow/main_podcast.py +19 -8
- {podflow-20250413.3 → podflow-20250415}/podflow/makeup/make_up_file_format_mod.py +2 -4
- {podflow-20250413.3 → podflow-20250415}/podflow/message/backup_zip_save.py +5 -1
- {podflow-20250413.3 → podflow-20250415}/podflow/message/get_original_rss.py +17 -2
- podflow-20250415/podflow/message/optimize_download.py +34 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/update_youtube_bilibili_rss.py +18 -7
- {podflow-20250413.3 → podflow-20250415}/podflow/upload/get_upload_original.py +2 -4
- {podflow-20250413.3 → podflow-20250415}/podflow/upload/linked_client.py +1 -1
- {podflow-20250413.3 → podflow-20250415}/podflow/youtube/get.py +14 -8
- {podflow-20250413.3 → podflow-20250415}/podflow.egg-info/PKG-INFO +1 -1
- {podflow-20250413.3 → podflow-20250415}/podflow.egg-info/SOURCES.txt +1 -0
- {podflow-20250413.3 → podflow-20250415}/setup.py +1 -1
- {podflow-20250413.3 → podflow-20250415}/MANIFEST.in +0 -0
- {podflow-20250413.3 → podflow-20250415}/README.md +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/basic/__init__.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/basic/file_save.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/basic/folder_build.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/basic/get_duration.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/basic/get_file_list.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/basic/get_html_dict.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/basic/http_client.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/basic/list_merge_tidy.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/basic/qr_code.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/basic/split_dict.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/basic/time_format.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/basic/time_print.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/basic/vary_replace.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/basic/write_log.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/bilibili/__init__.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/bilibili/build.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/bilibili/login.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/config/__init__.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/config/build_original.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/config/channge_icon.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/config/correct_channelid.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/config/correct_config.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/config/get_channelid.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/config/get_channelid_id.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/config/get_config.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/download/__init__.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/download/convert_bytes.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/download/delete_part.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/download/dl_aideo_video.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/download/show_progress.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/download/wait_animation.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/download/youtube_and_bilibili_download.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/download_and_build.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/ffmpeg_judge.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/httpfs/__init__.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/httpfs/app_bottle.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/httpfs/browser.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/httpfs/get_channelid.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/httpfs/port_judge.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/main.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/main_upload.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/makeup/__init__.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/makeup/del_makeup_format_fail.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/makeup/make_up_file.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/makeup/make_up_file_mod.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/__init__.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/create_main_rss.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/display_qrcode_and_url.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/fail_message_initialize.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/format_time.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/get_media_name.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/get_video_format.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/get_video_format_multithread.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/get_youtube_and_bilibili_video_format.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/media_format.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/original_rss_fail_print.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/rss_create_hash.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/save_rss.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/title_correction.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/update_information_display.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/want_retry.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/xml_item.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/xml_original_item.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/message/xml_rss.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/netscape/__init__.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/netscape/bulid_netscape.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/netscape/get_cookie_dict.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/parse_arguments.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/remove/__init__.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/remove/remove_dir.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/remove/remove_file.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/repair/__init__.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/repair/reverse_log.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/templates/index.html +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/upload/__init__.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/upload/add_upload.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/upload/build_hash.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/upload/linked_server.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/upload/login.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/upload/time_key.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/upload/update_upload.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/upload/upload_server.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/youtube/__init__.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/youtube/build.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow/youtube/login.py +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow.egg-info/dependency_links.txt +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow.egg-info/entry_points.txt +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow.egg-info/requires.txt +0 -0
- {podflow-20250413.3 → podflow-20250415}/podflow.egg-info/top_level.txt +0 -0
- {podflow-20250413.3 → podflow-20250415}/setup.cfg +0 -0
@@ -107,6 +107,7 @@ class Application_gVar:
|
|
107
107
|
self.hash_rss_original = "" # 原始rss哈希值文本
|
108
108
|
self.xmls_original = {} # 原始xml信息字典
|
109
109
|
self.xmls_original_fail = [] # 未获取原始xml频道列表
|
110
|
+
self.xmls_quantity = {} # xml数量字典
|
110
111
|
self.youtube_xml_get_tree = {} # YouTube频道简介和图标字典
|
111
112
|
self.all_youtube_content_ytid = {} # 所有YouTube视频id字典
|
112
113
|
self.all_bilibili_content_bvid = {} # 所有哔哩哔哩视频id字典
|
@@ -119,7 +120,7 @@ class Application_gVar:
|
|
119
120
|
self.upload_data = {} # 上传用户账号密码字典
|
120
121
|
|
121
122
|
self.shortcuts_url = {} # 输出至shortcut的url字典
|
122
|
-
|
123
|
+
|
123
124
|
self.index_message = { # 图形界面显示信息字典
|
124
125
|
"podflow": [], # 主窗口信息列表
|
125
126
|
"http": [], # httpfs窗口信息列表
|
@@ -4,7 +4,7 @@
|
|
4
4
|
import time
|
5
5
|
import threading
|
6
6
|
import contextlib
|
7
|
-
from
|
7
|
+
from podflow.basic.time_print import time_print
|
8
8
|
from podflow.basic.http_client import http_client
|
9
9
|
|
10
10
|
|
@@ -57,5 +57,5 @@ def time_stamp():
|
|
57
57
|
thread3.join()
|
58
58
|
if time_stamps:
|
59
59
|
return int(sum(time_stamps) / len(time_stamps))
|
60
|
-
|
60
|
+
time_print("\033[31m获取时间戳api失败\033[0m")
|
61
61
|
return round(time.time() * 1000)
|
@@ -318,7 +318,13 @@ def bilibili_json_update(bilibili_key, bilibili_value):
|
|
318
318
|
|
319
319
|
|
320
320
|
# 更新哔哩哔哩频道xml模块
|
321
|
-
def bilibili_rss_update(
|
321
|
+
def bilibili_rss_update(
|
322
|
+
bilibili_key,
|
323
|
+
bilibili_value,
|
324
|
+
ratio_thread,
|
325
|
+
rss_update_lock,
|
326
|
+
):
|
327
|
+
bilibili_content_bvid_backward = [] # 初始化向后更新的内容列表
|
322
328
|
# 获取已下载文件列表
|
323
329
|
bilibili_content_bvid_original = get_file_list(
|
324
330
|
bilibili_key, gVar.channelid_bilibili[bilibili_value]["media"]
|
@@ -352,11 +358,13 @@ def bilibili_rss_update(bilibili_key, bilibili_value):
|
|
352
358
|
"content": bilibili_space,
|
353
359
|
"type": "int",
|
354
360
|
} # 设置为整型内容
|
361
|
+
gVar.xmls_quantity[bilibili_key]["update"] = 0
|
355
362
|
elif bilibili_space is None:
|
356
363
|
gVar.channelid_bilibili_rss[bilibili_key] = {
|
357
364
|
"content": bilibili_space_original,
|
358
365
|
"type": "json",
|
359
366
|
} # 使用原始json内容
|
367
|
+
gVar.xmls_quantity[bilibili_key]["update"] = 0
|
360
368
|
else:
|
361
369
|
gVar.channelid_bilibili_rss[bilibili_key] = {
|
362
370
|
"content": bilibili_space,
|
@@ -369,6 +377,7 @@ def bilibili_rss_update(bilibili_key, bilibili_value):
|
|
369
377
|
bilibili_content_bvid = bilibili_space["list"][
|
370
378
|
: gVar.channelid_bilibili[bilibili_value]["update_size"]
|
371
379
|
]
|
380
|
+
gVar.xmls_quantity[bilibili_key]["update"] = len(bilibili_content_bvid)
|
372
381
|
bilibili_space_new = list_merge_tidy(
|
373
382
|
bilibili_content_bvid, guids
|
374
383
|
) # 合并新内容和原内容
|
@@ -463,7 +472,6 @@ def bilibili_rss_update(bilibili_key, bilibili_value):
|
|
463
472
|
gVar.channelid_bilibili_ids_update[bilibili_key] = (
|
464
473
|
bilibili_value # 标记ID更新
|
465
474
|
)
|
466
|
-
bilibili_content_bvid_backward = [] # 初始化向后更新的内容列表
|
467
475
|
for guid in backward_list:
|
468
476
|
if (
|
469
477
|
guid not in bilibili_content_bvid_original
|
@@ -475,3 +483,10 @@ def bilibili_rss_update(bilibili_key, bilibili_value):
|
|
475
483
|
gVar.bilibili_content_bvid_backward_update[bilibili_key] = (
|
476
484
|
bilibili_content_bvid_backward # 更新最终的向后更新内容
|
477
485
|
)
|
486
|
+
gVar.xmls_quantity[bilibili_key]["backward"] = len(bilibili_content_bvid_backward)
|
487
|
+
# 更新进度条
|
488
|
+
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
|
@@ -16,14 +16,14 @@ def ansi_to_html(ansi_text):
|
|
16
16
|
"\033[35m": "ansi-35m", # 品红
|
17
17
|
"\033[36m": "ansi-36m", # 青色
|
18
18
|
"\033[37m": "ansi-37m", # 白色
|
19
|
-
"\033[90m": "ansi-90m", # 亮黑色
|
20
|
-
"\033[91m": "ansi-91m", # 亮红色
|
21
|
-
"\033[92m": "ansi-92m", # 亮绿色
|
22
|
-
"\033[93m": "ansi-93m", # 亮黄色
|
23
|
-
"\033[94m": "ansi-94m", # 亮蓝色
|
24
|
-
"\033[95m": "ansi-95m", # 亮品红
|
25
|
-
"\033[96m": "ansi-96m", # 亮青色
|
26
|
-
"\033[97m": "ansi-97m", # 亮白色
|
19
|
+
"\033[90m": "ansi-90m", # 亮黑色
|
20
|
+
"\033[91m": "ansi-91m", # 亮红色
|
21
|
+
"\033[92m": "ansi-92m", # 亮绿色
|
22
|
+
"\033[93m": "ansi-93m", # 亮黄色
|
23
|
+
"\033[94m": "ansi-94m", # 亮蓝色
|
24
|
+
"\033[95m": "ansi-95m", # 亮品红
|
25
|
+
"\033[96m": "ansi-96m", # 亮青色
|
26
|
+
"\033[97m": "ansi-97m", # 亮白色
|
27
27
|
"\033[0m": "", # 重置
|
28
28
|
}
|
29
29
|
inside_span = False
|
@@ -46,9 +46,8 @@ def ansi_to_html(ansi_text):
|
|
46
46
|
|
47
47
|
if inside_span:
|
48
48
|
html_output += "</span>"
|
49
|
-
html_output = re.sub(r'^\
|
50
|
-
html_output = re.sub(r'\
|
51
|
-
html_output = re.sub(r' +$', '', html_output)
|
49
|
+
html_output = re.sub(r'^\s', '', html_output)
|
50
|
+
html_output = re.sub(r'\s+$', '', html_output)
|
52
51
|
return html_output
|
53
52
|
|
54
53
|
|
@@ -29,6 +29,7 @@ from podflow.download_and_build import download_and_build
|
|
29
29
|
from podflow.message.save_rss import save_rss
|
30
30
|
from podflow.message.get_original_rss import get_original_rss
|
31
31
|
from podflow.message.get_video_format import get_video_format
|
32
|
+
from podflow.message.optimize_download import optimize_download
|
32
33
|
from podflow.message.original_rss_fail_print import original_rss_fail_print
|
33
34
|
from podflow.message.update_information_display import update_information_display
|
34
35
|
from podflow.message.update_youtube_bilibili_rss import update_youtube_bilibili_rss
|
@@ -122,15 +123,18 @@ def main_podcast():
|
|
122
123
|
# 恢复进程打印
|
123
124
|
bottle_app_instance.cherry_print()
|
124
125
|
# 获取原始xml字典和rss文本
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
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)
|
129
133
|
# 暂停进程打印
|
130
134
|
gVar.server_process_print_flag[0] = "pause"
|
131
135
|
# 连接上传服务器
|
132
136
|
upload_url = connect_upload_server()
|
133
|
-
gVar.index_message["schedule"][1] = 0.
|
137
|
+
gVar.index_message["schedule"][1] = 0.03 + random.uniform(0, 0.0024)
|
134
138
|
# 恢复进程打印
|
135
139
|
bottle_app_instance.cherry_print()
|
136
140
|
# 登陆上传服务器
|
@@ -140,10 +144,10 @@ def main_podcast():
|
|
140
144
|
gVar.config["upload"] = False
|
141
145
|
else:
|
142
146
|
gVar.config["upload"] = False
|
143
|
-
gVar.index_message["schedule"][1] = 0.
|
147
|
+
gVar.index_message["schedule"][1] = 0.035 + random.uniform(0, 0.0024)
|
144
148
|
# 初始化原始上传信息
|
145
149
|
get_upload_original()
|
146
|
-
gVar.index_message["schedule"][1] = 0.
|
150
|
+
gVar.index_message["schedule"][1] = 0.04
|
147
151
|
# 更新Youtube和哔哩哔哩频道xml
|
148
152
|
update_youtube_bilibili_rss()
|
149
153
|
gVar.index_message["schedule"][1] = 0.1
|
@@ -175,6 +179,8 @@ def main_podcast():
|
|
175
179
|
gVar.index_message["schedule"][1] = 0.199
|
176
180
|
# 恢复进程打印
|
177
181
|
bottle_app_instance.cherry_print()
|
182
|
+
# 优化下载顺序
|
183
|
+
optimize_download()
|
178
184
|
# 删除中断下载的媒体文件
|
179
185
|
if gVar.config["delete_incompletement"]:
|
180
186
|
delete_part(gVar.channelid_youtube_ids | gVar.channelid_bilibili_ids)
|
@@ -251,6 +257,7 @@ def main_podcast():
|
|
251
257
|
gVar.hash_rss_original = "" # 原始rss哈希值文本
|
252
258
|
gVar.xmls_original.clear() # 原始xml信息字典
|
253
259
|
gVar.xmls_original_fail.clear() # 未获取原始xml频道列表
|
260
|
+
gVar.xmls_quantity.clear() # xml数量字典
|
254
261
|
gVar.youtube_xml_get_tree.clear() # YouTube频道简介和图标字典
|
255
262
|
gVar.all_youtube_content_ytid.clear() # 所有YouTube视频id字典
|
256
263
|
gVar.all_bilibili_content_bvid.clear() # 所有哔哩哔哩视频id字典
|
@@ -263,10 +270,11 @@ def main_podcast():
|
|
263
270
|
if parse.update_num != -1:
|
264
271
|
parse.update_num -= 1
|
265
272
|
if parse.argument == "a-shell":
|
273
|
+
shortcuts_input = urllib.parse.quote(json.dumps(gVar.shortcuts_url))
|
266
274
|
openserver_process = subprocess.Popen(
|
267
275
|
[
|
268
276
|
"open",
|
269
|
-
f"shortcuts://run-shortcut?name=Podflow&input=text&text={
|
277
|
+
f"shortcuts://run-shortcut?name=Podflow&input=text&text={shortcuts_input}",
|
270
278
|
]
|
271
279
|
)
|
272
280
|
# 延时
|
@@ -281,3 +289,6 @@ def main_podcast():
|
|
281
289
|
# 关闭CherryPy服务器
|
282
290
|
time_print("Podflow运行结束")
|
283
291
|
cherrypy.engine.exit()
|
292
|
+
|
293
|
+
from podflow.basic.file_save import file_save
|
294
|
+
file_save(gVar.video_id_update_format,"video_id_update_format.json")
|
@@ -2,9 +2,9 @@
|
|
2
2
|
# coding: utf-8
|
3
3
|
|
4
4
|
import threading
|
5
|
-
from datetime import datetime
|
6
5
|
from podflow import gVar
|
7
6
|
from podflow.basic.write_log import write_log
|
7
|
+
from podflow.basic.time_print import time_print
|
8
8
|
from podflow.message.media_format import media_format
|
9
9
|
|
10
10
|
|
@@ -74,9 +74,7 @@ def makeup_format(video_id, makeup_format_lock):
|
|
74
74
|
def make_up_file_format_mod():
|
75
75
|
# 判断是否补全
|
76
76
|
if len(gVar.make_up_file_format) != 0:
|
77
|
-
|
78
|
-
f"{datetime.now().strftime('%H:%M:%S')}|补全缺失媒体 \033[34m下载准备中...\033[0m"
|
79
|
-
)
|
77
|
+
time_print("补全缺失媒体 \033[34m下载准备中...\033[0m")
|
80
78
|
# 创建线程锁
|
81
79
|
makeup_format_lock = threading.Lock()
|
82
80
|
# 创建线程列表
|
@@ -5,6 +5,7 @@ import zipfile
|
|
5
5
|
from datetime import datetime
|
6
6
|
from podflow import gVar
|
7
7
|
from podflow.basic.write_log import write_log
|
8
|
+
from podflow.basic.time_print import time_print
|
8
9
|
from podflow.message.rss_create_hash import rss_create_hash
|
9
10
|
|
10
11
|
|
@@ -42,4 +43,7 @@ def backup_zip_save(file_content):
|
|
42
43
|
judging_save = True
|
43
44
|
else:
|
44
45
|
# 如果文件已存在, 输出提示信息
|
45
|
-
|
46
|
+
time_print(
|
47
|
+
f"{file_name_str}已存在于压缩包中, 重试中...",
|
48
|
+
Time=False,
|
49
|
+
)
|
@@ -30,6 +30,7 @@ def rss_create_hash(data):
|
|
30
30
|
# 获取原始xml模块
|
31
31
|
def get_original_rss():
|
32
32
|
xmls_original_fail = []
|
33
|
+
xmls_quantity = {}
|
33
34
|
# 获取原始总xml文件
|
34
35
|
try:
|
35
36
|
with open(
|
@@ -57,11 +58,25 @@ def get_original_rss():
|
|
57
58
|
f"channel_rss/{channelid_key}.xml", "r", encoding="utf-8"
|
58
59
|
) as file: # 打开文件进行读取
|
59
60
|
youtube_rss_original = file.read() # 读取文件内容
|
60
|
-
|
61
|
+
get_xmls_original_key = youtube_rss_original.split(
|
61
62
|
f"<!-- {{{channelid_key}}} -->\n"
|
62
63
|
)[1]
|
64
|
+
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
|
+
}
|
63
70
|
except FileNotFoundError: # 文件不存在直接更新
|
64
71
|
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
|
+
}
|
65
79
|
# 生成原始rss的哈希值
|
66
80
|
hash_rss_original = rss_create_hash(rss_original)
|
67
|
-
|
81
|
+
|
82
|
+
return get_xmls_original, hash_rss_original, xmls_original_fail, xmls_quantity
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# podflow/message/optimize_download.py
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
from podflow import gVar
|
5
|
+
from podflow.basic.write_log import write_log
|
6
|
+
from podflow.basic.time_print import time_print
|
7
|
+
|
8
|
+
|
9
|
+
# 优化下载顺序模块
|
10
|
+
def optimize_download():
|
11
|
+
xmls_quantity = gVar.xmls_quantity
|
12
|
+
video_id_update_format = gVar.video_id_update_format
|
13
|
+
channel_sums = {}
|
14
|
+
sorted_video_id_update_format = {}
|
15
|
+
|
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
|
+
|
22
|
+
# 按总和从大到小排序
|
23
|
+
sorted_channels = sorted(channel_sums.items(), key=lambda x: x[1], reverse=True)
|
24
|
+
|
25
|
+
# 根据总和排序数据
|
26
|
+
for channel_id, _ in sorted_channels:
|
27
|
+
for key, value in video_id_update_format.items():
|
28
|
+
if value["id"] == channel_id:
|
29
|
+
sorted_video_id_update_format[key] = value
|
30
|
+
if len(video_id_update_format) == len(sorted_video_id_update_format):
|
31
|
+
gVar.video_id_update_format = sorted_video_id_update_format
|
32
|
+
time_print("下载顺序优化\033[32m成功\033[0m")
|
33
|
+
else:
|
34
|
+
write_log("下载顺序优化\033[31m失败\033[0m")
|
@@ -13,6 +13,14 @@ from podflow.bilibili.get import bilibili_rss_update
|
|
13
13
|
|
14
14
|
# 更新Youtube和哔哩哔哩频道xml多线程模块
|
15
15
|
def update_youtube_bilibili_rss():
|
16
|
+
if gVar.channelid_youtube_ids or gVar.channelid_bilibili_ids:
|
17
|
+
channelid_quantity = len(gVar.channelid_youtube_ids) + len(gVar.channelid_bilibili_ids)
|
18
|
+
ratio_part = 0.01 / channelid_quantity
|
19
|
+
ratio_thread = 0.05 / channelid_quantity
|
20
|
+
else:
|
21
|
+
ratio_part = 0
|
22
|
+
ratio_thread = 0
|
23
|
+
|
16
24
|
pattern_youtube404 = r"Error 404 \(Not Found\)" # 设置要匹配的正则表达式模式
|
17
25
|
pattern_youtube_error = {
|
18
26
|
"This channel was removed because it violated our Community Guidelines.": "违反社区准则",
|
@@ -26,6 +34,7 @@ def update_youtube_bilibili_rss():
|
|
26
34
|
r"<yt:channelId>(UC)?(.{22})?</yt:channelId>",
|
27
35
|
]
|
28
36
|
youtube_bilibili_rss_update_threads = [] # 创建线程列表
|
37
|
+
rss_update_lock = threading.Lock()
|
29
38
|
# Youtube多线程
|
30
39
|
for youtube_key, youtube_value in gVar.channelid_youtube_ids.items():
|
31
40
|
thread = threading.Thread(
|
@@ -36,6 +45,8 @@ def update_youtube_bilibili_rss():
|
|
36
45
|
pattern_youtube_varys,
|
37
46
|
pattern_youtube404,
|
38
47
|
pattern_youtube_error,
|
48
|
+
ratio_thread,
|
49
|
+
rss_update_lock,
|
39
50
|
),
|
40
51
|
)
|
41
52
|
youtube_bilibili_rss_update_threads.append(thread)
|
@@ -44,7 +55,13 @@ def update_youtube_bilibili_rss():
|
|
44
55
|
# 哔哩哔哩多线程
|
45
56
|
for bilibili_key, bilibili_value in gVar.channelid_bilibili_ids.items():
|
46
57
|
thread = threading.Thread(
|
47
|
-
target=bilibili_rss_update,
|
58
|
+
target=bilibili_rss_update,
|
59
|
+
args=(
|
60
|
+
bilibili_key,
|
61
|
+
bilibili_value,
|
62
|
+
ratio_thread,
|
63
|
+
rss_update_lock,
|
64
|
+
),
|
48
65
|
)
|
49
66
|
youtube_bilibili_rss_update_threads.append(thread)
|
50
67
|
# 开始多线程
|
@@ -61,12 +78,6 @@ def update_youtube_bilibili_rss():
|
|
61
78
|
) in pattern_youtube_error.items():
|
62
79
|
if pattern_youtube_error_key in youtube_content:
|
63
80
|
return pattern_youtube_error_value
|
64
|
-
if gVar.channelid_youtube_ids or gVar.channelid_bilibili_ids:
|
65
|
-
ratio_part = 0.05 / (
|
66
|
-
len(gVar.channelid_youtube_ids) + len(gVar.channelid_bilibili_ids)
|
67
|
-
)
|
68
|
-
else:
|
69
|
-
ratio_part = 0
|
70
81
|
|
71
82
|
# 更新Youtube频道
|
72
83
|
for youtube_key, youtube_value in gVar.channelid_youtube_ids.copy().items():
|
@@ -3,12 +3,12 @@
|
|
3
3
|
|
4
4
|
import re
|
5
5
|
import json
|
6
|
-
from datetime import datetime
|
7
6
|
from collections import Counter
|
8
7
|
from email.utils import parsedate_tz, mktime_tz
|
9
8
|
from podflow import gVar
|
10
9
|
from podflow.basic.file_save import file_save
|
11
10
|
from podflow.basic.write_log import write_log
|
11
|
+
from podflow.basic.time_print import time_print
|
12
12
|
from podflow.message.get_media_name import get_media_name
|
13
13
|
|
14
14
|
|
@@ -41,9 +41,7 @@ def get_upload():
|
|
41
41
|
}
|
42
42
|
# 如果两个计数字典不相等,提示错误
|
43
43
|
if age_counts != xmls_original_counts:
|
44
|
-
|
45
|
-
f"{datetime.now().strftime('%H:%M:%S')}|无法获取完整原始上传信息"
|
46
|
-
)
|
44
|
+
time_print("无法获取完整原始上传信息")
|
47
45
|
# 如果 upload_original 为空
|
48
46
|
else:
|
49
47
|
# 遍历 xmls_original 的每个键值对
|
@@ -5,8 +5,8 @@ import contextlib
|
|
5
5
|
import re
|
6
6
|
import os
|
7
7
|
import threading
|
8
|
-
from datetime import datetime
|
9
8
|
from podflow import gVar
|
9
|
+
from podflow.basic.time_print import time_print
|
10
10
|
from podflow.basic.http_client import http_client
|
11
11
|
from podflow.basic.vary_replace import vary_replace
|
12
12
|
from podflow.basic.get_html_dict import get_html_dict
|
@@ -148,16 +148,12 @@ def get_youtube_html_playlists(
|
|
148
148
|
if fail: # 如果仍然有失败的视频
|
149
149
|
if direction_forward or not videoid_start:
|
150
150
|
for videoid in fail:
|
151
|
-
|
152
|
-
f"{datetime.now().strftime('%H:%M:%S')}|{youtube_value}|{videoid} HTML无法更新, 将不获取"
|
153
|
-
)
|
151
|
+
time_print(f"{youtube_value}|{videoid} HTML无法更新, 将不获取")
|
154
152
|
if videoid in idlist:
|
155
153
|
idlist.remove(videoid) # 安全地移除视频 ID,避免 `ValueError`
|
156
154
|
del item[videoid] # 删除对应的字典项
|
157
155
|
else:
|
158
|
-
|
159
|
-
f"{datetime.now().strftime('%H:%M:%S')}|{youtube_value} HTML有失败只更新部分"
|
160
|
-
)
|
156
|
+
time_print(f"{youtube_value} HTML有失败只更新部分")
|
161
157
|
index = len(idlist)
|
162
158
|
for videoid in fail:
|
163
159
|
if videoid in idlist:
|
@@ -194,6 +190,8 @@ def youtube_rss_update(
|
|
194
190
|
pattern_youtube_varys,
|
195
191
|
pattern_youtube404,
|
196
192
|
pattern_youtube_error,
|
193
|
+
ratio_thread,
|
194
|
+
rss_update_lock,
|
197
195
|
):
|
198
196
|
channelid_youtube = gVar.channelid_youtube
|
199
197
|
channelid_youtube_rss = gVar.channelid_youtube_rss
|
@@ -320,6 +318,7 @@ def youtube_rss_update(
|
|
320
318
|
"update_size"
|
321
319
|
] # 限制视频ID数量
|
322
320
|
]
|
321
|
+
gVar.xmls_quantity[youtube_key]["update"] = len(youtube_content_ytid)
|
323
322
|
youtube_content_new = list_merge_tidy(youtube_content_ytid, guids) # 合并并去重
|
324
323
|
if youtube_content_ytid := [
|
325
324
|
exclude
|
@@ -332,6 +331,7 @@ def youtube_rss_update(
|
|
332
331
|
youtube_content_ytid # 保存更新的视频ID
|
333
332
|
)
|
334
333
|
# 向后更新
|
334
|
+
youtube_content_ytid_backward = []
|
335
335
|
if channelid_youtube[youtube_value]["BackwardUpdate"] and guids:
|
336
336
|
# 计算向后更新的数量
|
337
337
|
backward_update_size = channelid_youtube[youtube_value]["last_size"] - len(
|
@@ -364,7 +364,6 @@ def youtube_rss_update(
|
|
364
364
|
channelid_youtube_rss[youtube_key].update(
|
365
365
|
{"backward": youtube_html_backward_playlists}
|
366
366
|
) # 添加向后更新内容
|
367
|
-
youtube_content_ytid_backward = []
|
368
367
|
youtube_content_ytid_backward.extend(
|
369
368
|
guid
|
370
369
|
for guid in backward_list
|
@@ -374,3 +373,10 @@ def youtube_rss_update(
|
|
374
373
|
gVar.youtube_content_ytid_backward_update[youtube_key] = (
|
375
374
|
youtube_content_ytid_backward # 保存向后更新的ID
|
376
375
|
)
|
376
|
+
gVar.xmls_quantity[youtube_key]["backward"] = len(youtube_content_ytid_backward)
|
377
|
+
# 更新进度条
|
378
|
+
with rss_update_lock:
|
379
|
+
ratio = gVar.index_message["schedule"][1] + ratio_thread
|
380
|
+
if ratio > 0.09:
|
381
|
+
ratio = 0.09
|
382
|
+
gVar.index_message["schedule"][1] = ratio
|
@@ -71,6 +71,7 @@ podflow/message/get_video_format.py
|
|
71
71
|
podflow/message/get_video_format_multithread.py
|
72
72
|
podflow/message/get_youtube_and_bilibili_video_format.py
|
73
73
|
podflow/message/media_format.py
|
74
|
+
podflow/message/optimize_download.py
|
74
75
|
podflow/message/original_rss_fail_print.py
|
75
76
|
podflow/message/rss_create_hash.py
|
76
77
|
podflow/message/save_rss.py
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{podflow-20250413.3 → podflow-20250415}/podflow/message/get_youtube_and_bilibili_video_format.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|