Fix incorrect reporting of number of torrents by search
This commit is contained in:
parent
66eabdda18
commit
71b970e68a
4
bot.py
4
bot.py
|
@ -350,11 +350,13 @@ class QBBot(slixmpp.ClientXMPP):
|
||||||
self.api_caller.search_delete(search_id)
|
self.api_caller.search_delete(search_id)
|
||||||
parsed_res = json.loads(res.text)
|
parsed_res = json.loads(res.text)
|
||||||
message += "```\n"
|
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"]]
|
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
|
# Remove torrents with no seeds from the search results
|
||||||
the_list = [i for i in the_list if int(i[2]) != 0]
|
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] + ", "
|
message += "\n".join([str(i) + ". " + l[0] + ", "
|
||||||
"seeds: " + str(l[2]) + ", "
|
"seeds: " + str(l[2]) + ", "
|
||||||
"size: " + '{0:.2f}'.format(int(l[3])/1024/1024/1024) + " GB"
|
"size: " + '{0:.2f}'.format(int(l[3])/1024/1024/1024) + " GB"
|
||||||
|
|
Loading…
Reference in New Issue