Skip to content

Commit b923925

Browse files
committed
fix: 合并冲突
2 parents 56be5c9 + 0e2e41d commit b923925

File tree

18 files changed

+83
-28
lines changed

18 files changed

+83
-28
lines changed

app/downloader/client/qbittorrent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def __login_qbittorrent(self):
7676
username=self.username,
7777
password=self.password,
7878
VERIFY_WEBUI_CERTIFICATE=False,
79-
REQUESTS_ARGS={'timeout': (10, 30)})
79+
REQUESTS_ARGS={'timeout': (15, 60)})
8080
try:
8181
qbt.auth_log_in()
8282
self.ver = qbt.app_version()
@@ -580,7 +580,7 @@ def get_download_dirs(self):
580580
return []
581581
ret_dirs = []
582582
try:
583-
categories = self.qbc.torrents_categories(requests_args={'timeout': (5, 10)}) or {}
583+
categories = self.qbc.torrents_categories(requests_args={'timeout': (10, 30)}) or {}
584584
except Exception as err:
585585
ExceptionUtils.exception_traceback(err)
586586
return []

app/downloader/client/transmission.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def __login_transmission(self):
7474
port=self.port,
7575
username=self.username,
7676
password=self.password,
77-
timeout=30)
77+
timeout=60)
7878
return trt
7979
except Exception as err:
8080
ExceptionUtils.exception_traceback(err)
@@ -482,7 +482,7 @@ def get_download_dirs(self):
482482
if not self.trc:
483483
return []
484484
try:
485-
return [self.trc.get_session(timeout=10).download_dir]
485+
return [self.trc.get_session(timeout=30).download_dir]
486486
except Exception as err:
487487
ExceptionUtils.exception_traceback(err)
488488
return []

app/media/meta/customization.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ def match(self, title=None):
2424
if not self.customization:
2525
return ""
2626
customization_re = re.compile(r"%s" % self.customization)
27-
# 处理重复多次的情况,保留先后顺序
28-
unique_customization = []
27+
# 处理重复多次的情况,保留先后顺序(按添加自定义占位符的顺序)
28+
unique_customization = {}
2929
for item in re.findall(customization_re, title):
30-
if item not in unique_customization:
31-
unique_customization.append(item)
30+
for i in range(len(item)):
31+
if item[i] and unique_customization.get(item[i]) is None:
32+
unique_customization[item[i]] = i
33+
unique_customization = list(dict(sorted(unique_customization.items(), key=lambda x: x[1])).keys())
3234
separator = self.custom_separator or "@"
3335
return separator.join(unique_customization)
3436

app/plugins/modules/_autosignin/hdchina.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,37 @@ def signin(self, site_info: dict):
3737
ua = site_info.get("ua")
3838
proxy = Config().get_proxies() if site_info.get("proxy") else None
3939

40+
# 尝试解决瓷器cookie每天签到后过期,只保留hdchina=部分
41+
cookie = ""
42+
# 按照分号进行字符串拆分
43+
sub_strs = site_cookie.split(";")
44+
# 遍历每个子字符串
45+
for sub_str in sub_strs:
46+
if "hdchina=" in sub_str:
47+
# 如果子字符串包含"hdchina=",则保留该子字符串
48+
cookie += sub_str + ";"
49+
50+
if "hdchina=" not in cookie:
51+
self.error(f"签到失败,cookie失效")
52+
return False, f'【{site}】签到失败,cookie失效'
53+
54+
site_cookie = cookie
4055
# 获取页面html
4156
html_res = RequestUtils(cookies=site_cookie,
4257
headers=ua,
4358
proxies=proxy
44-
).get_res(url="https://hdchina.org/")
59+
).get_res(url="https://hdchina.org/index.php")
4560
if not html_res or html_res.status_code != 200:
4661
self.error(f"签到失败,请检查站点连通性")
4762
return False, f'【{site}】签到失败,请检查站点连通性'
4863

49-
if "login.php" in html_res.text:
64+
if "login.php" in html_res.text or "阻断页面" in html_res.text:
5065
self.error(f"签到失败,cookie失效")
5166
return False, f'【{site}】签到失败,cookie失效'
5267

