mirror of
https://github.com/Cp0204/quark-auto-save.git
synced 2026-01-17 01:40:44 +08:00
代码调整
This commit is contained in:
parent
fe85478d8c
commit
a8a6675eee
@ -471,11 +471,8 @@ class Quark:
|
|||||||
# print("share_file_list: ", share_file_list)
|
# print("share_file_list: ", share_file_list)
|
||||||
|
|
||||||
# 获取目标目录文件列表
|
# 获取目标目录文件列表
|
||||||
task["savepath_fid"] = (
|
if not task.get("savepath_fid"):
|
||||||
task.get("savepath_fid")
|
task["savepath_fid"] = self.get_fids([task["savepath"]])[0]["fid"]
|
||||||
if task.get("savepath_fid")
|
|
||||||
else self.get_fids([task["savepath"]])[0]["fid"]
|
|
||||||
)
|
|
||||||
to_pdir_fid = task["savepath_fid"]
|
to_pdir_fid = task["savepath_fid"]
|
||||||
dir_file_list = self.ls_dir(to_pdir_fid)
|
dir_file_list = self.ls_dir(to_pdir_fid)
|
||||||
# print("dir_file_list: ", dir_file_list)
|
# print("dir_file_list: ", dir_file_list)
|
||||||
@ -595,7 +592,9 @@ class Emby:
|
|||||||
response = requests.request("GET", url, headers=headers, params=querystring)
|
response = requests.request("GET", url, headers=headers, params=querystring)
|
||||||
if "application/json" in response.headers["Content-Type"]:
|
if "application/json" in response.headers["Content-Type"]:
|
||||||
response = response.json()
|
response = response.json()
|
||||||
print(f"Emby媒体库: {response.get("ServerName","")} v{response.get("Version","")}")
|
print(
|
||||||
|
f"Emby媒体库: {response.get('ServerName','')} v{response.get('Version','')}"
|
||||||
|
)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
print(f"Emby媒体库: 连接失败❌ {response.text}")
|
print(f"Emby媒体库: 连接失败❌ {response.text}")
|
||||||
@ -704,7 +703,7 @@ def do_sign(account):
|
|||||||
add_notify(message)
|
add_notify(message)
|
||||||
else:
|
else:
|
||||||
print(f"📅 执行签到: {sign_return}")
|
print(f"📅 执行签到: {sign_return}")
|
||||||
print(f"")
|
print()
|
||||||
|
|
||||||
|
|
||||||
def do_save(account):
|
def do_save(account):
|
||||||
@ -735,7 +734,7 @@ def do_save(account):
|
|||||||
for index, task in enumerate(tasklist):
|
for index, task in enumerate(tasklist):
|
||||||
# 判断任务期限
|
# 判断任务期限
|
||||||
if check_date(task):
|
if check_date(task):
|
||||||
print(f"")
|
print()
|
||||||
print(f"#{index+1}------------------")
|
print(f"#{index+1}------------------")
|
||||||
print(f"任务名称: {task['taskname']}")
|
print(f"任务名称: {task['taskname']}")
|
||||||
print(f"分享链接: {task['shareurl']}")
|
print(f"分享链接: {task['shareurl']}")
|
||||||
@ -760,7 +759,7 @@ def do_save(account):
|
|||||||
if match_emby_id:
|
if match_emby_id:
|
||||||
task["emby_id"] = match_emby_id
|
task["emby_id"] = match_emby_id
|
||||||
emby.refresh(match_emby_id)
|
emby.refresh(match_emby_id)
|
||||||
print(f"")
|
print()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -768,7 +767,7 @@ def main():
|
|||||||
start_time = datetime.now()
|
start_time = datetime.now()
|
||||||
print(f"===============程序开始===============")
|
print(f"===============程序开始===============")
|
||||||
print(f"⏰ 执行时间: {start_time.strftime('%Y-%m-%d %H:%M:%S')}")
|
print(f"⏰ 执行时间: {start_time.strftime('%Y-%m-%d %H:%M:%S')}")
|
||||||
print(f"")
|
print()
|
||||||
# 启动参数
|
# 启动参数
|
||||||
arguments = sys.argv
|
arguments = sys.argv
|
||||||
if len(arguments) > 1:
|
if len(arguments) > 1:
|
||||||
@ -805,18 +804,18 @@ def main():
|
|||||||
print(f"===============签到任务===============")
|
print(f"===============签到任务===============")
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
do_sign(account)
|
do_sign(account)
|
||||||
print(f"")
|
print()
|
||||||
# 转存
|
# 转存
|
||||||
if accounts[0].is_active and cookie_form_file:
|
if accounts[0].is_active and cookie_form_file:
|
||||||
print(f"===============转存任务===============")
|
print(f"===============转存任务===============")
|
||||||
do_save(accounts[0])
|
do_save(accounts[0])
|
||||||
print(f"")
|
print()
|
||||||
# 通知
|
# 通知
|
||||||
if notifys:
|
if notifys:
|
||||||
notify_body = "\n".join(notifys)
|
notify_body = "\n".join(notifys)
|
||||||
print(f"===============推送通知===============")
|
print(f"===============推送通知===============")
|
||||||
send_ql_notify("【夸克自动追更】", notify_body)
|
send_ql_notify("【夸克自动追更】", notify_body)
|
||||||
print(f"")
|
print()
|
||||||
if cookie_form_file:
|
if cookie_form_file:
|
||||||
# 更新配置
|
# 更新配置
|
||||||
with open(config_path, "w", encoding="utf-8") as file:
|
with open(config_path, "w", encoding="utf-8") as file:
|
||||||
@ -825,7 +824,7 @@ def main():
|
|||||||
print(f"===============程序结束===============")
|
print(f"===============程序结束===============")
|
||||||
duration = datetime.now() - start_time
|
duration = datetime.now() - start_time
|
||||||
print(f"😃 运行时长: {round(duration.total_seconds(), 2)}s")
|
print(f"😃 运行时长: {round(duration.total_seconds(), 2)}s")
|
||||||
print(f"")
|
print()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user