mirror of
https://github.com/sherlock-project/sherlock
synced 2024-11-15 08:47:08 +00:00
add number of results in the end of the process
This commit is contained in:
parent
548180749d
commit
62d77c3346
1 changed files with 30 additions and 7 deletions
|
@ -6,6 +6,7 @@ results of queries.
|
|||
from result import QueryStatus
|
||||
from colorama import Fore, Style
|
||||
|
||||
globvar = 0
|
||||
|
||||
class QueryNotify:
|
||||
"""Query Notify Object.
|
||||
|
@ -103,7 +104,6 @@ class QueryNotify:
|
|||
"""
|
||||
return str(self.result)
|
||||
|
||||
|
||||
class QueryNotifyPrint(QueryNotify):
|
||||
"""Query Notify Print Object.
|
||||
|
||||
|
@ -185,6 +185,20 @@ class QueryNotifyPrint(QueryNotify):
|
|||
|
||||
# return
|
||||
|
||||
def countResults(self):
|
||||
"""Count the number of results. Every time the fuction is called,
|
||||
the number of results is increasing.
|
||||
|
||||
Keyword Arguments:
|
||||
self -- This object.
|
||||
|
||||
Return Value:
|
||||
The number of results by the time we call the function.
|
||||
"""
|
||||
global globvar
|
||||
globvar += 1
|
||||
return globvar
|
||||
|
||||
def update(self, result):
|
||||
"""Notify Update.
|
||||
|
||||
|
@ -206,6 +220,7 @@ class QueryNotifyPrint(QueryNotify):
|
|||
|
||||
# Output to the terminal is desired.
|
||||
if result.status == QueryStatus.CLAIMED:
|
||||
self.countResults()
|
||||
print(Style.BRIGHT + Fore.WHITE + "[" +
|
||||
Fore.GREEN + "+" +
|
||||
Fore.WHITE + "]" +
|
||||
|
@ -255,10 +270,18 @@ class QueryNotifyPrint(QueryNotify):
|
|||
Will print the last line to the standard output.
|
||||
Keyword Arguments:
|
||||
self -- This object.
|
||||
message -- The last phrase.
|
||||
message -- The 2 last phrases.
|
||||
Return Value:
|
||||
Nothing.
|
||||
"""
|
||||
numberOfResults = self.countResults() - 1
|
||||
|
||||
title = "Results:"
|
||||
|
||||
print(Style.BRIGHT + Fore.GREEN + "[" +
|
||||
Fore.YELLOW + "*" +
|
||||
Fore.GREEN + f"] {title}" +
|
||||
Fore.WHITE + f" {numberOfResults}" )
|
||||
|
||||
title = "End"
|
||||
|
||||
|
|
Loading…
Reference in a new issue