Fix incorrect reporting of number of torrents by search

This commit is contained in:
j4nk 2024-08-28 21:40:03 -04:00
parent 66eabdda18
commit 71b970e68a
1 changed files with 3 additions and 1 deletions

4
bot.py
View File

@ -350,11 +350,13 @@ class QBBot(slixmpp.ClientXMPP):
self.api_caller.search_delete(search_id)
parsed_res = json.loads(res.text)
message += "```\n"
message += "Total results for \"" + search_string + "\": " + str(parsed_res["total"]) + "\n"
the_list = [[r["fileName"], r["fileUrl"], str(r["nbSeeders"]), r["fileSize"]] for r in parsed_res["results"]]
# Remove torrents with no seeds from the search results
the_list = [i for i in the_list if int(i[2]) != 0]
# Report the number of torrents in the search results
message += "Total results for \"" + search_string + "\": " + str(len(the_list)) + "\n"
message += "\n".join([str(i) + ". " + l[0] + ", "
"seeds: " + str(l[2]) + ", "
"size: " + '{0:.2f}'.format(int(l[3])/1024/1024/1024) + " GB"