podflow 20250401.1__py3-none-any.whl → 20250402__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/basic/qr_code.py CHANGED
@@ -3,10 +3,13 @@
3
3
 
4
4
  import math
5
5
  import pyqrcode
6
+ from podflow.httpfs.to_html import qrcode_to_html
6
7
 
7
8
 
8
9
  # 网址二维码模块
9
- def qr_code(data):
10
+ def qr_code(data, to_html=False):
11
+ if to_html:
12
+ qrcode_to_html(data)
10
13
  qr = pyqrcode.create(
11
14
  data,
12
15
  error='L', # 对应于ERROR_CORRECT_L,可选值: 'L','M','Q','H'
@@ -6,15 +6,22 @@ from podflow import gVar
6
6
  from podflow.httpfs.to_html import ansi_to_html
7
7
 
8
8
 
9
- def time_print(text, Top=False, NoEnter=False, Time=True):
9
+ def time_print(text, Top=False, NoEnter=False, Time=True, Url=""):
10
10
  if Time:
11
11
  text = f"{datetime.now().strftime('%H:%M:%S')}|{text}"
12
12
  if Top:
13
13
  text = f"\r{text}"
14
+ if Url:
15
+ text_print = f"{text}\n\033[34m{Url}\033[0m"
16
+ else:
17
+ text_print = f"{text}"
14
18
  if NoEnter:
15
- print(text, end="")
19
+ print(text_print, end="")
16
20
  else:
17
- print(text)
21
+ print(text_print)
22
+
23
+ if Url:
24
+ text = f'{text}<a href="{Url}"><span class="ansi-url">{Url}</span></a>'
18
25
  text = ansi_to_html(text)
19
26
  if not gVar.index_message["enter"] and gVar.index_message["podflow"]:
20
27
  if Top and gVar.index_message["podflow"]:
@@ -1,10 +1,10 @@
1
+
1
2
  # podflow/basic/write_log.py
2
3
  # coding: utf-8
3
4
 
4
5
  import re
5
6
  from datetime import datetime
6
- from podflow import gVar
7
- from podflow.httpfs.to_html import ansi_to_html
7
+ from podflow.basic.time_print import time_print
8
8
 
9
9
 
10
10
  # 日志模块
@@ -15,6 +15,7 @@ def write_log(
15
15
  time_display=True,
16
16
  only_log="",
17
17
  file_name="Podflow.log",
18
+ url=""
18
19
  ):
19
20
  # 获取当前的具体时间
20
21
  current_time = datetime.now()
@@ -36,5 +37,4 @@ def write_log(
36
37
  formatted_time_mini = current_time.strftime("%H:%M:%S")
37
38
  log_print = f"{formatted_time_mini}|{log}" if time_display else f"{log}"
38
39
  log_print = f"{log_print}|{suffix}" if suffix else f"{log_print}"
39
- gVar.index_message["podflow"].append(ansi_to_html(log_print))
40
- print(log_print)
40
+ time_print(log_print, Time=False, Url=url)
@@ -6,7 +6,6 @@ from podflow.basic.qr_code import qr_code
6
6
  from podflow.message.xml_rss import xml_rss
7
7
  from podflow.basic.file_save import file_save
8
8
  from podflow.basic.write_log import write_log
9
- from podflow.httpfs.to_html import qrcode_to_html
10
9
  from podflow.message.backup_zip_save import backup_zip_save
11
10
  from podflow.message.display_qrcode_and_url import display_qrcode_and_url
12
11
 
@@ -76,11 +75,10 @@ def save_rss():
76
75
  else:
77
76
  overall_url = f"{address}/{filename}.xml"
78
77
  # 调用write_log函数,记录总播客已更新
79
- write_log("总播客已更新", f"地址:\n\033[34m{overall_url}\033[0m")
78
+ write_log("总播客已更新", "地址:", url=overall_url)
80
79
  # 如果gVar.displayed_QRcode中不包含"main",则调用qr_code函数,显示总播客的二维码,并将"main"添加到gVar.displayed_QRcode中
81
80
  if "main" not in gVar.displayed_QRcode:
82
- qr_code(overall_url)
83
- qrcode_to_html(overall_url)
81
+ qr_code(overall_url, True)
84
82
  gVar.displayed_QRcode.append("main")
85
83
 
86
84
  # 备份主rss
@@ -40,6 +40,11 @@
40
40
  }
41
41
  }
42
42
 
