Added styling to list command, made list truncation apply for
completed torrents
This commit is contained in:
parent
db6babb13b
commit
6362ab36f9
6
bot.py
6
bot.py
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue