提交一些功能
This commit is contained in:
parent
467dbca914
commit
d326670461
|
@ -0,0 +1,5 @@
|
|||
'''
|
||||
获取用户信息
|
||||
比如等级,魔力值,
|
||||
|
||||
'''
|
|
@ -1,6 +1,7 @@
|
|||
from datetime import datetime
|
||||
|
||||
import qbittorrentapi
|
||||
|
||||
'''
|
||||
官方文档:https://qbittorrent-api.readthedocs.io/en/latest/introduction.html
|
||||
'''
|
||||
|
@ -25,18 +26,21 @@ print(f"qBittorrent Web API: {qbt_client.app_web_api_version()}")
|
|||
for k, v in qbt_client.app.build_info.items():
|
||||
print(f"{k}: {v}")
|
||||
|
||||
|
||||
# 从url下载种子 返回 "Ok." 成功 或者 "Fails."失败
|
||||
# add_res = qbt_client.torrents_add(urls="https://www.pttime.org/download.php?id=63655&passkey=b282678479d8f2cb8de1a811a707483d&uid=91145")
|
||||
# print(add_res)
|
||||
# qbt_client.torrents_reannounce()
|
||||
|
||||
def format_stamp(timestamp):
|
||||
return datetime.utcfromtimestamp(timestamp).strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
|
||||
def format_day(timestamp):
|
||||
days = timestamp // (24 * 3600)
|
||||
hours = (timestamp % (24 * 3600)) // 3600
|
||||
return f"{days}天零{hours}小时"
|
||||
|
||||
|
||||
# 检索并显示所有种子
|
||||
for torrent in qbt_client.torrents_info():
|
||||
# 完成任务的时间
|
||||
|
@ -49,10 +53,13 @@ for torrent in qbt_client.torrents_info():
|
|||
last_activity = format_stamp(torrent.last_activity)
|
||||
# 做种时间
|
||||
seeding_time = format_day(torrent.seeding_time)
|
||||
print(f"{torrent.hash[-6:]}: {torrent.name} ({torrent.state})")
|
||||
print(f"任务添加时间:{added_on}, 成任务的时间:{seen_complete} - {completion_on}, 最后活动时间:{last_activity}, 做种时间:{seeding_time}")
|
||||
|
||||
|
||||
# print(f"{torrent.hash[-6:]}: {torrent.name} ({torrent.state})")
|
||||
# print(f"任务添加时间:{added_on}, 成任务的时间:{seen_complete} - {completion_on}, 最后活动时间:{last_activity}, 做种时间:{seeding_time}")
|
||||
print(f"{torrent.progress}")
|
||||
if torrent.progress == 0:
|
||||
# 删除文件
|
||||
qbt_client.torrents_delete(delete_files=True, torrent_hashes=torrent.hash)
|
||||
# qbt_client.torrents_remove_categories()
|
||||
|
||||
# 结束与 qBittorrent 的会话
|
||||
qbt_client.auth_log_out()
|
||||
|
|
Loading…
Reference in New Issue