podflow 20250526__py3-none-any.whl → 20250604__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.
@@ -328,14 +328,14 @@ class bottle_app:
328
328
  self.print_out("login", 401)
329
329
  return {
330
330
  "code": -2,
331
- "message": "Username Error",
331
+ "message": "Username Error", # 用户名错误
332
332
  }
333
333
  # 验证密码是否正确
334
334
  if upload_data[username] != password:
335
335
  self.print_out("login", 401)
336
336
  return {
337
337
  "code": -3,
338
- "message": "Password Error",
338
+ "message": "Password Error", # 密码错误
339
339
  }
340
340
  # 从请求中获取上传的文件对象
341
341
  upload_file = request.files.get("file")
@@ -345,7 +345,7 @@ class bottle_app:
345
345
  self.print_out("upload", 404)
346
346
  return {
347
347
  "code": -4,
348
- "message": "No File Provided",
348
+ "message": "No File Provided", # 没有上传文件
349
349
  }
350
350
  # 判断文件是否完整
351
351
  uploadfile = upload_file.file
@@ -355,7 +355,7 @@ class bottle_app:
355
355
  self.print_out("upload", 401)
356
356
  return {
357
357
  "code": -5,
358
- "message": "Incomplete File",
358
+ "message": "Incomplete File", # 文件不完整
359
359
  "hash": uploadfile_hash,
360
360
  }
361
361
  if not channelid:
@@ -363,7 +363,7 @@ class bottle_app:
363
363
  self.print_out("upload", 404)
364
364
  return {
365
365
  "code": -6,
366
- "message": "ChannelId Does Not Exist",
366
+ "message": "ChannelId Does Not Exist", # 频道ID不存在
367
367
  }
368
368
  # 获取上传文件的原始文件名
369
369
  filename = upload_file.filename
@@ -373,7 +373,7 @@ class bottle_app:
373
373
  self.print_out("upload", 404)
374
374
  return {
375
375
  "code": -6,
376
- "message": "File Format Error",
376
+ "message": "File Format Error", # 文件格式错误
377
377
  }
378
378
  address = f"channel_audiovisual/{channelid}"
379
379
  if os.path.exists(address):
@@ -391,7 +391,7 @@ class bottle_app:
391
391
  self.print_out("upload", 200)
392
392
  return {
393
393
  "code": 1,
394
- "message": "The Same File Exists",
394
+ "message": "The Same File Exists", # 相同文件已存在
395
395
  "data": {
396
396
  "filename": filename,
397
397
  },
@@ -405,7 +405,7 @@ class bottle_app:
405
405
  self.print_out("upload", 200)
406
406
  return {
407
407
  "code": 0,
408
- "message": "Upload Success",
408
+ "message": "Upload Success", # 上传成功
409
409
  "data": {
410
410
  "filename": filename,
411
411
  },
@@ -148,7 +148,12 @@ error_reason = [
148
148
  r"Offline.",
149
149
  "\033[31m直播已停止\033[0m",
150
150
  "text",
151
- ]
151
+ ],
152
+ [
153
+ r"Got error: \<urllib3\.connection\.HTTPSConnection object at .{18}\>: Failed to resolve \'rr5---sn-a5msenek\.googlevideo\.com\' \(\[Errno 11001\] getaddrinfo failed\)",
154
+ "\033[31m无法解析\033[0m",
155
+ "regexp",
156
+ ],
152
157
  ]
153
158
 
154
159
 
@@ -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.bilibili.get import get_bilibili_cid
6
7
  from podflow.httpfs.progress_bar import progress_bar
7
8
  from podflow.message.media_format import media_format
8
9
 
