podflow 20250629.1__py3-none-any.whl → 20250701__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.
podflow/main_podcast.py CHANGED
@@ -5,6 +5,7 @@ import sys
5
5
  import json
6
6
  import time
7
7
  import urllib
8
+ import threading
8
9
  import subprocess
9
10
 
10
11
  import cherrypy
@@ -22,18 +23,24 @@ from podflow.httpfs.app_bottle import bottle_app_instance
22
23
 
23
24
  # 下载和视频处理模块
24
25
  from podflow.ffmpeg_judge import ffmpeg_judge
25
- from podflow.run_and_upload import run_and_upload
26
+ from podflow.download.delete_part import delete_part
27
+ from podflow.download_and_build import download_and_build
26
28
 
27
29
  # RSS 和消息处理模块
28
30
  from podflow.message.save_rss import save_rss
29
31
  from podflow.message.get_original_rss import get_original_rss
32
+ from podflow.message.get_video_format import get_video_format
33
+ from podflow.message.optimize_download import optimize_download
30
34
  from podflow.message.original_rss_fail_print import original_rss_fail_print
35
+ from podflow.message.update_information_display import update_information_display
36
+ from podflow.message.update_youtube_bilibili_rss import update_youtube_bilibili_rss
31
37
 
32
38
  # 登录模块
33
39
  from podflow.bilibili.login import get_bilibili_data
34
40
  from podflow.youtube.login import get_youtube_cookie
35
41
 
36
42
  # 配置和图标模块
43
+ from podflow.config.channge_icon import channge_icon
37
44
  from podflow.config.build_original import build_original
38
45
 
39
46
  # 制作和修改文件模块
@@ -53,6 +60,7 @@ from podflow.youtube.build import print_fail_youtube
53
60
  # 长期媒体进行上传模块
54
61
  from podflow.upload.login import login_upload
55
62
  from podflow.upload.add_upload import add_upload
63
+ from podflow.upload.upload_files import all_upload
56
64
  from podflow.upload.update_upload import update_upload
57
65
  from podflow.upload.linked_client import connect_upload_server
58
66
  from podflow.upload.get_upload_original import get_upload_original
@@ -64,17 +72,17 @@ def main_podcast():
64
72
  # 初始化
65
73
  build_original()
66
74
  # http共享
67
- port = gVar.config.get("port", 8000) # 使用 .get 获取端口
75
+ port = gVar.config.get("port", 8000) # 使用 .get 获取端口
68
76
  hostip = "0.0.0.0"
69
77
 
70
- if port_judge(hostip, port): # 假设 port_judge 存在
78
+ if port_judge(hostip, port): # 假设 port_judge 存在
71
79
  # 设置路由 (确保此时 gVar.config 等已就绪)
72
- bottle_app_instance.setup_routes(upload=False) # 或者根据需要设置为 True
80
+ bottle_app_instance.setup_routes(upload=False) # 或者根据需要设置为 True
73
81
 
74
82
  # 设置logname
75
83
  bottle_app_instance.set_logname(
76
84
  logname="httpfs.log",
77
- http_fs=gVar.config.get("httpfs", False), # 使用 .get
85
+ http_fs=gVar.config.get("httpfs", False), # 使用 .get
78
86
  )
79
87
 
80
88
  # 启动 CherryPy 服务器
@@ -91,7 +99,7 @@ def main_podcast():
91
99
  "log.access_file": "", # 关闭访问日志
92
100
  "log.error_file": "", # 关闭错误日志
93
101
  # 添加线程池配置,对于长连接 (SSE) 可能有帮助
94
- 'server.thread_pool': 30 # 示例值,根据需要调整
102
+ "server.thread_pool": 30, # 示例值,根据需要调整
95
103
  }
96
104
  }
97
105
  )
@@ -114,7 +122,7 @@ def main_podcast():
114
122
  gVar.server_process_print_flag[0] = "pause"
115
123
  # 获取YouTube cookie
116
124
  gVar.youtube_cookie = get_youtube_cookie(gVar.channelid_youtube_ids_original)
117
- progress_update(0.01 ,num=0.0049)
125
+ progress_update(0.01, num=0.0049)
118
126
  # 更新哔哩哔哩data
