podflow 20250212__tar.gz → 20250301__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-20250212 → podflow-20250301}/PKG-INFO +1 -1
- {podflow-20250212 → podflow-20250301}/Podflow/__init__.py +2 -2
- {podflow-20250212 → podflow-20250301}/Podflow/basic/http_client.py +10 -2
- {podflow-20250212 → podflow-20250301}/Podflow/bilibili/build.py +8 -6
- {podflow-20250212 → podflow-20250301}/Podflow/bilibili/login.py +3 -3
- {podflow-20250212 → podflow-20250301}/Podflow/download/youtube_and_bilibili_download.py +2 -1
- podflow-20250301/Podflow/download_and_build.py +24 -0
- podflow-20250301/Podflow/httpfs/port_judge.py +14 -0
- podflow-20250301/Podflow/main.py +21 -0
- podflow-20250212/Podflow/main.py → podflow-20250301/Podflow/main_podcast.py +24 -69
- podflow-20250301/Podflow/main_upload.py +28 -0
- podflow-20250212/Podflow/makeup/del_makeup_yt_format_fail.py → podflow-20250301/Podflow/makeup/del_makeup_format_fail.py +4 -5
- {podflow-20250212 → podflow-20250301}/Podflow/makeup/make_up_file_format_mod.py +8 -8
- podflow-20250301/Podflow/message/create_main_rss.py +69 -0
- {podflow-20250212 → podflow-20250301}/Podflow/message/display_qrcode_and_url.py +9 -11
- {podflow-20250212 → podflow-20250301}/Podflow/message/fail_message_initialize.py +5 -0
- podflow-20250301/Podflow/message/get_media_name.py +26 -0
- podflow-20250301/Podflow/message/save_rss.py +85 -0
- {podflow-20250212 → podflow-20250301}/Podflow/remove/remove_file.py +1 -0
- podflow-20250301/Podflow/upload/add_upload.py +36 -0
- {podflow-20250212 → podflow-20250301}/Podflow/upload/get_upload_original.py +22 -23
- podflow-20250301/Podflow/upload/linked_client.py +74 -0
- podflow-20250301/Podflow/upload/linked_server.py +32 -0
- podflow-20250301/Podflow/upload/update_upload.py +74 -0
- podflow-20250301/Podflow/upload/upload_print.py +8 -0
- {podflow-20250212 → podflow-20250301}/Podflow/youtube/build.py +36 -16
- {podflow-20250212 → podflow-20250301}/podflow.egg-info/PKG-INFO +1 -1
- {podflow-20250212 → podflow-20250301}/podflow.egg-info/SOURCES.txt +11 -1
- {podflow-20250212 → podflow-20250301}/podflow.egg-info/requires.txt +1 -1
- {podflow-20250212 → podflow-20250301}/setup.py +2 -2
- podflow-20250212/Podflow/httpfs/port_judge.py +0 -21
- podflow-20250212/Podflow/message/create_main_rss.py +0 -44
- {podflow-20250212 → podflow-20250301}/Podflow/basic/__init__.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/basic/file_save.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/basic/folder_build.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/basic/get_duration.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/basic/get_file_list.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/basic/get_html_dict.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/basic/list_merge_tidy.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/basic/qr_code.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/basic/split_dict.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/basic/time_format.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/basic/time_stamp.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/basic/vary_replace.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/basic/write_log.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/bilibili/__init__.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/bilibili/get.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/config/__init__.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/config/build_original.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/config/channge_icon.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/config/correct_channelid.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/config/correct_config.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/config/get_channelid.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/config/get_channelid_id.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/config/get_config.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/download/__init__.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/download/convert_bytes.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/download/delete_part.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/download/dl_aideo_video.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/download/show_progress.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/download/wait_animation.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/ffmpeg_judge.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/httpfs/__init__.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/httpfs/app_bottle.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/makeup/__init__.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/makeup/make_up_file.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/makeup/make_up_file_mod.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/message/__init__.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/message/backup_zip_save.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/message/format_time.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/message/get_original_rss.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/message/get_video_format.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/message/get_video_format_multithread.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/message/get_youtube_and_bilibili_video_format.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/message/media_format.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/message/original_rss_fail_print.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/message/rss_create_hash.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/message/title_correction.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/message/update_information_display.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/message/update_youtube_bilibili_rss.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/message/want_retry.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/message/xml_item.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/message/xml_original_item.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/message/xml_rss.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/netscape/__init__.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/netscape/bulid_netscape.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/netscape/get_cookie_dict.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/parse_arguments.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/remove/__init__.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/remove/remove_dir.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/upload/__init__.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/youtube/__init__.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/youtube/get.py +0 -0
- {podflow-20250212 → podflow-20250301}/Podflow/youtube/login.py +0 -0
- {podflow-20250212 → podflow-20250301}/README.md +0 -0
- {podflow-20250212 → podflow-20250301}/podflow.egg-info/dependency_links.txt +0 -0
- {podflow-20250212 → podflow-20250301}/podflow.egg-info/entry_points.txt +0 -0
- {podflow-20250212 → podflow-20250301}/podflow.egg-info/top_level.txt +0 -0
- {podflow-20250212 → podflow-20250301}/setup.cfg +0 -0
@@ -110,12 +110,12 @@ class Application_gVar:
|
|
110
110
|
self.youtube_xml_get_tree = {} # YouTube频道简介和图标字典
|
111
111
|
self.all_youtube_content_ytid = {} # 所有YouTube视频id字典
|
112
112
|
self.all_bilibili_content_bvid = {} # 所有哔哩哔哩视频id字典
|
113
|
-
self.all_items =
|
113
|
+
self.all_items = {} # 更新后所有item明细字典
|
114
114
|
self.overall_rss = "" # 更新后的rss文本
|
115
115
|
self.make_up_file_format = {} # 补全缺失媒体字典
|
116
116
|
self.make_up_file_format_fail = {} # 补全缺失媒体失败字典
|
117
117
|
|
118
|
-
self.upload_original =
|
118
|
+
self.upload_original = [] # 原始上传信息字典
|
119
119
|
|
120
120
|
self.shortcuts_url = {} # 输出至shortcut的url字典
|
121
121
|
|
@@ -16,6 +16,7 @@ def http_client(
|
|
16
16
|
cookies=None,
|
17
17
|
data=None,
|
18
18
|
mode="get",
|
19
|
+
filename=None,
|
19
20
|
):
|
20
21
|
user_agent = {
|
21
22
|
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"
|
@@ -52,8 +53,12 @@ def http_client(
|
|
52
53
|
session.params.update(data)
|
53
54
|
for num in range(max_retries):
|
54
55
|
try:
|
55
|
-
if mode != "post":
|
56
|
+
if mode.lower() != "post":
|
56
57
|
response = session.get(url, timeout=8)
|
58
|
+
elif filename:
|
59
|
+
with open(filename, "rb") as f:
|
60
|
+
files = {"file": f} # 这里 "file" 对应服务器端接收文件的字段名称
|
61
|
+
response = session.post(url, files=files, timeout=8)
|
57
62
|
else:
|
58
63
|
response = session.post(url, timeout=8)
|
59
64
|
response.raise_for_status()
|
@@ -64,7 +69,10 @@ def http_client(
|
|
64
69
|
print(
|
65
70
|
f"{datetime.now().strftime('%H:%M:%S')}|{name}|\033[31m连接异常重试中...\033[97m{num + 1}\033[0m"
|
66
71
|
)
|
67
|
-
|
72
|
+
if err:
|
73
|
+
err = f"{err}\n{str(http_get_error)}"
|
74
|
+
else:
|
75
|
+
err = f":\n{str(http_get_error)}"
|
68
76
|
else:
|
69
77
|
return response
|
70
78
|
time.sleep(retry_delay)
|
@@ -193,9 +193,11 @@ def bilibili_xml_items(output_dir):
|
|
193
193
|
items = f"""<!-- {{{output_dir}}} -->
|
194
194
|
{items}
|
195
195
|
<!-- {{{output_dir}}} -->"""
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
"
|
200
|
-
|
201
|
-
|
196
|
+
return {
|
197
|
+
"title": title,
|
198
|
+
"link": link,
|
199
|
+
"description": description,
|
200
|
+
"category": category,
|
201
|
+
"icon": icon,
|
202
|
+
"items": items,
|
203
|
+
}
|
@@ -8,9 +8,9 @@ import re
|
|
8
8
|
import time
|
9
9
|
from datetime import datetime
|
10
10
|
import requests
|
11
|
-
from
|
12
|
-
from
|
13
|
-
from
|
11
|
+
from Crypto.Cipher import PKCS1_OAEP
|
12
|
+
from Crypto.Hash import SHA256
|
13
|
+
from Crypto.PublicKey import RSA
|
14
14
|
from Podflow.basic.file_save import file_save
|
15
15
|
from Podflow.basic.http_client import http_client
|
16
16
|
from Podflow.basic.qr_code import qr_code
|
@@ -8,7 +8,7 @@ from Podflow.download.dl_aideo_video import dl_aideo_video
|
|
8
8
|
|
9
9
|
# 下载YouTube和哔哩哔哩视频
|
10
10
|
def youtube_and_bilibili_download():
|
11
|
-
for video_id, format_value in gVar.video_id_update_format.items():
|
11
|
+
for video_id, format_value in gVar.video_id_update_format.copy().items():
|
12
12
|
if isinstance(format_value, dict) and format_value["main"] not in gVar.video_id_failed:
|
13
13
|
output_dir_name = format_value["name"]
|
14
14
|
display_color = "\033[35m" if format_value["backward_update"] else "\033[95m"
|
@@ -28,3 +28,4 @@ def youtube_and_bilibili_download():
|
|
28
28
|
write_log(
|
29
29
|
f"{display_color}{output_dir_name}\033[0m|{video_id} \033[31m无法下载\033[0m"
|
30
30
|
)
|
31
|
+
del gVar.video_id_update_format[video_id]
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Podflow/download_and_build.py
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
import threading
|
5
|
+
from Podflow.youtube.build import get_youtube_introduction
|
6
|
+
from Podflow.message.create_main_rss import create_main_rss
|
7
|
+
from Podflow.download.youtube_and_bilibili_download import youtube_and_bilibili_download
|
8
|
+
|
9
|
+
|
10
|
+
def get_and_duild():
|
11
|
+
get_youtube_introduction()
|
12
|
+
create_main_rss()
|
13
|
+
|
14
|
+
|
15
|
+
# 下载并构建YouTube和哔哩哔哩视频模块
|
16
|
+
def download_and_build():
|
17
|
+
thread_download = threading.Thread(target=youtube_and_bilibili_download)
|
18
|
+
thread_build = threading.Thread(target=get_and_duild)
|
19
|
+
|
20
|
+
thread_download.start()
|
21
|
+
thread_build.start()
|
22
|
+
|
23
|
+
thread_download.join()
|
24
|
+
thread_build.join()
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Podflow/httpfs/port_judge.py
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
import socket
|
5
|
+
|
6
|
+
|
7
|
+
def port_judge(hostip, port):
|
8
|
+
try:
|
9
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
10
|
+
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
11
|
+
sock.bind((hostip, port))
|
12
|
+
return True
|
13
|
+
except OSError:
|
14
|
+
return False
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Podflow/main.py
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
from datetime import datetime
|
5
|
+
from importlib.metadata import version
|
6
|
+
from Podflow.main_podcast import main_podcast
|
7
|
+
from Podflow.parse_arguments import parse_arguments
|
8
|
+
|
9
|
+
|
10
|
+
def main():
|
11
|
+
# 获取传入的参数
|
12
|
+
parse_arguments()
|
13
|
+
# 开始运行
|
14
|
+
print(
|
15
|
+
f"{datetime.now().strftime('%H:%M:%S')}|Podflow|{version('Podflow')}开始运行....."
|
16
|
+
)
|
17
|
+
main_podcast()
|
18
|
+
|
19
|
+
|
20
|
+
if __name__ == "__main__":
|
21
|
+
main()
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Podflow/
|
1
|
+
# Podflow/main_podcast.py
|
2
2
|
# coding: utf-8
|
3
3
|
|
4
4
|
import sys
|
@@ -7,15 +7,10 @@ import time
|
|
7
7
|
import urllib
|
8
8
|
import subprocess
|
9
9
|
from datetime import datetime
|
10
|
-
from importlib.metadata import version
|
11
10
|
import cherrypy
|
12
11
|
|
13
12
|
# 基本功能模块
|
14
13
|
from Podflow import gVar, parse
|
15
|
-
from Podflow.parse_arguments import parse_arguments
|
16
|
-
from Podflow.basic.file_save import file_save
|
17
|
-
from Podflow.basic.qr_code import qr_code
|
18
|
-
from Podflow.basic.write_log import write_log
|
19
14
|
from Podflow.basic.split_dict import split_dict
|
20
15
|
|
21
16
|
# 网络和 HTTP 模块
|
@@ -24,13 +19,11 @@ from Podflow.httpfs.app_bottle import bottle_app_instance
|
|
24
19
|
|
25
20
|
# 下载和视频处理模块
|
26
21
|
from Podflow.download.delete_part import delete_part
|
27
|
-
from Podflow.
|
22
|
+
from Podflow.download_and_build import download_and_build
|
28
23
|
from Podflow.ffmpeg_judge import ffmpeg_judge
|
29
24
|
|
30
25
|
# RSS 和消息处理模块
|
31
|
-
from Podflow.message.
|
32
|
-
from Podflow.message.backup_zip_save import backup_zip_save
|
33
|
-
from Podflow.message.create_main_rss import create_main_rss
|
26
|
+
from Podflow.message.save_rss import save_rss
|
34
27
|
from Podflow.message.get_original_rss import get_original_rss
|
35
28
|
from Podflow.message.original_rss_fail_print import original_rss_fail_print
|
36
29
|
from Podflow.message.update_information_display import update_information_display
|
@@ -49,34 +42,30 @@ from Podflow.config.build_original import build_original
|
|
49
42
|
from Podflow.makeup.make_up_file import make_up_file
|
50
43
|
from Podflow.makeup.make_up_file_mod import make_up_file_mod
|
51
44
|
from Podflow.makeup.make_up_file_format_mod import make_up_file_format_mod
|
52
|
-
from Podflow.makeup.
|
45
|
+
from Podflow.makeup.del_makeup_format_fail import del_makeup_format_fail
|
53
46
|
|
54
47
|
# 移除模块
|
55
48
|
from Podflow.remove.remove_file import remove_file
|
56
49
|
from Podflow.remove.remove_dir import remove_dir
|
57
50
|
|
58
51
|
# 处理 YouTube 信息模块
|
59
|
-
from Podflow.youtube.build import
|
52
|
+
from Podflow.youtube.build import print_fail_youtube_introduction
|
60
53
|
|
61
54
|
# 长期媒体进行上传模块
|
55
|
+
from Podflow.upload.add_upload import add_upload
|
56
|
+
from Podflow.upload.update_upload import update_upload
|
62
57
|
from Podflow.upload.get_upload_original import get_upload_original
|
63
58
|
|
64
59
|
|
65
|
-
def
|
66
|
-
# 获取传入的参数
|
67
|
-
parse_arguments()
|
68
|
-
# 开始运行
|
69
|
-
print(
|
70
|
-
f"{datetime.now().strftime('%H:%M:%S')}|Podflow|{version('Podflow')}开始运行....."
|
71
|
-
)
|
60
|
+
def main_podcast():
|
72
61
|
# 判断是否安装ffmpeg
|
73
62
|
ffmpeg_judge()
|
74
63
|
# 初始化
|
75
64
|
build_original()
|
76
65
|
# http共享
|
77
66
|
port = gVar.config["port"]
|
78
|
-
|
79
|
-
if port_judge(
|
67
|
+
hostip = "0.0.0.0"
|
68
|
+
if port_judge(hostip, port):
|
80
69
|
# 启动 CherryPy 服务器
|
81
70
|
cherrypy.tree.graft(
|
82
71
|
bottle_app_instance.app_bottle
|
@@ -85,7 +74,7 @@ def main():
|
|
85
74
|
{
|
86
75
|
"global": {
|
87
76
|
"tools.sessions.on": True, # 启用会话支持
|
88
|
-
"server.socket_host":
|
77
|
+
"server.socket_host": hostip, # 监听所有 IP 地址
|
89
78
|
"server.socket_port": port, # 设置监听端口
|
90
79
|
"log.screen": False, # 禁用屏幕日志输出
|
91
80
|
"log.access_file": "", # 关闭访问日志
|
@@ -99,6 +88,7 @@ def main():
|
|
99
88
|
)
|
100
89
|
if parse.httpfs: # HttpFS参数判断, 是否继续运行
|
101
90
|
cherrypy.engine.block() # 阻止程序退出, 保持HTTP服务运行
|
91
|
+
sys.exit(0)
|
102
92
|
else:
|
103
93
|
print(
|
104
94
|
f"{datetime.now().strftime('%H:%M:%S')}|HTTP服务器端口: \033[32m{port}\033[0m, \033[31m被占用\033[0m"
|
@@ -122,11 +112,7 @@ def main():
|
|
122
112
|
get_original_rss()
|
123
113
|
)
|
124
114
|
# 初始化原始上传信息
|
125
|
-
|
126
|
-
if upload_original := get_upload_original():
|
127
|
-
gVar.upload_original = upload_original
|
128
|
-
else:
|
129
|
-
gVar.config["upload"] = False
|
115
|
+
get_upload_original()
|
130
116
|
# 更新Youtube和哔哩哔哩频道xml
|
131
117
|
update_youtube_bilibili_rss()
|
132
118
|
# 判断是否有更新内容
|
@@ -159,20 +145,16 @@ def main():
|
|
159
145
|
delete_part(gVar.channelid_youtube_ids | gVar.channelid_bilibili_ids)
|
160
146
|
# 暂停进程打印
|
161
147
|
gVar.server_process_print_flag[0] = "pause"
|
162
|
-
#
|
163
|
-
|
148
|
+
# 下载并构建YouTube和哔哩哔哩视频
|
149
|
+
download_and_build()
|
150
|
+
# 添加新媒体至上传列表
|
151
|
+
add_upload()
|
164
152
|
# 恢复进程打印
|
165
153
|
bottle_app_instance.cherry_print()
|
166
154
|
# 打印无法保留原节目信息
|
167
155
|
original_rss_fail_print(gVar.xmls_original_fail)
|
168
|
-
#
|
169
|
-
|
170
|
-
# 暂停进程打印
|
171
|
-
gVar.server_process_print_flag[0] = "pause"
|
172
|
-
# 生成分和主rss
|
173
|
-
create_main_rss()
|
174
|
-
# 恢复进程打印
|
175
|
-
bottle_app_instance.cherry_print()
|
156
|
+
# 打印无法获取youtube频道简介
|
157
|
+
print_fail_youtube_introduction()
|
176
158
|
if gVar.config["remove_media"]:
|
177
159
|
# 删除不在rss中的媒体文件
|
178
160
|
remove_file()
|
@@ -192,41 +174,18 @@ def main():
|
|
192
174
|
make_up_file_format_mod()
|
193
175
|
# 恢复进程打印
|
194
176
|
bottle_app_instance.cherry_print()
|
195
|
-
# 生成主rss
|
196
|
-
overall_rss = xml_rss(
|
197
|
-
gVar.config["title"],
|
198
|
-
gVar.config["link"],
|
199
|
-
gVar.config["description"],
|
200
|
-
gVar.config["category"],
|
201
|
-
gVar.config["icon"],
|
202
|
-
"\n".join(gVar.all_items),
|
203
|
-
)
|
204
177
|
# 删除无法补全的媒体
|
205
|
-
|
206
|
-
# 保存主rss
|
207
|
-
file_save(overall_rss, f"{gVar.config['filename']}.xml")
|
208
|
-
# 暂停进程打印
|
209
|
-
gVar.server_process_print_flag[0] = "pause"
|
210
|
-
address = gVar.config["address"]
|
211
|
-
filename = gVar.config["filename"]
|
212
|
-
if token := gVar.config["token"]:
|
213
|
-
overall_url = f"{address}/{filename}.xml?token={token}"
|
214
|
-
else:
|
215
|
-
overall_url = f"{address}/{filename}.xml"
|
216
|
-
write_log("总播客已更新", f"地址:\n\033[34m{overall_url}\033[0m")
|
217
|
-
if "main" not in gVar.displayed_QRcode:
|
218
|
-
qr_code(overall_url)
|
219
|
-
gVar.displayed_QRcode.append("main")
|
220
|
-
# 恢复进程打印
|
221
|
-
bottle_app_instance.cherry_print()
|
222
|
-
# 备份主rss
|
223
|
-
backup_zip_save(overall_rss)
|
178
|
+
del_makeup_format_fail()
|
224
179
|
# 暂停进程打印
|
225
180
|
gVar.server_process_print_flag[0] = "pause"
|
181
|
+
# 保存rss文件模块
|
182
|
+
save_rss()
|
226
183
|
# 下载补全Youtube和哔哩哔哩视频模块
|
227
184
|
make_up_file_mod()
|
228
185
|
# 恢复进程打印
|
229
186
|
bottle_app_instance.cherry_print()
|
187
|
+
# 更新并保存上传列表
|
188
|
+
update_upload()
|
230
189
|
else:
|
231
190
|
print(f"{datetime.now().strftime('%H:%M:%S')}|频道无更新内容")
|
232
191
|
|
@@ -253,7 +212,3 @@ def main():
|
|
253
212
|
# 关闭CherryPy服务器
|
254
213
|
cherrypy.engine.exit()
|
255
214
|
print(f"{datetime.now().strftime('%H:%M:%S')}|Podflow运行结束")
|
256
|
-
|
257
|
-
|
258
|
-
if __name__ == "__main__":
|
259
|
-
main()
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Podflow/main_upload.py
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
import sys
|
5
|
+
import threading
|
6
|
+
from Podflow.upload.upload_print import upload_print
|
7
|
+
from Podflow.upload.linked_server import handle_discovery, usable_port
|
8
|
+
|
9
|
+
|
10
|
+
def main_upload():
|
11
|
+
# 服务发现相关配置
|
12
|
+
broadcast_port = 37001 # 服务发现用端口
|
13
|
+
service_port = 5000 # 实际服务端口
|
14
|
+
|
15
|
+
broadcast_port = usable_port(broadcast_port, 37100)
|
16
|
+
service_port = usable_port(service_port, 5050)
|
17
|
+
if broadcast_port and service_port:
|
18
|
+
discovery_thread = threading.Thread(
|
19
|
+
target=handle_discovery,
|
20
|
+
args=(broadcast_port, service_port),
|
21
|
+
)
|
22
|
+
discovery_thread.start()
|
23
|
+
else:
|
24
|
+
if not broadcast_port:
|
25
|
+
upload_print("\033[31m广播端口被占用\033[0m")
|
26
|
+
if not service_port:
|
27
|
+
upload_print("\033[31m服务端口被占用\033[0m")
|
28
|
+
sys.exit(0)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Podflow/makeup/
|
1
|
+
# Podflow/makeup/del_makeup_format_fail.py
|
2
2
|
# coding: utf-8
|
3
3
|
|
4
4
|
import re
|
@@ -6,14 +6,13 @@ from Podflow import gVar
|
|
6
6
|
|
7
7
|
|
8
8
|
# 删除无法补全的媒体模块
|
9
|
-
def
|
9
|
+
def del_makeup_format_fail():
|
10
10
|
for video_id, id_value in gVar.make_up_file_format_fail.items():
|
11
11
|
pattern_video_fail_item = rf"<!-- {id_value} -->(?:(?!<!-- {id_value} -->).)+?<guid>{video_id}</guid>.+?<!-- {id_value} -->"
|
12
12
|
replacement_video_fail_item = f"<!-- {id_value} -->"
|
13
|
-
|
13
|
+
gVar.all_items[id_value]["items"] = re.sub(
|
14
14
|
pattern_video_fail_item,
|
15
15
|
replacement_video_fail_item,
|
16
|
-
|
16
|
+
gVar.all_items[id_value]["items"],
|
17
17
|
flags=re.DOTALL,
|
18
18
|
)
|
19
|
-
return overall_rss
|
@@ -8,7 +8,7 @@ from Podflow.basic.write_log import write_log
|
|
8
8
|
from Podflow.message.media_format import media_format
|
9
9
|
|
10
10
|
|
11
|
-
def
|
11
|
+
def makeup_format(video_id, makeup_format_lock):
|
12
12
|
id_value = gVar.make_up_file_format[video_id]
|
13
13
|
makeup_id_format = media_format(
|
14
14
|
id_value["url"],
|
@@ -62,7 +62,7 @@ def makeup_yt_format(video_id, makeup_yt_format_lock):
|
|
62
62
|
}
|
63
63
|
del gVar.make_up_file_format[video_id]
|
64
64
|
else:
|
65
|
-
with
|
65
|
+
with makeup_format_lock:
|
66
66
|
write_log(f"{id_value['name']}|{video_id}|{makeup_id_format}")
|
67
67
|
gVar.make_up_file_format_fail[video_id] = id_value[
|
68
68
|
"id"
|
@@ -78,19 +78,19 @@ def make_up_file_format_mod():
|
|
78
78
|
f"{datetime.now().strftime('%H:%M:%S')}|补全缺失媒体 \033[34m下载准备中...\033[0m"
|
79
79
|
)
|
80
80
|
# 创建线程锁
|
81
|
-
|
81
|
+
makeup_format_lock = threading.Lock()
|
82
82
|
# 创建线程列表
|
83
|
-
|
83
|
+
makeup_format_threads = []
|
84
84
|
for video_id in gVar.make_up_file_format:
|
85
85
|
thread = threading.Thread(
|
86
|
-
target=
|
86
|
+
target=makeup_format,
|
87
87
|
args=(
|
88
88
|
video_id,
|
89
|
-
|
89
|
+
makeup_format_lock,
|
90
90
|
),
|
91
91
|
)
|
92
|
-
|
92
|
+
makeup_format_threads.append(thread)
|
93
93
|
thread.start()
|
94
94
|
# 等待所有线程完成
|
95
|
-
for thread in
|
95
|
+
for thread in makeup_format_threads:
|
96
96
|
thread.join()
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# Podflow/message/create_main_rss.py
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
import time
|
5
|
+
from Podflow import gVar
|
6
|
+
from Podflow.youtube.build import youtube_xml_items
|
7
|
+
from Podflow.bilibili.build import bilibili_xml_items
|
8
|
+
from Podflow.message.get_media_name import get_media_name
|
9
|
+
|
10
|
+
|
11
|
+
def update_output_dir():
|
12
|
+
output_dirs = []
|
13
|
+
for format_value in gVar.video_id_update_format.values():
|
14
|
+
if (
|
15
|
+
isinstance(format_value, dict)
|
16
|
+
and format_value["main"] not in gVar.video_id_failed
|
17
|
+
):
|
18
|
+
output_dirs.append(format_value["id"])
|
19
|
+
return output_dirs
|
20
|
+
|
21
|
+
|
22
|
+
# 生成主rss模块
|
23
|
+
def create_main_rss():
|
24
|
+
channelid_youtube_ids = gVar.channelid_youtube_ids
|
25
|
+
channelid_bilibili_ids = gVar.channelid_bilibili_ids
|
26
|
+
gVar.all_items = {
|
27
|
+
key: {} for key in channelid_youtube_ids | channelid_bilibili_ids
|
28
|
+
}
|
29
|
+
all_channelid = list(gVar.all_items.keys())
|
30
|
+
|
31
|
+
while all_channelid:
|
32
|
+
for index, output_dir in enumerate(all_channelid):
|
33
|
+
if output_dir in update_output_dir():
|
34
|
+
time.sleep(1)
|
35
|
+
else:
|
36
|
+
if output_dir in channelid_youtube_ids:
|
37
|
+
output_dir_youtube = channelid_youtube_ids[output_dir]
|
38
|
+
channelid_youtube_value = gVar.channelid_youtube[output_dir_youtube]
|
39
|
+
items = youtube_xml_items(output_dir)
|
40
|
+
items["DisplayRSSaddress"] = channelid_youtube_value[
|
41
|
+
"DisplayRSSaddress"
|
42
|
+
]
|
43
|
+
items["QRcode"] = channelid_youtube_value["QRcode"]
|
44
|
+
items["ID_Name"] = output_dir_youtube
|
45
|
+
items["InmainRSS"] = channelid_youtube_value["InmainRSS"]
|
46
|
+
items["type"] = "youtube"
|
47
|
+
gVar.all_youtube_content_ytid[output_dir] = get_media_name(
|
48
|
+
"youtube", items["items"]
|
49
|
+
)
|
50
|
+
gVar.all_items[output_dir] = items
|
51
|
+
elif output_dir in channelid_bilibili_ids:
|
52
|
+
output_dir_bilibili = channelid_bilibili_ids[output_dir]
|
53
|
+
channelid_bilibili_value = gVar.channelid_bilibili[
|
54
|
+
output_dir_bilibili
|
55
|
+
]
|
56
|
+
items = bilibili_xml_items(output_dir)
|
57
|
+
items["DisplayRSSaddress"] = channelid_bilibili_value[
|
58
|
+
"DisplayRSSaddress"
|
59
|
+
]
|
60
|
+
items["QRcode"] = channelid_bilibili_value["QRcode"]
|
61
|
+
items["ID_Name"] = output_dir_bilibili
|
62
|
+
items["InmainRSS"] = channelid_bilibili_value["InmainRSS"]
|
63
|
+
items["type"] = "bilibili"
|
64
|
+
gVar.all_bilibili_content_bvid[output_dir] = get_media_name(
|
65
|
+
"bilibili", items["items"]
|
66
|
+
)
|
67
|
+
gVar.all_items[output_dir] = items
|
68
|
+
del all_channelid[index]
|
69
|
+
break
|
@@ -9,9 +9,10 @@ from Podflow.basic.qr_code import qr_code
|
|
9
9
|
# 显示网址及二维码模块
|
10
10
|
def display_qrcode_and_url(
|
11
11
|
output_dir,
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
display_rss_address,
|
13
|
+
qrcode,
|
14
|
+
name,
|
15
|
+
ids_update,
|
15
16
|
):
|
16
17
|
address = gVar.config["address"]
|
17
18
|
if token := gVar.config["token"]:
|
@@ -19,17 +20,14 @@ def display_qrcode_and_url(
|
|
19
20
|
else:
|
20
21
|
xml_url = f"{address}/channel_rss/{output_dir}.xml"
|
21
22
|
|
22
|
-
if
|
23
|
-
update_text = "已更新" if output_dir in
|
23
|
+
if display_rss_address or output_dir in ids_update:
|
24
|
+
update_text = "已更新" if output_dir in ids_update else "无更新"
|
24
25
|
print(
|
25
|
-
f"{datetime.now().strftime('%H:%M:%S')}|{
|
26
|
+
f"{datetime.now().strftime('%H:%M:%S')}|{name} 播客{update_text}|地址:\n\033[34m{xml_url}\033[0m"
|
26
27
|
)
|
27
28
|
if (
|
28
|
-
(
|
29
|
-
|
30
|
-
or output_dir in channelid_video_ids_update
|
31
|
-
)
|
32
|
-
and channelid_video["QRcode"]
|
29
|
+
(display_rss_address or output_dir in ids_update)
|
30
|
+
and qrcode
|
33
31
|
and output_dir not in gVar.displayed_QRcode
|
34
32
|
):
|
35
33
|
qr_code(xml_url)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Podflow/message/get_media_name.py
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
import re
|
5
|
+
|
6
|
+
|
7
|
+
# 定义一个函数,用于获取媒体名称
|
8
|
+
def get_media_name(id_type, items):
|
9
|
+
# 如果id_type为youtube
|
10
|
+
if id_type == "youtube":
|
11
|
+
# 使用正则表达式匹配items中的youtube链接,返回匹配结果
|
12
|
+
return re.findall(
|
13
|
+
r"(?:/UC.{22}/)(.{11}\.m4a|.{11}\.mp4)(?=\"|\?)",
|
14
|
+
items,
|
15
|
+
)
|
16
|
+
# 如果id_type为bilibili
|
17
|
+
elif id_type == "bilibili":
|
18
|
+
# 使用正则表达式匹配items中的bilibili链接,返回匹配结果
|
19
|
+
return re.findall(
|
20
|
+
r"(?:/[0-9]+/)(BV.{10}\.m4a|BV.{10}\.mp4|BV.{10}_p[0-9]+\.m4a|BV.{10}_p[0-9]+\.mp4|BV.{10}_[0-9]{9}\.m4a|BV.{10}_[0-9]{9}\.mp4)(?=\"|\?)",
|
21
|
+
items,
|
22
|
+
)
|
23
|
+
# 如果id_type不是youtube或bilibili
|
24
|
+
else:
|
25
|
+
# 返回空列表
|
26
|
+
return []
|