@@ -63,7 +64,11 @@ def get_youtube_and_bilibili_video_format(
63
64
  id_update_format = f"\033[31m{fail_info}\033[0m(需要Cookies)"
64
65
  break
65
66
  else:
66
- if gVar.video_id_update_format[id_num]["power"] is True and (
67
+ if gVar.channelid_bilibili[gVar.video_id_update_format[id_num]["name"]]["AllPartGet"]:
68
+ power = gVar.video_id_update_format[id_num]["power"]
69
+ else:
70
+ power = get_bilibili_cid(id_num, gVar.video_id_update_format[id_num]["name"])[2]
71
+ if power is True and (
67
72
  "试看" in id_update_format or id_update_format == "无法获取音频ID"
68
73
  ):
69
74
  id_update_format = "\033[31m充电专属\033[0m"
@@ -2,10 +2,15 @@
2
2
  # coding: utf-8
3
3
 
4
4
  import time
5
+ from datetime import datetime
6
+ from podflow import gVar
7
+ from podflow.httpfs.to_html import ansi_to_html
5
8
  from podflow.upload.build_hash import build_hash
6
9
  from podflow.basic.http_client import http_client
10
+ from podflow.httpfs.app_bottle import bottle_app_instance
7
11
 
8
12
 
13
+ # 上传文件模块
9
14
  def upload_file(username, password, channelid, filename):
10
15
  filename = f"channel_audiovisual/{channelid}/{filename}"
11
16
  with open(filename, "rb") as file:
@@ -25,12 +30,13 @@ def upload_file(username, password, channelid, filename):
25
30
  mode="post",
26
31
  file=file,
27
32
  ):
28
- return response.json()
33
+ return response.json(), hashs
29
34
  else:
30
- return None
31
- return None
35
+ return None, hashs
36
+ return None, hashs
32
37
 
33
38
 
39
+ # 查找位置模块
34
40
  def find_media_index(upload_original, target_media_id):
35
41
  for index, item in enumerate(upload_original):
36
42
  if item.get("media_id") == target_media_id:
@@ -38,6 +44,7 @@ def find_media_index(upload_original, target_media_id):
38
44
  return -1
39
45
 
40
46
 
47
+ # 过滤和排序媒体模块
41
48
  def filter_and_sort_media(media_list, day):
42
49
  current_time = int(time.time())
43
50
  one_month_ago = current_time - day * 24 * 60 * 60 # 30天前的时间戳
@@ -56,3 +63,30 @@ def filter_and_sort_media(media_list, day):
56
63
  for item in filtered_sorted
57
64
  ]
58
65
  return result
66
+
67
+
68
+ def record_upload(username, password, channelid, filename):
69
+ response, hashs = upload_file(username, password, channelid, filename)
70
+ channelname = (
71
+ gVar.channelid_youtube_ids_original | gVar.channelid_bilibili_ids_original
72
+ ).get(channelid, "")
73
+ now_time = datetime.now().strftime("%H:%M:%S")
74
+ if response:
75
+ code = response.get("code")
76
+ data = response.get("data", {})
77
+ message = response.get("message", "")
78
+ if code in [0, 1]:
79
+ index = find_media_index(gVar.upload_original, filename)
80
+ if index != -1:
81
+ filename = data.get("filename")
82
+ if filename:
83
+ gVar.upload_original[index]["upload"] = True
84
+ gVar.upload_original[index]["hash"] = hashs
85
+ gVar.upload_original[index]["filename"] = hashs
86
+
87
+ bottle_text = f"{now_time}|{channelname}/{filename} Upload: {message}"
88
+ else:
89
+ bottle_text = f"{now_time}|{channelname}/{filename} Upload Failed"
90
+ bottle_app_instance.bottle_print.append(bottle_text)
91
+ gVar.index_message["http"].append(ansi_to_html(bottle_text))
92
+ bottle_app_instance.cherry_print(False)
podflow/youtube/build.py CHANGED
@@ -47,8 +47,8 @@ def get_youtube_introduction():
47
47
  ).group()
48
48
  else:
49
49
  xml_tree = {"introduction": False}
50
- with youtube_xml_get_lock:
51
- gVar.youtube_xml_get_tree[output_dir] = xml_tree
50
+ with youtube_xml_get_lock:
51
+ gVar.youtube_xml_get_tree[output_dir] = xml_tree
52
52
  # 创建线程列表
53
53
  youtube_xml_get_threads = []
54
54
  for output_dir in gVar.channelid_youtube_ids_update:
@@ -187,7 +187,6 @@ def get_xml_item(guid, item, channelid_title, title_change, output_dir):
187
187
  # 生成YouTube对应channel的需更新的items模块
188
188
  def youtube_xml_items(output_dir, ratio_part):
189
189
  items_list = [f"<!-- {output_dir} -->"]