119
127
  gVar.channelid_bilibili_ids, gVar.bilibili_data = get_bilibili_data(
120
128
  gVar.channelid_bilibili_ids_original
@@ -123,7 +131,9 @@ def main_podcast():
123
131
  # 恢复进程打印
124
132
  bottle_app_instance.cherry_print()
125
133
  # 获取原始xml字典和rss文本
126
- gVar.xmls_original, gVar.hash_rss_original, gVar.xmls_original_fail = get_original_rss()
134
+ gVar.xmls_original, gVar.hash_rss_original, gVar.xmls_original_fail = (
135
+ get_original_rss()
136
+ )
127
137
  progress_update(0.025, num=-0.0024)
128
138
  # 暂停进程打印
129
139
  gVar.server_process_print_flag[0] = "pause"
@@ -139,8 +149,55 @@ def main_podcast():
139
149
  # 初始化原始上传信息
140
150
  get_upload_original()
141
151
  progress_update(0.04)
142
- run_and_upload(upload_url)
152
+ # 如果有上传服务器,则启动上传线程
153
+ if upload_url:
154
+ thread_upload = threading.Thread(target=all_upload, args=(upload_url,))
155
+ thread_upload.start()
156
+ # 更新Youtube和哔哩哔哩频道xml
157
+ update_youtube_bilibili_rss()
158
+ progress_update(0.1)
159
+ # 判断是否有更新内容
160
+ if gVar.channelid_youtube_ids_update or gVar.channelid_bilibili_ids_update:
161
+ gVar.update_generate_rss = True
143
162
  if gVar.update_generate_rss:
163
+ # 根据日出日落修改封面(只适用原封面)
164
+ channge_icon()
165
+ progress_update(0.11, num=0.0049)
166
+ # 输出需要更新的信息
167
+ update_information_display(
168
+ gVar.channelid_youtube_ids_update,
169
+ gVar.youtube_content_ytid_update,
170
+ gVar.youtube_content_ytid_backward_update,
171
+ "YouTube",
172
+ )
173
+ update_information_display(
174
+ gVar.channelid_bilibili_ids_update,
175
+ gVar.bilibili_content_bvid_update,
176
+ gVar.bilibili_content_bvid_backward_update,
177
+ "BiliBili",
178
+ )
179
+ progress_update(0.12)
180
+ # 暂停进程打印
181
+ gVar.server_process_print_flag[0] = "pause"
182
+ # 获取视频格式信息
183
+ get_video_format()
184
+ progress_update(0.199)
185
+ # 恢复进程打印
186
+ bottle_app_instance.cherry_print()
187
+ # 优化下载顺序
188
+ optimize_download()
189
+ # 删除中断下载的媒体文件
190
+ if gVar.config["delete_incompletement"]:
191
+ delete_part(gVar.channelid_youtube_ids | gVar.channelid_bilibili_ids)
192
+ progress_update(0.20, refresh=2)
193
+ # 暂停进程打印
194
+ gVar.server_process_print_flag[0] = "pause"
195
+ # 下载并构建YouTube和哔哩哔哩视频
196
+ download_and_build()
197
+ progress_update(0.8)
198
+ # 如果有上传服务器,则等待上传线程完成
199
+ if upload_url:
200
+ thread_upload.join()
144
201
  # 添加新媒体至上传列表
145
202
  add_upload()
146
203
  progress_update(0.81, num=0.0049)
@@ -195,6 +252,10 @@ def main_podcast():
195
252
  # 清理缓存文件
196
253
  remove_flush(upload_url)
197
254
  else:
255
+ # 如果没有更新内容,则停止上传线程
256
+ gVar.upload_stop = True
257
+ if upload_url:
258
+ thread_upload.join()
198
259
  time_print("频道无更新内容")
199
260
  # 清空变量内数据
200
261
  gVar.channelid_youtube_ids_update.clear() # 需更新的YouTube频道字典
@@ -22,15 +22,21 @@ def update_upload():
22
22
  upload_original = gVar.upload_original
23
23
  # 获取所有项目
24
24
  all_items = gVar.all_items
25
+ # 获取原始 XML 数据
26
+ xmls_original = gVar.xmls_original
27
+ # 获取无法更新channel_id
28
+ fail_upload_parts = list(set(xmls_original.keys()) - set(all_items.keys()))
25
29
  # 遍历所有项目,获取每个输出目录的媒体名称
26
30
  for output_dir, items_dict in all_items.items():
27
31
  media_name[output_dir] = get_media_name(items_dict["type"], items_dict["items"])
28
32
  # 遍历原始上传列表,筛选出需要上传的媒体部分
29
33
  for upload_part in upload_original:
30
34
  if (
31
- upload_part["channel_id"] in media_name
32
- and upload_part["media_id"] in media_name[upload_part["channel_id"]]
33
- ):
35
+ (
36
+ upload_part["channel_id"] in media_name
37
+ and upload_part["media_id"] in media_name[upload_part["channel_id"]]
38
+ )
39
+ or upload_part["channel_id"] in fail_upload_parts):
34
40
  main_upload.append(upload_part)