68+
# 获取新返回的cookie进行签到
69+
site_cookie = ';'.join(['{}={}'.format(k, v) for k, v in html_res.cookies.get_dict().items()])
70+
5371
# 判断是否已签到
5472
html_res.encoding = "utf-8"
5573
sign_status = self.sign_in_result(html_res=html_res.text,

app/plugins/modules/_autosignin/pterclub.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def signin(self, site_info: dict):
4545
return False, f'【{site}】签到失败,请检查cookie是否失效'
4646

4747
sign_dict = json.loads(sign_res.text)
48+
self.debug(f"签到接口返回参数 {sign_dict}")
4849
if sign_dict['status'] == 1:
4950
# {"status":"1","data":" (签到已成功300)","message":"<p>这是您的第<b>237</b>次签到,
5051
# 已连续签到<b>237</b>天。</p><p>本次签到获得<b>300</b>克猫粮。</p>"}

app/plugins/modules/_autosignin/u2.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import random
22
import re
3+
import datetime
34

45
from lxml import etree
56

@@ -45,6 +46,12 @@ def signin(self, site_info: dict):
4546
ua = site_info.get("ua")
4647
proxy = Config().get_proxies() if site_info.get("proxy") else None
4748

49+
now = datetime.datetime.now()
50+
# 判断当前时间是否小于9点
51+
if now.hour < 9:
52+
self.error(f"签到失败,9点前不签到")
53+
return False, f'【{site}】签到失败,9点前不签到'
54+
4855
# 获取页面html
4956
html_res = RequestUtils(cookies=site_cookie,
5057
headers=ua,

app/plugins/modules/autobackup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,12 @@ def __backup(self):
228228

229229
# 发送通知
230230
if self._notify:
231+
next_run_time = self._scheduler.get_jobs()[0].next_run_time.strftime('%Y-%m-%d %H:%M:%S')
231232
self.send_message(title="【自动备份任务完成】",
232233
text=f"创建备份{'成功' if zip_file else '失败'}\n"
233234
f"清理备份数量 {del_cnt}\n"
234-
f"剩余备份数量 {bk_cnt - del_cnt}")
235+
f"剩余备份数量 {bk_cnt - del_cnt} \n"
236+
f"下次备份时间: {next_run_time}")
235237

236238
def stop_service(self):
237239
"""

app/plugins/modules/autosignin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,14 @@ def sign_in(self, event=None):
336336

337337
# 发送通知
338338
if self._notify:
339+
next_run_time = self._scheduler.get_jobs()[0].next_run_time.strftime('%Y-%m-%d %H:%M:%S')
339340
# 签到汇总信息
340341
self.send_message(title="【自动签到任务完成】",
341342
text=f"本次签到数量: {len(sign_sites)} \n"
342343
f"命中重试数量: {len(retry_sites) if self._retry_keyword else 0} \n"
344+
f"强制签到数量: {len(self._special_sites)} \n"
343345
f"下次签到数量: {len(set(retry_sites + self._special_sites))} \n"
346+
f"下次签到时间: {next_run_time} \n"
344347
f"详见签到消息")
345348
else:
346349
self.error("站点签到任务失败!")

app/plugins/modules/customization.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def get_fields():
5555
{
5656
'title': '自定义分隔符',
5757
'required': "",
58-
'tooltip': '当匹配到多个结果时,使用此分隔符进行分隔,留空使用@;如名称中识别出A和B,分隔符为@,则结果为A@B',
58+
'tooltip': '当匹配到多个结果时,使用此分隔符进行分隔,留空使用@;如名称中识别出A和B,分隔符为@,则结果为A@B,按添加自定义占位符的顺序',
5959
'type': 'text',
6060
'content': [
6161
{
@@ -77,15 +77,12 @@ def init_config(self, config=None):
7777
customization = config.get('customization')
7878
custom_separator = config.get('separator')
7979
if customization:
80-
if customization.startswith(';'):
81-
customization = customization[1:]
82-
if customization.endswith(';'):
83-
customization = customization[:-1]
84-
customization = customization.replace(";", "|").replace("\n", "|")
80+
customization = customization.replace("\n", ";").strip(";").split(";")
81+
customization = "|".join([f"({item})" for item in customization])
8582
if customization:
8683
self.info("自定义占位符已加载")
8784
if custom_separator:
88-
self.info(f"自定义分隔符{custom_separator}已加载")
85+
self.info(f"自定义分隔符 {custom_separator} 已加载")
8986
self._customization_matcher.update_custom(customization, custom_separator)
9087
self._customization = customization
9188
self._custom_separator = custom_separator

app/plugins/modules/customreleasegroups.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def init_config(self, config=None):
8686
if custom_release_groups:
8787
self.info("自定义制作组/字幕组已加载")
8888
if custom_separator:
89-
self.info(f"自定义分隔符{custom_separator}已加载")
89+
self.info(f"自定义分隔符 {custom_separator} 已加载")
9090
self._release_groups_matcher.update_custom(custom_release_groups, custom_separator)
9191
self._custom_release_groups = custom_release_groups
9292
self._custom_separator = custom_separator

0 commit comments

Comments
 (0)