Added styling to list command, made list truncation apply for

completed torrents
This commit is contained in:
j4nk 2024-07-28 13:00:36 -04:00
parent db6babb13b
commit 6362ab36f9
2 changed files with 4 additions and 3 deletions

6
bot.py
View File

@ -93,7 +93,7 @@ class QBittorrentAPICaller():
def torrentList(self, modifier=""):
the_url = self.url + "/" + "api/v2/torrents/info"
to_ret = ""
to_ret = "```"
for f in ["downloading", "completed"]:
resp = self.session.post(the_url, data={"filter":f})
if resp.status_code != 200:
@ -106,9 +106,9 @@ class QBittorrentAPICaller():
to_ret += (self.truncate_string(p["name"]) if modifier == "full" else p["name"]) + " | " + "{:.2f}".format(float(p["progress"])*100) + "% | " + "{:.2f}".format(float(p["dlspeed"])/1000000) + " MB/s" + " | " + str(datetime.timedelta(seconds=int(p["eta"]))) + "\n"
else:
for p in parsed:
to_ret += p["name"] + "\n"
to_ret += (self.truncate_string(p["name"]) if modifier == "full" else p["name"]) + "\n"
to_ret += "--\n"
to_ret += "--\n```"
return to_ret

View File

@ -3,6 +3,7 @@
apk add python3
apk add py3-pip
pip3 install --break-system-packages slixmpp
apk add py3-requests
exec python3 /bot.py