podflow 20250706__tar.gz → 20250803__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-20250706 → podflow-20250803}/PKG-INFO +1 -1
- {podflow-20250706 → podflow-20250803}/podflow/__init__.py +2 -1
- {podflow-20250706 → podflow-20250803}/podflow/config/correct_channelid.py +48 -48
- {podflow-20250706 → podflow-20250803}/podflow/httpfs/app_bottle.py +160 -7
- {podflow-20250706 → podflow-20250803}/podflow/main_podcast.py +9 -2
- {podflow-20250706 → podflow-20250803}/podflow/message/fail_message_initialize.py +8 -2
- {podflow-20250706 → podflow-20250803}/podflow/message/update_information_display.py +31 -4
- {podflow-20250706 → podflow-20250803}/podflow/parse_arguments.py +8 -0
- podflow-20250803/podflow/remove/remove_dir.py +93 -0
- podflow-20250803/podflow/remove/remove_file.py +80 -0
- {podflow-20250706 → podflow-20250803}/podflow/upload/find_media_index.py +2 -2
- {podflow-20250706 → podflow-20250803}/podflow/upload/store_users_info.py +4 -3
- {podflow-20250706 → podflow-20250803}/podflow/youtube/check.py +3 -0
- {podflow-20250706 → podflow-20250803}/podflow.egg-info/PKG-INFO +1 -1
- {podflow-20250706 → podflow-20250803}/podflow.egg-info/requires.txt +1 -1
- {podflow-20250706 → podflow-20250803}/setup.py +2 -2
- podflow-20250706/podflow/remove/remove_dir.py +0 -33
- podflow-20250706/podflow/remove/remove_file.py +0 -24
- {podflow-20250706 → podflow-20250803}/MANIFEST.in +0 -0
- {podflow-20250706 → podflow-20250803}/README.md +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/basic/__init__.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/basic/file_save.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/basic/folder_build.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/basic/get_duration.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/basic/get_file_list.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/basic/get_html_dict.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/basic/http_client.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/basic/list_merge_tidy.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/basic/qr_code.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/basic/random_sequence.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/basic/split_dict.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/basic/time_format.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/basic/time_print.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/basic/time_stamp.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/basic/vary_replace.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/basic/write_log.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/bilibili/__init__.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/bilibili/build.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/bilibili/get.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/bilibili/login.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/config/__init__.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/config/build_original.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/config/channge_icon.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/config/correct_config.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/config/get_channelid.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/config/get_channelid_id.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/config/get_config.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/download/__init__.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/download/convert_bytes.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/download/delete_part.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/download/dl_aideo_video.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/download/show_progress.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/download/wait_animation.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/download/youtube_and_bilibili_download.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/download_and_build.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/ffmpeg_judge.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/httpfs/__init__.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/httpfs/browser.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/httpfs/download_bar.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/httpfs/get_channelid.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/httpfs/port_judge.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/httpfs/progress_bar.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/httpfs/to_html.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/main.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/main_upload.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/makeup/__init__.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/makeup/del_makeup_format_fail.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/makeup/make_up_file.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/makeup/make_up_file_format_mod.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/makeup/make_up_file_mod.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/__init__.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/backup_zip_save.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/create_main_rss.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/display_qrcode_and_url.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/format_time.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/get_media_name.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/get_original_rss.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/get_video_format.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/get_video_format_multithread.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/get_youtube_and_bilibili_video_format.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/media_format.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/optimize_download.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/original_rss_fail_print.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/rss_create_hash.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/save_rss.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/title_correction.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/update_youtube_bilibili_rss.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/want_retry.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/xml_item.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/xml_original_item.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/message/xml_rss.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/netscape/__init__.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/netscape/bulid_netscape.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/remove/__init__.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/remove/remove_flush.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/repair/__init__.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/repair/reverse_log.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/templates/css/config.css +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/templates/css/index.css +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/templates/index.html +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/templates/js/config.js +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/templates/js/index.js +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/templates/js/qrcode.min.js +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/upload/__init__.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/upload/add_upload.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/upload/build_hash.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/upload/get_upload_original.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/upload/linked_client.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/upload/linked_server.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/upload/login.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/upload/time_key.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/upload/update_upload.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/upload/upload_files.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/upload/upload_server.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/youtube/__init__.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/youtube/build.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/youtube/get.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow/youtube/login.py +0 -0
- {podflow-20250706 → podflow-20250803}/podflow.egg-info/SOURCES.txt +0 -0
- {podflow-20250706 → podflow-20250803}/podflow.egg-info/dependency_links.txt +0 -0
- {podflow-20250706 → podflow-20250803}/podflow.egg-info/entry_points.txt +0 -0
- {podflow-20250706 → podflow-20250803}/podflow.egg-info/top_level.txt +0 -0
- {podflow-20250706 → podflow-20250803}/pyproject.toml +0 -0
- {podflow-20250706 → podflow-20250803}/setup.cfg +0 -0
@@ -34,7 +34,7 @@ default_config = {
|
|
34
34
|
"QRcode": False, # 是否显示子博客地址二维码(仅在DisplayRSSaddress为True时有效)
|
35
35
|
"BackwardUpdate": False, # 是否向后更新
|
36
36
|
"BackwardUpdate_size": 3, # 向后更新数量(仅在BackwardUpdate为True时有效)
|
37
|
-
"want_retry_count":
|
37
|
+
"want_retry_count": 25, # 媒体获取失败后多少次后重试(小于等于该数量时将一直重试)
|
38
38
|
"title_change": [ # 标题文本修改(默认为无, 可多个条件,以列表形式存在)
|
39
39
|
{ # match和url参数至少有一个, 如都有将同时生效
|
40
40
|
"mode": "add-left", # 修改模式(add-left: 开头添加, add-right: 结尾添加, replace: 内容替换)
|
@@ -146,6 +146,7 @@ class Application_parse:
|
|
146
146
|
self.file = ""
|
147
147
|
self.httpfs = False
|
148
148
|
self.index = False
|
149
|
+
self.save = []
|
149
150
|
|
150
151
|
|
151
152
|
# 创建 Application 类的实例
|
@@ -62,19 +62,19 @@ def correct_channelid(channelid, website):
|
|
62
62
|
# 复制字典channelid, 遍历复制后的字典进行操作以避免在循环中删除元素导致的迭代错误
|
63
63
|
channelid_copy = channelid.copy()
|
64
64
|
# 对channelid的错误进行更正
|
65
|
-
for channelid_key,
|
65
|
+
for channelid_key, channelid_value in channelid_copy.items():
|
66
66
|
# 判断是否为字典
|
67
|
-
if not isinstance(
|
68
|
-
|
69
|
-
channelid[channelid_key] =
|
67
|
+
if not isinstance(channelid_value, dict):
|
68
|
+
channelid_value = {"id": channelid_value}
|
69
|
+
channelid[channelid_key] = channelid_value
|
70
70
|
# 判断id是否正确
|
71
71
|
if (
|
72
|
-
"id" not in
|
72
|
+
"id" not in channelid_value
|
73
73
|
or (
|
74
74
|
website == "youtube"
|
75
|
-
and not re.search(r"^UC.{22}",
|
75
|
+
and not re.search(r"^UC.{22}", channelid_value["id"])
|
76
76
|
)
|
77
|
-
or (website == "bilibili" and not
|
77
|
+
or (website == "bilibili" and not channelid_value["id"].isdigit())
|
78
78
|
):
|
79
79
|
# 删除错误的
|
80
80
|
del channelid[channelid_key]
|
@@ -82,9 +82,9 @@ def correct_channelid(channelid, website):
|
|
82
82
|
else:
|
83
83
|
# 对update_size进行纠正
|
84
84
|
if (
|
85
|
-
"update_size" not in
|
86
|
-
or not isinstance(
|
87
|
-
or
|
85
|
+
"update_size" not in channelid_value
|
86
|
+
or not isinstance(channelid_value["update_size"], int)
|
87
|
+
or channelid_value["update_size"] <= 0
|
88
88
|
):
|
89
89
|
channelid[channelid_key]["update_size"] = default_config[
|
90
90
|
f"channelid_{website}"
|
@@ -92,13 +92,13 @@ def correct_channelid(channelid, website):
|
|
92
92
|
# 对id进行纠正
|
93
93
|
if website == "youtube":
|
94
94
|
channelid[channelid_key]["id"] = re.search(
|
95
|
-
r"UC.{22}",
|
95
|
+
r"UC.{22}", channelid_value["id"]
|
96
96
|
).group()
|
97
97
|
# 对last_size进行纠正
|
98
98
|
if (
|
99
|
-
"last_size" not in
|
100
|
-
or not isinstance(
|
101
|
-
or
|
99
|
+
"last_size" not in channelid_value
|
100
|
+
or not isinstance(channelid_value["last_size"], int)
|
101
|
+
or channelid_value["last_size"] <= 0
|
102
102
|
):
|
103
103
|
channelid[channelid_key]["last_size"] = default_config[
|
104
104
|
f"channelid_{website}"
|
@@ -108,77 +108,77 @@ def correct_channelid(channelid, website):
|
|
108
108
|
channelid[channelid_key]["update_size"],
|
109
109
|
)
|
110
110
|
# 对title进行纠正
|
111
|
-
if "title" not in
|
111
|
+
if "title" not in channelid_value:
|
112
112
|
channelid[channelid_key]["title"] = channelid_key
|
113
113
|
# 对quality进行纠正
|
114
114
|
if (
|
115
115
|
(
|
116
|
-
"quality" not in
|
117
|
-
or
|
116
|
+
"quality" not in channelid_value
|
117
|
+
or channelid_value["quality"] not in dpi
|
118
118
|
)
|
119
|
-
and "media" in
|
120
|
-
and
|
119
|
+
and "media" in channelid_value
|
120
|
+
and channelid_value["media"] == "mp4"
|
121
121
|
):
|
122
122
|
channelid[channelid_key]["quality"] = default_config[
|
123
123
|
f"channelid_{website}"
|
124
124
|
][channelid_name]["quality"]
|
125
125
|
# 对media进行纠正
|
126
126
|
if (
|
127
|
-
"media" in
|
128
|
-
and
|
129
|
-
and
|
127
|
+
"media" in channelid_value
|
128
|
+
and channelid_value["media"] not in media
|
129
|
+
and channelid_value["media"] in video_media
|
130
130
|
):
|
131
131
|
channelid[channelid_key]["media"] = "mp4"
|
132
132
|
elif (
|
133
|
-
"media" in
|
134
|
-
and
|
135
|
-
or "media" not in
|
133
|
+
"media" in channelid_value
|
134
|
+
and channelid_value["media"] not in media
|
135
|
+
or "media" not in channelid_value
|
136
136
|
):
|
137
137
|
channelid[channelid_key]["media"] = "m4a"
|
138
138
|
# 对DisplayRSSaddress进行纠正
|
139
|
-
if "DisplayRSSaddress" not in
|
140
|
-
|
139
|
+
if "DisplayRSSaddress" not in channelid_value or not isinstance(
|
140
|
+
channelid_value["DisplayRSSaddress"], bool
|
141
141
|
):
|
142
142
|
channelid[channelid_key]["DisplayRSSaddress"] = False
|
143
143
|
# 对InmainRSS进行纠正
|
144
|
-
if "InmainRSS" in
|
145
|
-
|
144
|
+
if "InmainRSS" in channelid_value and isinstance(
|
145
|
+
channelid_value["InmainRSS"], bool
|
146
146
|
):
|
147
|
-
if
|
147
|
+
if channelid_value["InmainRSS"] is False:
|
148
148
|
channelid[channelid_key]["DisplayRSSaddress"] = True
|
149
149
|
else:
|
150
150
|
channelid[channelid_key]["InmainRSS"] = True
|
151
151
|
# 对QRcode进行纠正
|
152
|
-
if "QRcode" not in
|
153
|
-
|
152
|
+
if "QRcode" not in channelid_value or not isinstance(
|
153
|
+
channelid_value["QRcode"], bool
|
154
154
|
):
|
155
155
|
channelid[channelid_key]["QRcode"] = False
|
156
156
|
# 对BackwardUpdate进行纠正
|
157
|
-
if "BackwardUpdate" not in
|
158
|
-
|
157
|
+
if "BackwardUpdate" not in channelid_value or not isinstance(
|
158
|
+
channelid_value["BackwardUpdate"], bool
|
159
159
|
):
|
160
160
|
channelid[channelid_key]["BackwardUpdate"] = False
|
161
161
|
# 对BackwardUpdate_size进行纠正
|
162
162
|
if channelid[channelid_key]["BackwardUpdate"] and (
|
163
|
-
"BackwardUpdate_size" not in
|
164
|
-
or not isinstance(
|
165
|
-
or
|
163
|
+
"BackwardUpdate_size" not in channelid_value
|
164
|
+
or not isinstance(channelid_value["BackwardUpdate_size"], int)
|
165
|
+
or channelid_value["BackwardUpdate_size"] <= 0
|
166
166
|
):
|
167
167
|
channelid[channelid_key]["BackwardUpdate_size"] = default_config[
|
168
168
|
f"channelid_{website}"
|
169
169
|
][channelid_name]["BackwardUpdate_size"]
|
170
170
|
# 对want_retry_count进行纠正
|
171
171
|
if (
|
172
|
-
"want_retry_count" not in
|
173
|
-
or not isinstance(
|
174
|
-
or
|
172
|
+
"want_retry_count" not in channelid_value
|
173
|
+
or not isinstance(channelid_value["want_retry_count"], int)
|
174
|
+
or channelid_value["want_retry_count"] <= 0
|
175
175
|
):
|
176
176
|
channelid[channelid_key]["want_retry_count"] = default_config[
|
177
177
|
f"channelid_{website}"
|
178
178
|
][channelid_name]["want_retry_count"]
|
179
179
|
# 对title_change进行纠正
|
180
|
-
if "title_change" in
|
181
|
-
title_changes =
|
180
|
+
if "title_change" in channelid_value:
|
181
|
+
title_changes = channelid_value["title_change"]
|
182
182
|
uphold_title_changes = []
|
183
183
|
if isinstance(title_changes, list):
|
184
184
|
for title_change in title_changes:
|
@@ -208,23 +208,23 @@ def correct_channelid(channelid, website):
|
|
208
208
|
else:
|
209
209
|
del channelid[channelid_key]["title_change"]
|
210
210
|
if website == "bilibili" and (
|
211
|
-
"AllPartGet" not in
|
212
|
-
or not isinstance(
|
211
|
+
"AllPartGet" not in channelid_value
|
212
|
+
or not isinstance(channelid_value["AllPartGet"], bool)
|
213
213
|
):
|
214
214
|
channelid[channelid_key]["AllPartGet"] = (
|
215
215
|
channelid[channelid_key]["update_size"] > 5
|
216
216
|
)
|
217
217
|
if website == "youtube" and (
|
218
|
-
"NoShorts" not in
|
219
|
-
or not isinstance(
|
218
|
+
"NoShorts" not in channelid_value
|
219
|
+
or not isinstance(channelid_value["NoShorts"], bool)
|
220
220
|
):
|
221
221
|
channelid[channelid_key]["NoShorts"] = False
|
222
222
|
if (
|
223
223
|
channelid[channelid_key]["InmainRSS"] is False
|
224
|
-
and f"{config['address']}/channel_rss/{
|
224
|
+
and f"{config['address']}/channel_rss/{channelid_value['id']}.xml"
|
225
225
|
not in parse.shortcuts_url_original
|
226
226
|
):
|
227
227
|
gVar.shortcuts_url[channelid_key] = (
|
228
|
-
f"{config['address']}/channel_rss/{
|
228
|
+
f"{config['address']}/channel_rss/{channelid_value['id']}.xml"
|
229
229
|
)
|
230
230
|
return channelid
|
@@ -21,6 +21,7 @@ from podflow.upload.time_key import check_time_key
|
|
21
21
|
from podflow.basic.folder_build import folder_build
|
22
22
|
from podflow.httpfs.get_channelid import get_channelid
|
23
23
|
from podflow.basic.random_sequence import random_sequence
|
24
|
+
from podflow.upload.find_media_index import find_media_index
|
24
25
|
from podflow.upload.store_users_info import store_users_info
|
25
26
|
|
26
27
|
|
@@ -47,6 +48,7 @@ class bottle_app:
|
|
47
48
|
self.app_bottle.route("/login", callback=self.login)
|
48
49
|
self.app_bottle.route("/upload", method="POST", callback=self.upload)
|
49
50
|
self.app_bottle.route("/flush", method="POST", callback=self.clear_cache)
|
51
|
+
self.app_bottle.route("/remove", method="POST", callback=self.remove)
|
50
52
|
else:
|
51
53
|
self.app_bottle.route("/index", callback=self.index)
|
52
54
|
self.app_bottle.route("/getid", method="POST", callback=self.getid)
|
@@ -278,7 +280,7 @@ class bottle_app:
|
|
278
280
|
self.print_out("newuser", 401)
|
279
281
|
return {
|
280
282
|
"code": -1,
|
281
|
-
"message": "Unauthorized: Invalid Token",
|
283
|
+
"message": "Unauthorized: Invalid Token", # 未经授权: 无效的 Token
|
282
284
|
}
|
283
285
|
|
284
286
|
# 路由处理登陆请求
|
@@ -357,6 +359,12 @@ class bottle_app:
|
|
357
359
|
"code": -6,
|
358
360
|
"message": "ChannelId Does Not Exist", # 频道ID不存在
|
359
361
|
}
|
362
|
+
if not filename:
|
363
|
+
self.print_out("upload", 404)
|
364
|
+
return {
|
365
|
+
"code": -14,
|
366
|
+
"message": "Filename Not Provided", # 未提供文件名
|
367
|
+
}
|
360
368
|
address = f"channel_audiovisual/{channelid}"
|
361
369
|
file_list = os.listdir(address) if os.path.exists(address) else []
|
362
370
|
# 安全地分割文件名和后缀
|
@@ -431,7 +439,7 @@ class bottle_app:
|
|
431
439
|
original_file.seek(0)
|
432
440
|
if upload_hash == build_hash(original_file):
|
433
441
|
self.print_out("upload same", 200)
|
434
|
-
store_users_info(username,filename)
|
442
|
+
store_users_info(username, filename, channelid)
|
435
443
|
close_file()
|
436
444
|
return {
|
437
445
|
"code": 1,
|
@@ -452,7 +460,7 @@ class bottle_app:
|
|
452
460
|
) # 传递文件对象
|
453
461
|
# 打印成功信息并返回成功码
|
454
462
|
self.print_out("upload", 200)
|
455
|
-
store_users_info(username,filename)
|
463
|
+
store_users_info(username, filename, channelid)
|
456
464
|
close_file()
|
457
465
|
return {
|
458
466
|
"code": 0,
|
@@ -465,7 +473,7 @@ class bottle_app:
|
|
465
473
|
# 捕获所有其他可能的异常
|
466
474
|
self.print_out("upload", 500)
|
467
475
|
return {
|
468
|
-
"code": -
|
476
|
+
"code": -10,
|
469
477
|
"message": f"Server Error: {str(e)}", # 将异常信息返回给客户端
|
470
478
|
}
|
471
479
|
finally:
|
@@ -495,7 +503,7 @@ class bottle_app:
|
|
495
503
|
original_file.seek(0)
|
496
504
|
if upload_hash == build_hash(original_file):
|
497
505
|
self.print_out("upload same", 200)
|
498
|
-
store_users_info(username,filename)
|
506
|
+
store_users_info(username, filename, channelid)
|
499
507
|
return {
|
500
508
|
"code": 1,
|
501
509
|
"message": "The Same File Exists", # 相同文件已存在
|
@@ -557,10 +565,155 @@ class bottle_app:
|
|
557
565
|
else:
|
558
566
|
self.print_out("flush", 404)
|
559
567
|
return {
|
560
|
-
"code": -
|
561
|
-
"message": "Cache Does Not Exist", #
|
568
|
+
"code": -12,
|
569
|
+
"message": "Cache Does Not Exist", # 缓存不存在
|
562
570
|
}
|
563
571
|
|
572
|
+
# 路由处理删除请求
|
573
|
+
def remove(self):
|
574
|
+
# 获取已上传数据
|
575
|
+
upload_message = gVar.upload_message
|
576
|
+
# 获取上传数据配置(存储用户名和密码)
|
577
|
+
upload_data = gVar.upload_data
|
578
|
+
# 从请求参数中获取用户名,默认为空字符串
|
579
|
+
username = request.query.get("username", "")
|
580
|
+
# 从请求参数中获取密码,默认为空字符串
|
581
|
+
password = request.query.get("password", "")
|
582
|
+
if username not in upload_data:
|
583
|
+
self.print_out("login", 401)
|
584
|
+
return {
|
585
|
+
"code": -2,
|
586
|
+
"message": "Username Error", # 用户名错误
|
587
|
+
"error": None,
|
588
|
+
}
|
589
|
+
# 验证密码是否正确
|
590
|
+
if upload_data[username] != password:
|
591
|
+
self.print_out("login", 401)
|
592
|
+
return {
|
593
|
+
"code": -3,
|
594
|
+
"message": "Password Error", # 密码错误
|
595
|
+
"error": None,
|
596
|
+
}
|
597
|
+
mode = request.query.get("mode", "")
|
598
|
+
if mode not in ["file", "folder"]:
|
599
|
+
self.print_out("remove", 404)
|
600
|
+
return {
|
601
|
+
"code": -13,
|
602
|
+
"message": "Invalid Mode", # 无效的模式
|
603
|
+
"error": None,
|
604
|
+
}
|
605
|
+
channelid = request.query.get("channel_id", "")
|
606
|
+
if not channelid:
|
607
|
+
# 打印错误信息并返回错误码
|
608
|
+
self.print_out("remove", 404)
|
609
|
+
return {
|
610
|
+
"code": -6,
|
611
|
+
"message": "ChannelId Does Not Exist", # 频道ID不存在
|
612
|
+
"error": None,
|
613
|
+
}
|
614
|
+
if mode == "file":
|
615
|
+
filename = request.query.get("filename", "")
|
616
|
+
if not filename:
|
617
|
+
self.print_out("remove", 404)
|
618
|
+
return {
|
619
|
+
"code": -14,
|
620
|
+
"message": "Filename Not Provided", # 未提供文件名
|
621
|
+
"error": None,
|
622
|
+
}
|
623
|
+
index = find_media_index(upload_message, filename, "mediaid")
|
624
|
+
if index == -1:
|
625
|
+
self.print_out("remove", 404)
|
626
|
+
return{
|
627
|
+
"code": -15,
|
628
|
+
"message": "File Not In Data", # 文件不在数据中
|
629
|
+
"error": None,
|
630
|
+
}
|
631
|
+
if upload_message[index]["channelid"] != channelid:
|
632
|
+
self.print_out("remove", 404)
|
633
|
+
return {
|
634
|
+
"code": -16,
|
635
|
+
"message": "ChannelId Mismatch", # 频道ID不匹配
|
636
|
+
"error": None,
|
637
|
+
}
|
638
|
+
userlist = upload_message[index]["users"]
|
639
|
+
if username not in userlist:
|
640
|
+
self.print_out("remove", 404)
|
641
|
+
return {
|
642
|
+
"code": -17,
|
643
|
+
"message": "User Not In List", # 用户不在列表中
|
644
|
+
"error": None,
|
645
|
+
}
|
646
|
+
try:
|
647
|
+
os.remove(f"channel_audiovisual/{channelid}/{filename}")
|
648
|
+
except FileNotFoundError:
|
649
|
+
self.print_out("remove", 404)
|
650
|
+
return {
|
651
|
+
"code": -18,
|
652
|
+
"message": "File Not Found", # 文件未找到
|
653
|
+
"error": None,
|
654
|
+
}
|
655
|
+
except Exception as e:
|
656
|
+
self.print_out("remove", 500)
|
657
|
+
return {
|
658
|
+
"code": -19,
|
659
|
+
"message": f"Error Removing File: {str(e)}", # 删除文件错误
|
660
|
+
"error": str(e),
|
661
|
+
}
|
662
|
+
if len(userlist) == 1:
|
663
|
+
# 如果用户列表中只有当前用户, 则删除该条记录
|
664
|
+
del upload_message[index]
|
665
|
+
else:
|
666
|
+
# 如果用户列表中有多个用户, 则移除当前用户
|
667
|
+
upload_message[index]["users"].remove(username)
|
668
|
+
self.print_out("remove", 200)
|
669
|
+
return {
|
670
|
+
"code": 4,
|
671
|
+
"message": "File Removed Successfully", # 文件删除成功
|
672
|
+
"error": None,
|
673
|
+
}
|
674
|
+
else:
|
675
|
+
remove_num = 0
|
676
|
+
for item in upload_message:
|
677
|
+
userlist = item["users"]
|
678
|
+
if item["channelid"] == channelid and username in userlist:
|
679
|
+
try:
|
680
|
+
os.remove(f"channel_audiovisual/{channelid}/{item['mediaid']}")
|
681
|
+
remove_num += 1
|
682
|
+
except FileNotFoundError:
|
683
|
+
self.print_out("remove", 404)
|
684
|
+
return {
|
685
|
+
"code": -18,
|
686
|
+
"message": "File Not Found", # 文件未找到
|
687
|
+
"error": None,
|
688
|
+
}
|
689
|
+
except Exception as e:
|
690
|
+
self.print_out("remove", 500)
|
691
|
+
return {
|
692
|
+
"code": -19,
|
693
|
+
"message": f"Error Removing File: {str(e)}", # 删除文件错误
|
694
|
+
"error": str(e),
|
695
|
+
}
|
696
|
+
if len(userlist) == 1:
|
697
|
+
# 如果用户列表中只有当前用户, 则删除该条记录
|
698
|
+
del upload_message[index]
|
699
|
+
else:
|
700
|
+
# 如果用户列表中有多个用户, 则移除当前用户
|
701
|
+
upload_message[index]["users"].remove(username)
|
702
|
+
if remove_num == 0:
|
703
|
+
self.print_out("remove", 404)
|
704
|
+
return {
|
705
|
+
"code": -20,
|
706
|
+
"message": "No Files Found", # 未找到用户的文件
|
707
|
+
"error": None,
|
708
|
+
}
|
709
|
+
else:
|
710
|
+
self.print_out("remove", 200)
|
711
|
+
return {
|
712
|
+
"code": 5,
|
713
|
+
"message": "Folder Removed Successfully", # 文件夹删除成功
|
714
|
+
"error": None,
|
715
|
+
}
|
716
|
+
|
564
717
|
# 路由处理模板文件请求
|
565
718
|
def serve_template_file(self, filepath):
|
566
719
|
template_dir = pkg_resources.resource_filename("podflow", "templates")
|
@@ -12,6 +12,7 @@ import cherrypy
|
|
12
12
|
|
13
13
|
# 基本功能模块
|
14
14
|
from podflow import gVar, parse
|
15
|
+
from podflow.basic.file_save import file_save
|
15
16
|
from podflow.basic.split_dict import split_dict
|
16
17
|
from podflow.basic.time_print import time_print
|
17
18
|
|
@@ -211,9 +212,9 @@ def main_podcast():
|
|
211
212
|
progress_update(0.83, num=0.0049)
|
212
213
|
if gVar.config["remove_media"]:
|
213
214
|
# 删除不在rss中的媒体文件
|
214
|
-
remove_file()
|
215
|
+
remove_file(upload_url)
|
215
216
|
# 删除已抛弃的媒体文件夹
|
216
|
-
remove_dir()
|
217
|
+
remove_dir(upload_url)
|
217
218
|
progress_update(0.84)
|
218
219
|
# 补全缺失媒体文件到字典
|
219
220
|
make_up_file()
|
@@ -257,6 +258,12 @@ def main_podcast():
|
|
257
258
|
if upload_url:
|
258
259
|
thread_upload.join()
|
259
260
|
time_print("频道无更新内容")
|
261
|
+
# 保存需要的变量
|
262
|
+
if parse.save:
|
263
|
+
for save_data in parse.save:
|
264
|
+
file_data = getattr(gVar, save_data, None)
|
265
|
+
if file_data:
|
266
|
+
file_save(file_data, f"{save_data}.json")
|
260
267
|
# 清空变量内数据
|
261
268
|
gVar.channelid_youtube_ids_update.clear() # 需更新的YouTube频道字典
|
262
269
|
gVar.youtube_content_ytid_update.clear() # 需下载YouTube视频字典
|
@@ -170,15 +170,20 @@ error_reason = [
|
|
170
170
|
"text",
|
171
171
|
],
|
172
172
|
[
|
173
|
-
r"Got error: HTTPSConnectionPool\(host='.+\.mcdn\.bilivideo\.cn', port=
|
173
|
+
r"Got error: HTTPSConnectionPool\(host='.+\.mcdn\.bilivideo\.cn', port=[0-9]{4}\): Read timed out\. \(read timeout=20\.0\)",
|
174
174
|
"\033[31m响应超时\033[0m",
|
175
175
|
"regexp",
|
176
176
|
],
|
177
177
|
[
|
178
|
-
r"Got error: \<urllib3\.connection\.HTTPSConnection object at .{18}\>: Failed to establish a new connection: \[WinError 10061\] 由于目标计算机积极拒绝,无法连接。"
|
178
|
+
r"Got error: \<urllib3\.connection\.HTTPSConnection object at .{18}\>: Failed to establish a new connection: \[WinError 10061\] 由于目标计算机积极拒绝,无法连接。",
|
179
179
|
"\033[31m链接拒绝\033[0m",
|
180
180
|
"regexp",
|
181
181
|
],
|
182
|
+
[
|
183
|
+
r"YouTube said: The playlist does not exist.",
|
184
|
+
"\033[31m播放列表不存在\033[0m",
|
185
|
+
"text",
|
186
|
+
],
|
182
187
|
]
|
183
188
|
|
184
189
|
|
@@ -194,6 +199,7 @@ def fail_message_initialize(message_error, video_url):
|
|
194
199
|
.replace("[youtube] ", "")
|
195
200
|
.replace("[download] ", "")
|
196
201
|
.replace("[BiliBili] ", "")
|
202
|
+
.replace("[youtube:tab] ", "")
|
197
203
|
)
|
198
204
|
if video_url[:2] == "BV":
|
199
205
|
fail_message = fail_message.replace(f"{video_url[2:]}: ", "")
|
@@ -1,9 +1,24 @@
|
|
1
|
-
# podflow/message/
|
1
|
+
# podflow/message/update_information_display.py
|
2
2
|
# coding: utf-8
|
3
3
|
|
4
4
|
import re
|
5
5
|
import os
|
6
|
+
from podflow import gVar
|
6
7
|
from podflow.basic.write_log import write_log
|
8
|
+
from podflow.message.want_retry import want_retry
|
9
|
+
|
10
|
+
|
11
|
+
def skip_display(name, channelid_key, channelid_value, id_update):
|
12
|
+
if name == "YouTube":
|
13
|
+
failed_count = gVar.channelid_youtube[channelid_value]["want_retry_count"]
|
14
|
+
elif name == "BiliBili":
|
15
|
+
failed_count = gVar.channelid_bilibili[channelid_value]["want_retry_count"]
|
16
|
+
else:
|
17
|
+
failed_count = 0
|
18
|
+
for video_id in id_update[channelid_key]:
|
19
|
+
if want_retry(video_id, failed_count):
|
20
|
+
return False
|
21
|
+
return True
|
7
22
|
|
8
23
|
|
9
24
|
# 输出需要更新的信息模块
|
@@ -40,11 +55,23 @@ def update_information_display(
|
|
40
55
|
channelid_key in content_id_update
|
41
56
|
and channelid_key in content_id_backward_update
|
42
57
|
):
|
43
|
-
|
58
|
+
if (
|
59
|
+
skip_display(name, channelid_key, channelid_value, content_id_update)
|
60
|
+
and skip_display(name, channelid_key, channelid_value, content_id_backward_update)
|
61
|
+
):
|
62
|
+
print_channelid_ids_update += f"\033[97m{channelid_value}\033[0m"
|
63
|
+
else:
|
64
|
+
print_channelid_ids_update += f"\033[34m{channelid_value}\033[0m"
|
44
65
|
elif channelid_key in content_id_update:
|
45
|
-
|
66
|
+
if skip_display(name, channelid_key, channelid_value, content_id_update):
|
67
|
+
print_channelid_ids_update += f"\033[97m{channelid_value}\033[0m"
|
68
|
+
else:
|
69
|
+
print_channelid_ids_update += f"\033[32m{channelid_value}\033[0m"
|
46
70
|
elif channelid_key in content_id_backward_update:
|
47
|
-
|
71
|
+
if skip_display(name, channelid_key, channelid_value, content_id_backward_update):
|
72
|
+
print_channelid_ids_update += f"\033[97m{channelid_value}\033[0m"
|
73
|
+
else:
|
74
|
+
print_channelid_ids_update += f"\033[36m{channelid_value}\033[0m"
|
48
75
|
else:
|
49
76
|
print_channelid_ids_update += f"\033[33m{channelid_value}\033[0m"
|
50
77
|
# 如果含有特殊字符将使用此输出
|
@@ -73,6 +73,13 @@ def parse_arguments():
|
|
73
73
|
action="store_true",
|
74
74
|
help="Only upload server function, solely for LAN backup (applicable to iOS)",
|
75
75
|
)
|
76
|
+
parser.add_argument(
|
77
|
+
"--save",
|
78
|
+
nargs="*",
|
79
|
+
type=str,
|
80
|
+
metavar="Variable",
|
81
|
+
help="Used during testing",
|
82
|
+
)
|
76
83
|
parser.add_argument("--file", nargs="?", help=argparse.SUPPRESS) # 仅运行在ipynb中
|
77
84
|
# 解析参数
|
78
85
|
args = parser.parse_args()
|
@@ -83,6 +90,7 @@ def parse_arguments():
|
|
83
90
|
parse.httpfs = args.httpfs
|
84
91
|
parse.upload = args.upload
|
85
92
|
parse.index = args.index
|
93
|
+
parse.save = args.save
|
86
94
|
# 检查并处理参数的状态
|
87
95
|
if args.times is not None:
|
88
96
|
parse.update_num = int(args.times[0])
|