35
41
 
36
42
  # 获取需要上传的媒体部分的ID
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: podflow
3
- Version: 20250629.1
3
+ Version: 20250701
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
@@ -14,7 +14,7 @@ Requires-Python: >=3.8
14
14
  Description-Content-Type: text/markdown
15
15
  Requires-Dist: astral>=3.2
16
16
  Requires-Dist: bottle>=0.13.2
17
- Requires-Dist: yt-dlp>=2025.6.25
17
+ Requires-Dist: yt-dlp>=2025.6.30
18
18
  Requires-Dist: chardet>=5.2.0
19
19
  Requires-Dist: cherrypy>=18.10.0
20
20
  Requires-Dist: pyqrcode>=1.2.1
@@ -2,10 +2,9 @@ podflow/__init__.py,sha256=mquu8BdWK9V4dDObCCfnPodeXOPkz-kj8_RNB7kK3Ys,7628
2
2
  podflow/download_and_build.py,sha256=x7S7N26B1G9Yn2yr7YthDJgKUwEKBLtHBLlaqpofLas,746
3
3
  podflow/ffmpeg_judge.py,sha256=wM49pPXOFwFAA_8TKHal5fV6ka9sAA87yGQMDOssvXo,1340
4
4
  podflow/main.py,sha256=7zWdpw80jqPaYu1Un1nPqaZoiAb7Dqg8zaF-cUioU4c,755
5
- podflow/main_podcast.py,sha256=vV4knnqzHehFjCBFRtAzq8K0xlnkWNGV320tSYDQ09o,10248
5
+ podflow/main_podcast.py,sha256=J2maKB-SRwHhOniVURKyp1zrqE6-ypkTmKQSZy4u6RE,12977
6
6
  podflow/main_upload.py,sha256=xuN15GAXokl2xzZrraLeusevl0j-TnHVziL0wobsBZc,2586
7
7
  podflow/parse_arguments.py,sha256=h3a7EaRZS04kNMFYbxTW9Ch29KgZ7dyS-yqEEt_etQI,2592
8
- podflow/run_and_upload.py,sha256=EtkQtmiqZh8pqXQfQnn6hfjk0T-1wmc0YUFhTOqPRPw,2799
9
8
  podflow/basic/__init__.py,sha256=CAfI6mVQtz7KKbAiTIZ9_IbvaTXeAqxR1U7ov9GDoDo,44
10
9
  podflow/basic/file_save.py,sha256=6vu4EkbsN4df5-ci6sJOgIOUEhh-WaRBOyMJ8rpouXo,1233
11
10
  podflow/basic/folder_build.py,sha256=5oHyfiDcSp2YITXQWIPwriBF9XuU3qs7wZQOWJHYJ1s,546
@@ -100,15 +99,15 @@ podflow/upload/linked_client.py,sha256=NdSi5uh0TbZUhOHbA_mkHo4aIz1XNKoSXHhT4rMRU
100
99
  podflow/upload/linked_server.py,sha256=h-qSx13fP8_Ny2IKW3wCNPwqRqW6-Iz1pqxD9ga9-dM,2308
101
100
  podflow/upload/login.py,sha256=85sqr12T-3NH-TD3kAMzy4yb1KOheV3Tr0eGee7NCJo,4007
102
101
  podflow/upload/time_key.py,sha256=6jZ3cxUjzj_umYDwH27R0YNZlLXxfhNp-CqV_K22wlo,967
103
- podflow/upload/update_upload.py,sha256=_5tp1zPNsC9DdDnLzm-P8bLcOBuDov4eMRHp_861j80,3183
102
+ podflow/upload/update_upload.py,sha256=tolV9WMRFg9KqdGSSC37REBy4N_f-d3GvCihciMlOlg,3456
104
103
  podflow/upload/upload_files.py,sha256=zKMv27cqj7u-c8dHKNZx67UNx0gkMkQAnu2oxnk6a5M,5749
105
104
  podflow/upload/upload_server.py,sha256=BFq3QrWE7U97LbC4EQiDhQXbLapEc4R00eRDBH12E6A,565
106
105
  podflow/youtube/__init__.py,sha256=pgXod8gq0IijZxIkPSwgAOcb9JI5rd1mqMomoR7bcJ4,46
107
106
  podflow/youtube/build.py,sha256=j6SVq3HFFGlNNqRrHfnBIThdzsH88PFmwLnejosif1U,12311
108
107
  podflow/youtube/get.py,sha256=oO32GjTFvUgP5AfFX5AlIuXU2UT6QtOUOXWLFzi8XtI,17157