190
- entry_num = 0
191
190
  original_judgment = True
192
191
  channelid_youtube_value = gVar.channelid_youtube[
193
192
  gVar.channelid_youtube_ids[output_dir]
@@ -227,6 +226,7 @@ def youtube_xml_items(output_dir, ratio_part):
227
226
  else:
228
227
  file_xml = output_dir_value["content"]
229
228
  entrys = re.findall(r"<entry>.+?</entry>", file_xml, re.DOTALL)
229
+ entry_num = 0
230
230
  for entry in entrys:
231
231
  if (
232
232
  re.search(r"(?<=<yt:videoId>).+(?=</yt:videoId>)", entry).group()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: podflow
3
- Version: 20250526
3
+ Version: 20250604
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
@@ -40,7 +40,7 @@ podflow/download/show_progress.py,sha256=y46chchUC9eZCg4ZdNMFnx_bXJQV_IUq15jVzZt
40
40
  podflow/download/wait_animation.py,sha256=AUTvszXF89QA7XYjocFIauPKV7Qj8cFqry44teClaLQ,1314
41
41
  podflow/download/youtube_and_bilibili_download.py,sha256=VCEhz6pGXFWXusdbGWqkCzi4f4VsKQVn6sZz1pfGsns,1335
42
42
  podflow/httpfs/__init__.py,sha256=BxEXkufjcx-a0F7sDVXo65hmyANqCCbZUd6EH9i8T2c,45
43
- podflow/httpfs/app_bottle.py,sha256=A-EZuuY1Xlpuu0_kQSeRgswhLbGw9J_3BbxuO8L2nZg,21305
43
+ podflow/httpfs/app_bottle.py,sha256=UhUIpkI4afz6fXrvXH8a-hYBmjXH8WJuNIcvnCtSIrQ,21465
44
44
  podflow/httpfs/browser.py,sha256=BJ4Xkfiki_tDr0Sc9RqAcEfIVpkAZ3RFOwo0aMHlY3U,197
45
45
  podflow/httpfs/download_bar.py,sha256=0n3HATEO3pdsIpx-E_IZG9OlXa6u-9SeBCoZVgUutyc,965
46
46
  podflow/httpfs/get_channelid.py,sha256=gcwy4IVHBWNQz7qPCpjwiAklGFLRGzvM33-UZz7oFvo,2296
@@ -56,13 +56,13 @@ podflow/message/__init__.py,sha256=pZkcrrtkdtxgMriEHBZ0_rptKaQrQeMPJvPSaoI1Awo,4
56
56
  podflow/message/backup_zip_save.py,sha256=c81jnx8IxHjTcO7G0OUAppawpBIPxa9wgkj9AQhqeJc,1864
57
57
  podflow/message/create_main_rss.py,sha256=kW2QvJhxl2ZcqGV-M-OztlOaQ27ODuQxADeP8poymBQ,3118
58
58
  podflow/message/display_qrcode_and_url.py,sha256=VqmRkDYYG03VihfW4SAU49HJVmfqWbLTgMxqCaREeCo,1037
59
- podflow/message/fail_message_initialize.py,sha256=UPHYNErD2hnzm2WFlNqghBRDCw_sf_3EagAF5LiO9wk,6462
59
+ podflow/message/fail_message_initialize.py,sha256=OlkPQUU2qgTJ-wcFhyGiTAeoY0qy_eOOQGkA0PtyxHQ,6711
60
60
  podflow/message/format_time.py,sha256=gveNh4FGeS3ytwDyYB-h12d1_Km6XoX7WSPcFmDfCBk,909
61
61
  podflow/message/get_media_name.py,sha256=5ULPQOQCZ2-lxdkILwlBP-ItzdFEgvEAKxeLtplACbQ,861
62
62
  podflow/message/get_original_rss.py,sha256=Bzy-Fs1vZEjwvQq6D6xp-2IUidliSyaL1P4WtkLJaRg,2450
63
63
  podflow/message/get_video_format.py,sha256=bPetnFwQlhIO9do_nq3B4AwHQRxFn6SDYvFItjwEx0o,5324
64
64
  podflow/message/get_video_format_multithread.py,sha256=tbgQDMpcntulrbmXBbKL4iVr4t_9evGsuMOIZLoLebI,1615
65
- podflow/message/get_youtube_and_bilibili_video_format.py,sha256=LKer75ZhVDvFLd7aMOrr-9UPKIVpCEPkeIhdlmP_xu4,4633
65
+ podflow/message/get_youtube_and_bilibili_video_format.py,sha256=FACn7IYWTzMHvgNcv8DiUs9CrfoRvLz_9EBjrCxT_9A,4911
66
66
  podflow/message/media_format.py,sha256=Q4WoML4UqL0Ry-QN8DHFJqOQ2tXcFN6u5hmhdSLdP1g,7346
67
67
  podflow/message/optimize_download.py,sha256=-6YritASap8Dp0HqDuvn-kyeamAfw8UjnR-_5S0DbYw,1034
68
68
  podflow/message/original_rss_fail_print.py,sha256=7HM5Gwi3GqBIg2dtTTDlN_FRgZZjYv6ejizS3tDiePE,502
@@ -98,14 +98,14 @@ podflow/upload/linked_server.py,sha256=h-qSx13fP8_Ny2IKW3wCNPwqRqW6-Iz1pqxD9ga9-
98
98
  podflow/upload/login.py,sha256=85sqr12T-3NH-TD3kAMzy4yb1KOheV3Tr0eGee7NCJo,4007
99
99
  podflow/upload/time_key.py,sha256=6jZ3cxUjzj_umYDwH27R0YNZlLXxfhNp-CqV_K22wlo,967
100
100
  podflow/upload/update_upload.py,sha256=_5tp1zPNsC9DdDnLzm-P8bLcOBuDov4eMRHp_861j80,3183
101
- podflow/upload/upload_files.py,sha256=5QZUjnfH3kVTfKCo0673j19bh00JLTyA92TLAN9oVfU,1634
101
+ podflow/upload/upload_files.py,sha256=f6ME5t4shs1XB_aqO5tFYbJNqEOTzGkceZ2dF1m7cl4,3072
102
102
  podflow/upload/upload_server.py,sha256=BFq3QrWE7U97LbC4EQiDhQXbLapEc4R00eRDBH12E6A,565
103
103
  podflow/youtube/__init__.py,sha256=pgXod8gq0IijZxIkPSwgAOcb9JI5rd1mqMomoR7bcJ4,46
104
- podflow/youtube/build.py,sha256=67m74rQOrvqU6ZZybP85ORpg3pOCkpoikttBbtO_PxY,12315
104
+ podflow/youtube/build.py,sha256=j6SVq3HFFGlNNqRrHfnBIThdzsH88PFmwLnejosif1U,12311
105
105
  podflow/youtube/get.py,sha256=oO32GjTFvUgP5AfFX5AlIuXU2UT6QtOUOXWLFzi8XtI,17157
106
106
  podflow/youtube/login.py,sha256=KYl--ya6Z1u0uIcOp9l8i3DIIj9hsYUDH4dtJjI0MLM,1295
107
- podflow-20250526.dist-info/METADATA,sha256=8mS19fSwTP9cjSRos5EVs8Hcu2bTK_oevMX4wlGUAUw,14195
108
- podflow-20250526.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
109
- podflow-20250526.dist-info/entry_points.txt,sha256=mn7hD_c_dmpKe3XU0KNekheBvD01LhlJ9htY-Df0j2A,131
110
- podflow-20250526.dist-info/top_level.txt,sha256=fUujhhz-RrMI8aGvi-3Ey5y7FQnpOOgoFw9OWM3yLCU,8
111
- podflow-20250526.dist-info/RECORD,,
107
+ podflow-20250604.dist-info/METADATA,sha256=aCN1CEvbSbYV1C3uqV9GJ_D6_Smk29sWzdwyG5R4yeo,14195
108
+ podflow-20250604.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
109
+ podflow-20250604.dist-info/entry_points.txt,sha256=mn7hD_c_dmpKe3XU0KNekheBvD01LhlJ9htY-Df0j2A,131
110
+ podflow-20250604.dist-info/top_level.txt,sha256=fUujhhz-RrMI8aGvi-3Ey5y7FQnpOOgoFw9OWM3yLCU,8
111
+ podflow-20250604.dist-info/RECORD,,