43
+ .ansi-url{
44
+ color: #4064a0;
45
+ text-decoration: underline;
46
+ }
47
+
43
48
  .ansi-30m { color: #000000; }
44
49
  .ansi-31m { color: #bb271b; }
45
50
  .ansi-32m { color: #61992e; }
@@ -271,6 +276,52 @@
271
276
  </main>
272
277
  <script>
273
278
  (function() {
279
+ // 生成单个二维码的函数
280
+ function generateQRCodeForNode(container) {
281
+ const rootStyles = getComputedStyle(document.documentElement);
282
+ const textColor = rootStyles.getPropertyValue('--text-color');
283
+ const inputBg = rootStyles.getPropertyValue('--input-bg');
284
+ const url = container.dataset.url;
285
+ container.innerHTML = '';
286
+ if (url) {
287
+ new QRCode(container, {
288
+ text: url,
289
+ width: 128,
290
+ height: 128,
291
+ colorDark: textColor,
292
+ colorLight: inputBg,
293
+ correctLevel: QRCode.CorrectLevel.H
294
+ });
295
+ } else {
296
+ container.textContent = 'URL 未提供';
297
+ }
298
+ }
299
+
300
+ // 为所有存在的二维码容器生成二维码
301
+ function generateQRCodes() {
302
+ const containers = document.querySelectorAll('.qrcode-container');
303
+ containers.forEach(generateQRCodeForNode);
304
+ }
305
+
306
+ // 利用 MutationObserver 动态监听 container 内新增的二维码容器
307
+ function observeQRCodes(container) {
308
+ const observer = new MutationObserver((mutationsList) => {
309
+ mutationsList.forEach(mutation => {
310
+ mutation.addedNodes.forEach(node => {
311
+ if (node.nodeType === Node.ELEMENT_NODE) {
312
+ if (node.classList.contains('qrcode-container')) {
313
+ generateQRCodeForNode(node);
314
+ } else {
315
+ const childContainers = node.querySelectorAll('.qrcode-container');
316
+ childContainers.forEach(generateQRCodeForNode);
317
+ }
318
+ }
319
+ });
320
+ });
321
+ });
322
+ observer.observe(container, { childList: true, subtree: true });
323
+ }
324
+
274
325
  // 缓存常用节点
275
326
  const menu = document.getElementById('menu');
276
327
  const toggleMenuBtn = document.getElementById('toggleMenu');
@@ -286,10 +337,12 @@
286
337
  const pasteBtn = document.getElementById('pasteBtn');
287
338
  const copyBtn = document.getElementById('copyBtn');
288
339
  const clearBtn = document.getElementById('clearBtn');
289
- const qrcodeContainers = document.querySelectorAll('.qrcode-container'); // 获取所有二维码容器
290
340
 
291
341
  let pollingTimer = null;
292
342
 
343
+ // 监听 messageArea 内动态新增的二维码容器
344
+ observeQRCodes(messageArea);
345
+
293
346
  // 菜单切换函数
294
347
  function toggleMenu() {
295
348
  menu.classList.toggle('hidden');
@@ -313,7 +366,7 @@
313
366
  }
314
367
  pageId === 'pageMessage' ? startMessagePolling() : stopMessagePolling();
315
368
  if (pageId === 'pageMessage') {
316
- generateQRCodes(); // 当切换页面时生成二维码
369
+ generateQRCodes(); // 页面切换时生成已有二维码
317
370
  }
318
371
  }
319
372
  }
@@ -404,7 +457,7 @@
404
457
  startMessagePolling();
405
458
 
406
459
  // 表单异步提交(获取 Channel-ID)
407
- inputForm.addEventListener('submit', function(event) {
460
+ inputForm && inputForm.addEventListener('submit', function(event) {
408
461
  event.preventDefault();
409
462
  const content = inputOutput.value;
410
463
  fetch('getid', {
@@ -487,31 +540,6 @@
487
540
  toggleMenuBtn.textContent = '❯';
488
541
  }
489
542
 
490
- // 生成二维码的函数
491
- function generateQRCodes() {
492
- const rootStyles = getComputedStyle(document.documentElement);
493
- const textColor = rootStyles.getPropertyValue('--text-color');
494
- const inputBg = rootStyles.getPropertyValue('--input-bg');
495
-
496
- qrcodeContainers.forEach(container => {
497
- const url = container.dataset.url;
498
- // 清空容器中可能已有的内容
499
- container.innerHTML = '';
500
- if (url) {
501
- new QRCode(container, {
502
- text: url,
503
- width: 128,
504
- height: 128,
505
- colorDark: textColor,
506
- colorLight: inputBg,
507
- correctLevel: QRCode.CorrectLevel.H
508
- });
509
- } else {
510
- container.textContent = 'URL 未提供';
511
- }
512
- });
513
- }
514
-
515
543
  // 在页面加载完成后首次生成二维码(如果当前显示的是 Channel 页面)
516
544
  window.addEventListener('load', () => {
517
545
  if (pages.pageChannel.style.display === 'block') {
@@ -521,4 +549,4 @@
521
549
  })();
522
550
  </script>
523
551
  </body>
524
- </html>
552
+ </html>
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: podflow
3
- Version: 20250401.1
3
+ Version: 20250402
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
@@ -13,13 +13,13 @@ podflow/basic/get_file_list.py,sha256=XmnC4faObislyTsL9WUeyztyTQrvdi76lMzPudKEfX
13
13
  podflow/basic/get_html_dict.py,sha256=V-PgDtD6pm5mZC1LUPttUbZzxhjkS3WDYHxWR3yzIEY,869
14
14
  podflow/basic/http_client.py,sha256=h4IwxC7ZSi4rJ-mHvj26FQqz5krERzUg4hKEgj-yj-M,2895
15
15
  podflow/basic/list_merge_tidy.py,sha256=7hWfSnsPh23edHNU92vxtI0nfpfN8m54GTEt2rGm2HQ,368
16
- podflow/basic/qr_code.py,sha256=PvtCIq1THH72-xfxmhlI4Lz3ncE04po4XfH2XSjbhm0,1520
16
+ podflow/basic/qr_code.py,sha256=BQFxAx55vqWECTwWgybyXu3IuDFavpc3zMCmZ4XvKKE,1630
17
17
  podflow/basic/split_dict.py,sha256=Ir6GTortcWMUeFITFgY1v-INMla5y0IN3RN3nTgzWqM,401
18
18
  podflow/basic/time_format.py,sha256=T3tw2vbOwxMYYXDaV4Sj76WOZtsspj2lWA_DzWqUEJA,487
19
- podflow/basic/time_print.py,sha256=utNgnf9kSxX3hdTyrRNvRph63ZpD4BKLyFXVpkqrAyc,798
19
+ podflow/basic/time_print.py,sha256=Yargar0hBVpFt_WK7pixx_zGLEzs386XvL86ZSV-6Jo,1021
20
20
  podflow/basic/time_stamp.py,sha256=Kbz9PzgPtss1fRqPXdfz1q6MTGVMRi3LPClN7wrXSIk,1888
21
21
  podflow/basic/vary_replace.py,sha256=-TyvZxfak6U7Ak8F87ctYUBpHB2Il6iYZof37lwKjto,211
22
- podflow/basic/write_log.py,sha256=044gSqHRnSjwtl4Hhhi_zE2bRzmKBpigukxeHmSd-Fk,1312
22
+ podflow/basic/write_log.py,sha256=wfiNfFuRLCWNLXDRNPVaVsKxwB44xxTiCFJ66g71XmU,1255
23
23
  podflow/bilibili/__init__.py,sha256=6ZTpvhZTyn4f0LryXzH8lzyK1_rRHBeM-hkBoklKHRA,47
24
24
  podflow/bilibili/build.py,sha256=PKxkjUa8EedpoQTFZIgdcsVbiAWRISA-qKCpCaSTLTU,7957
25
25
  podflow/bilibili/get.py,sha256=Ld8lhb_3eiSagVXWyj1KIrRLjfH6p0sUolEG5VtN8mk,20337
@@ -64,7 +64,7 @@ podflow/message/get_youtube_and_bilibili_video_format.py,sha256=BFlplFy-j3J_2UVv
64
64
  podflow/message/media_format.py,sha256=Q4WoML4UqL0Ry-QN8DHFJqOQ2tXcFN6u5hmhdSLdP1g,7346
65
65
  podflow/message/original_rss_fail_print.py,sha256=7HM5Gwi3GqBIg2dtTTDlN_FRgZZjYv6ejizS3tDiePE,502
66
66
  podflow/message/rss_create_hash.py,sha256=M5OS9KcQ4mIxLes9ij4oNji-4VKgi56bg0Shv5nCIQ4,638
67
- podflow/message/save_rss.py,sha256=LTVbKsWdeZWDU9FiwDBi1K6Q0hqsMuYVI-_FcviF1VY,3287
67
+ podflow/message/save_rss.py,sha256=x-yRwT7bAUt2k-R9DWa5uToqpcOdaXkPW_4VH5Gbeo4,3193
68
68
  podflow/message/title_correction.py,sha256=Zieulj2wQY_o4r3u5ZRsDQP5y8KuZHrL_l8tnM96k6g,915
69
69
  podflow/message/update_information_display.py,sha256=Zn-Xhps4PKf7NbgQrT-qTwhP096RV-48OEncK_vuUe0,3061
70
70
  podflow/message/update_youtube_bilibili_rss.py,sha256=9hHym9e2DbSTZ1tSfBfErLJWmi9I71edNORdAaZCPTw,5238
@@ -80,7 +80,7 @@ podflow/remove/remove_dir.py,sha256=xQIhrnqnYjMzXjoSWaTvm7JwPYOFTN1muuTPdaLDXpQ,
80
80
  podflow/remove/remove_file.py,sha256=8wAJQehs-XBqvu0vPlEme2_tt0FZxc5ELwGMxXA_558,982
81
81
  podflow/repair/__init__.py,sha256=Gpc1i6xiSLodKjjmzH66c_Y1z0HQ9E9CS3p95FRnVFM,45
82
82
  podflow/repair/reverse_log.py,sha256=Wc_vAH0WB-z1fNdWx7FYaVH4caRPtot7tDwDwFhmpz4,1106
83
- podflow/templates/index.html,sha256=XAZZZHD_EIFewkOkXFV6KY67ToT32Mby3tA-UwYP0ko,16421
83
+ podflow/templates/index.html,sha256=wR8aO5vh2vKv7KED8CTv61tIfqp9WOxnDu-lut0yry8,17402
84
84
  podflow/upload/__init__.py,sha256=AtOSXDrE5EjUe3z-iBd1NTDaH8n_X9qA5WXdBLkONjA,45
85
85
  podflow/upload/add_upload.py,sha256=_2-V0z75Lwu-PUCfMD9HOSxZTB102yZlZW5hSdlHcsc,1432
86
86
  podflow/upload/build_hash.py,sha256=9opa3xLd7nJbGGX5xa3uuKPS6dxlbkAb87ZdEiUxmxI,473
@@ -95,8 +95,8 @@ podflow/youtube/__init__.py,sha256=pgXod8gq0IijZxIkPSwgAOcb9JI5rd1mqMomoR7bcJ4,4
95
95
  podflow/youtube/build.py,sha256=3LYk_ICVXj9XkE9jZ8jEVI8596xxS_QZkcoIwcBE3Ys,12006
96
96
  podflow/youtube/get.py,sha256=Of7PRgUknhpyW70nvyVAUYVb5KyFViKiBTfH3Y6Mke8,16970
97
97
  podflow/youtube/login.py,sha256=KYl--ya6Z1u0uIcOp9l8i3DIIj9hsYUDH4dtJjI0MLM,1295
98
- podflow-20250401.1.dist-info/METADATA,sha256=dmYebt7gQjgz_GopadSE7b0dxSY7x5d_FtLDLjbEIcU,14165
99
- podflow-20250401.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
100
- podflow-20250401.1.dist-info/entry_points.txt,sha256=mn7hD_c_dmpKe3XU0KNekheBvD01LhlJ9htY-Df0j2A,131
101
- podflow-20250401.1.dist-info/top_level.txt,sha256=fUujhhz-RrMI8aGvi-3Ey5y7FQnpOOgoFw9OWM3yLCU,8
102
- podflow-20250401.1.dist-info/RECORD,,
98
+ podflow-20250402.dist-info/METADATA,sha256=1wa91W9dSWGArHH-bVmwslSthG9rho9CafFYnVlO7WM,14163
99
+ podflow-20250402.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
100
+ podflow-20250402.dist-info/entry_points.txt,sha256=mn7hD_c_dmpKe3XU0KNekheBvD01LhlJ9htY-Df0j2A,131
101
+ podflow-20250402.dist-info/top_level.txt,sha256=fUujhhz-RrMI8aGvi-3Ey5y7FQnpOOgoFw9OWM3yLCU,8
102
+ podflow-20250402.dist-info/RECORD,,