109
108
  podflow/youtube/login.py,sha256=KYl--ya6Z1u0uIcOp9l8i3DIIj9hsYUDH4dtJjI0MLM,1295
110
- podflow-20250629.1.dist-info/METADATA,sha256=d_skuEp5UWtZo7psoKOfx5716KfNPrnHneH8zO2HdKo,14197
111
- podflow-20250629.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
112
- podflow-20250629.1.dist-info/entry_points.txt,sha256=mn7hD_c_dmpKe3XU0KNekheBvD01LhlJ9htY-Df0j2A,131
113
- podflow-20250629.1.dist-info/top_level.txt,sha256=fUujhhz-RrMI8aGvi-3Ey5y7FQnpOOgoFw9OWM3yLCU,8
114
- podflow-20250629.1.dist-info/RECORD,,
109
+ podflow-20250701.dist-info/METADATA,sha256=8Ea-bk1KpDHAD179t_i8ooFe7KBcMPA--JqBHdvv1Co,14195
110
+ podflow-20250701.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
111
+ podflow-20250701.dist-info/entry_points.txt,sha256=mn7hD_c_dmpKe3XU0KNekheBvD01LhlJ9htY-Df0j2A,131
112
+ podflow-20250701.dist-info/top_level.txt,sha256=fUujhhz-RrMI8aGvi-3Ey5y7FQnpOOgoFw9OWM3yLCU,8
113
+ podflow-20250701.dist-info/RECORD,,
podflow/run_and_upload.py DELETED
@@ -1,77 +0,0 @@
1
- # podflow/run_and_upload.py
2
- # coding: utf-8
3
-
4
- import threading
5
- from podflow import gVar
6
- from podflow.upload.upload_files import all_upload
7
- from podflow.config.channge_icon import channge_icon
8
- from podflow.download.delete_part import delete_part
9
- from podflow.httpfs.progress_bar import progress_update
10
- from podflow.download_and_build import download_and_build
11
- from podflow.httpfs.app_bottle import bottle_app_instance
12
- from podflow.message.get_video_format import get_video_format
13
- from podflow.message.optimize_download import optimize_download
14
- from podflow.message.update_information_display import update_information_display
15
- from podflow.message.update_youtube_bilibili_rss import update_youtube_bilibili_rss
16
-
17
-
18
- def find_and_duild():
19
- # 更新Youtube和哔哩哔哩频道xml
20
- update_youtube_bilibili_rss()
21
- progress_update(0.1)
22
- # 判断是否有更新内容
23
- if gVar.channelid_youtube_ids_update or gVar.channelid_bilibili_ids_update:
24
- gVar.update_generate_rss = True
25
- if gVar.update_generate_rss:
26
- # 根据日出日落修改封面(只适用原封面)
27
- channge_icon()
28
- progress_update(0.11, num=0.0049)
29
- # 输出需要更新的信息
30
- update_information_display(
31
- gVar.channelid_youtube_ids_update,
32
- gVar.youtube_content_ytid_update,
33
- gVar.youtube_content_ytid_backward_update,
34
- "YouTube",
35
- )
36
- update_information_display(
37
- gVar.channelid_bilibili_ids_update,
38
- gVar.bilibili_content_bvid_update,
39
- gVar.bilibili_content_bvid_backward_update,
40
- "BiliBili",
41
- )
42
- progress_update(0.12)
43
- # 暂停进程打印
44
- gVar.server_process_print_flag[0] = "pause"
45
- # 获取视频格式信息
46
- get_video_format()
47
- progress_update(0.199)
48
- # 恢复进程打印
49
- bottle_app_instance.cherry_print()
50
- # 优化下载顺序
51
- optimize_download()
52
- # 删除中断下载的媒体文件
53
- if gVar.config["delete_incompletement"]:
54
- delete_part(gVar.channelid_youtube_ids | gVar.channelid_bilibili_ids)
55
- progress_update(0.20, refresh=2)
56
- # 暂停进程打印
57
- gVar.server_process_print_flag[0] = "pause"
58
- # 下载并构建YouTube和哔哩哔哩视频
59
- download_and_build()
60
- progress_update(0.8)
61
-
62
- # 运行并上传模块
63
- def run_and_upload(upload_url):
64
- if upload_url:
65
- thread_find_and_duild = threading.Thread(target=find_and_duild)
66
- thread_upload = threading.Thread(
67
- target=all_upload,
68
- args=(upload_url,)
69
- )
70
-
71
- thread_find_and_duild.start()
72
- thread_upload.start()
73
-
74
- thread_find_and_duild.join()
75
- thread_upload.join()
76
- else:
77
- find_and_duild()