podflow 20250404.8__py3-none-any.whl → 20250404.9__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/__init__.py CHANGED
@@ -125,7 +125,6 @@ class Application_gVar:
125
125
  "http": [], # httpfs窗口信息列表
126
126
  "enter": True, # 是否换行
127
127
  }
128
- self.text_message = [] # 测试
129
128
 
130
129
 
131
130
  # 参数变量
@@ -37,6 +37,3 @@ def time_print(text, Top=False, NoEnter=False, Time=True, Url=""):
37
37
  gVar.index_message["podflow"].append(
38
38
  f'<a href="{Url}"><span class="ansi-url">{Url}</span></a>'
39
39
  )
40
- gVar.text_message.append(
41
- [text, Top, NoEnter]
42
- )
podflow/main_podcast.py CHANGED
@@ -234,7 +234,3 @@ def main_podcast():
234
234
  # 关闭CherryPy服务器
235
235
  cherrypy.engine.exit()
236
236
  time_print("Podflow运行结束")
237
-
238
- from podflow.basic.file_save import file_save
239
- file_save(gVar.text_message, "text.json")
240
- file_save(gVar.index_message, "index.json")
@@ -404,56 +404,54 @@
404
404
  .catch(error => console.error('获取消息失败:', error));
405
405
  }
406
406
 
407
+ function createMessageElement(message) {
408
+ const p = document.createElement('p');
409
+ p.innerHTML = message;
410
+ p.className = 'message';
411
+ return p;
412
+ }
413
+
407
414
  function appendMessages(container, newMessages, oldMessages) {
408
415
  // 判断当前是否在底部
409
416
  const isAtBottom = container.scrollHeight - container.scrollTop <= container.clientHeight + 10;
410
-
411
- // 只追加新数据,避免重复渲染
417
+
418
+ // 当两数组长度相等且有内容时,只比较最后一项
412
419
  if (newMessages.length === oldMessages.length && newMessages.length > 0) {
413
420
  const lastNewMessage = newMessages[newMessages.length - 1];
414
421
  const lastOldMessage = oldMessages[oldMessages.length - 1];
415
422
  if (lastNewMessage !== lastOldMessage) {
416
- const p = document.createElement('p');
417
- p.innerHTML = lastNewMessage;
418
- p.className = 'message'; // 添加 CSS 类名
419
-
420
- // 获取容器的最后一个子元素
423
+ const p = createMessageElement(lastNewMessage);
421
424
  const lastChild = container.lastElementChild;
422
- // 如果容器有子元素,则替换最后一个
423
425
  if (lastChild) {
424
426
  container.replaceChild(p, lastChild);
425
427
  } else {
426
- // 如果容器为空,则直接添加
427
428
  container.appendChild(p);
428
429
  }
429
430
  }
430
431
  } else {
431
- // 如果 newMessages oldMessages 元素数量不一致,则执行原来的添加逻辑
432
+ // 如果 newMessages oldMessages 数量不一致
433
+ // 先替换容器中最后一项为 newMessages 中对应位置的消息(若 oldMessages 存在数据)
434
+ if (oldMessages.length > 0) {
435
+ const replaceIndex = oldMessages.length - 1;
436
+ const p = createMessageElement(newMessages[replaceIndex]);
437
+ const lastChild = container.lastElementChild;
438
+ if (lastChild) {
439
+ container.replaceChild(p, lastChild);
440
+ } else {
441
+ container.appendChild(p);
442
+ }
443
+ }
444
+ // 再追加从 oldMessages.length 开始的后续消息
432
445
  newMessages.slice(oldMessages.length).forEach(msg => {
433
- const p = document.createElement('p');
434
- p.innerHTML = msg;
435
- p.className = 'message'; // 添加 CSS 类名
436
- container.appendChild(p);
446
+ container.appendChild(createMessageElement(msg));
437
447
  });
438
448
  }
439
-
440
- // 替换倒数第二项和倒数第三项
441
- for (let i = 2; i <= 3; i++) {
442
- const child = container.children[container.children.length - (i + 1)];
443
- if (child && newMessages.length > i) {
444
- const newMessage = newMessages[newMessages.length - (i + 1)];
445
- const p = document.createElement('p');
446
- p.innerHTML = newMessage;
447
- p.className = 'message'; // 添加 CSS 类名
448
- container.replaceChild(p, child);
449
- }
450
- }
451
-
452
- // 如果用户没有主动滚动,才自动滚动到底部
449
+
450
+ // 如果用户没有主动滚动,则自动滚动到底部
453
451
  if (!userScrolled) {
454
452
  container.scrollTop = container.scrollHeight;
455
453
  }
456
- }
454
+ }
457
455
 
