mirror of
https://github.com/simon987/opendirectories-bot-2.git
synced 2025-04-20 02:26:42 +00:00
Don't display result table when there is no results
This commit is contained in:
parent
c0891aa5e1
commit
faf0eee0fd
1
od_database
Submodule
1
od_database
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 1ff1e039f5aed3394cd9ff0f0e6e4b88d3b0618e
|
@ -90,8 +90,9 @@ class OdDatabase:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def format_search_hits(hits, query):
|
def format_search_hits(hits, query):
|
||||||
|
|
||||||
message = str(hits["hits"]["total"]) + " matches found in " + str(hits["took"]) + "ms for query `" + query + "`: \n\n"
|
message = str(hits["hits"]["total"]) + " matches found in " + str(hits["took"]) + "ms for query `" + query + "`"
|
||||||
message += "File | Size | Date \n"
|
if hits["hits"]["total"] > 0:
|
||||||
|
message += ": \n\n"
|
||||||
message += ":-- | :-- | --: \n"
|
message += ":-- | :-- | --: \n"
|
||||||
|
|
||||||
for hit in hits["hits"]["hits"]:
|
for hit in hits["hits"]["hits"]:
|
||||||
@ -117,6 +118,8 @@ class OdDatabase:
|
|||||||
message += hl_name + ("." if src["ext"] else "") + src["ext"] + " | "
|
message += hl_name + ("." if src["ext"] else "") + src["ext"] + " | "
|
||||||
message += humanfriendly.format_size(src["size"]) + " | "
|
message += humanfriendly.format_size(src["size"]) + " | "
|
||||||
message += time.strftime("%Y-%m-%d", time.gmtime(src["mtime"])) + " \n"
|
message += time.strftime("%Y-%m-%d", time.gmtime(src["mtime"])) + " \n"
|
||||||
|
else:
|
||||||
|
message += "\n"
|
||||||
|
|
||||||
message += "\n[More results for this query](https://od-db.the-eye.eu/search?q=" + query + ") |" \
|
message += "\n[More results for this query](https://od-db.the-eye.eu/search?q=" + query + ") |" \
|
||||||
" [OD-Database](https://od-db.the-eye.eu/)"
|
" [OD-Database](https://od-db.the-eye.eu/)"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user