22 line
555 B
Python
Executable File
22 line
555 B
Python
Executable File
#!/usr/bin/python3
|
|
import sqlite3
|
|
import sys
|
|
import config
|
|
|
|
dbcon = sqlite3.connect(config.DBPATH, isolation_level=None)
|
|
cursor = dbcon.cursor()
|
|
|
|
if len(sys.argv) < 2:
|
|
print("Error: Missing search")
|
|
|
|
search=sys.argv[1:]
|
|
#TODO: machien parseable
|
|
for row in cursor.execute("SELECT file.path, contents.page FROM file INNER JOIN contents ON file.id = contents.fileid INNER JOIN content_fts ON contents.id = content_fts.ROWID WHERE content_fts.content MATCH ? ORDER By file.mtime ASC", (search)):
|
|
print("File:", row[0], "Page: ", row[1])
|
|
dbcon.close()
|
|
|
|
|
|
|
|
|
|
|