458
456
  function startMessagePolling() {
459
457
  getMessages();
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: podflow
3
- Version: 20250404.8
3
+ Version: 20250404.9
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
@@ -1,8 +1,8 @@
1
- podflow/__init__.py,sha256=-12IeezgxSWsT1HfVomg8dGSMq3mDi0SqCRMRZQtByY,7263
1
+ podflow/__init__.py,sha256=N8hpfDHmVdVyDQs50yt_EMscS2v6CTD5a8oBWUkUOf0,7222
2
2
  podflow/download_and_build.py,sha256=GKQ1uX8Nuwdhr4wgnGr3jP1Mu0llRUPFcboQ3S05WkU,671
3
3
  podflow/ffmpeg_judge.py,sha256=wM49pPXOFwFAA_8TKHal5fV6ka9sAA87yGQMDOssvXo,1340
4
4
  podflow/main.py,sha256=Cz2E33-Kcc_1_oxNs4Z1OoqJYhonmClsrtoCW1oQmZA,739
5
- podflow/main_podcast.py,sha256=ViZ-J2kCfjAmF5l5GMp8z4qOGpyvEvDGVesQCAcS2mE,9176
5
+ podflow/main_podcast.py,sha256=ytBL4LsGLttOFrJ9MXjMR1EBeTtoGjA78KQleA7rKwQ,9027
6
6
  podflow/main_upload.py,sha256=H_T5KQMYzToqzQbjGQ6DWDGziy8iMnpmf7A1qOStJuo,2296
7
7
  podflow/parse_arguments.py,sha256=h3a7EaRZS04kNMFYbxTW9Ch29KgZ7dyS-yqEEt_etQI,2592
8
8
  podflow/basic/__init__.py,sha256=CAfI6mVQtz7KKbAiTIZ9_IbvaTXeAqxR1U7ov9GDoDo,44
@@ -16,7 +16,7 @@ podflow/basic/list_merge_tidy.py,sha256=7hWfSnsPh23edHNU92vxtI0nfpfN8m54GTEt2rGm
16
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=dtXXszwpXbHvgAcc_Y5JYlpKeKDCNdFrqU0eAYYD54U,1237
19
+ podflow/basic/time_print.py,sha256=e7T9WTPDgo9SejYKL4XR5C6Gi9iOWSe1JdfO-YMkmbo,1172
20
20
  podflow/basic/time_stamp.py,sha256=Kbz9PzgPtss1fRqPXdfz1q6MTGVMRi3LPClN7wrXSIk,1888
21
21
  podflow/basic/vary_replace.py,sha256=-TyvZxfak6U7Ak8F87ctYUBpHB2Il6iYZof37lwKjto,211
22
22
  podflow/basic/write_log.py,sha256=wfiNfFuRLCWNLXDRNPVaVsKxwB44xxTiCFJ66g71XmU,1255
@@ -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=cb2qoU7xienWiZ02O0n_uoQOtwq0KCNML5xYGqsghmM,18014
83
+ podflow/templates/index.html,sha256=FJ2MN0U4BxPifiBzYeVigdvKMF99Azo03N4OkqGeJEc,17861
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-20250404.8.dist-info/METADATA,sha256=Z0RBsVpwwdyYZk8f72jeGN-iRlgwGOL5OF1cSsrcIRQ,14165
99
- podflow-20250404.8.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
100
- podflow-20250404.8.dist-info/entry_points.txt,sha256=mn7hD_c_dmpKe3XU0KNekheBvD01LhlJ9htY-Df0j2A,131
101
- podflow-20250404.8.dist-info/top_level.txt,sha256=fUujhhz-RrMI8aGvi-3Ey5y7FQnpOOgoFw9OWM3yLCU,8
102
- podflow-20250404.8.dist-info/RECORD,,
98
+ podflow-20250404.9.dist-info/METADATA,sha256=OoC5BxBXpLX0Mmlgp-cmmQl6yhn6AD4kDo84qjsIOo0,14165
99
+ podflow-20250404.9.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
100
+ podflow-20250404.9.dist-info/entry_points.txt,sha256=mn7hD_c_dmpKe3XU0KNekheBvD01LhlJ9htY-Df0j2A,131
101
+ podflow-20250404.9.dist-info/top_level.txt,sha256=fUujhhz-RrMI8aGvi-3Ey5y7FQnpOOgoFw9OWM3yLCU,8
102
+ podflow-20250404.9.dist-info/RECORD,,