forked from dalmoveras/midnight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.py
30 lines (25 loc) · 851 Bytes
/
search.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from modules.sqlite import *
from modules.helpers import *
def main():
try:
searchTitle()
con = connectDB()
createFTStable(con)
populateFTS(con)
searchTitle()
try:
while(True):
term = input("Enter search term: ")
results = searchFTS(term, con)
print("Found " + str(len(results)) + " results.")
for i in results:
string = ""
for j in i:
string += j
print(string)
except KeyboardInterrupt:
print('\n\nBye...')
except:
print("It looks like you didn't runned midnight yet.\nThere's no db for us to search. \nYou must run: python3 midnight.py \nbefore you can search")
if __name__ == '__main__':
main()