15 lines
544 B
Python
Executable File
15 lines
544 B
Python
Executable File
import sqlite3
|
|
import sys
|
|
con = sqlite3.connect("index.db")
|
|
cur = con.cursor()
|
|
cur2 = con.cursor()
|
|
|
|
q=f"%{sys.argv[1]}%"
|
|
|
|
res = cur.execute("select books.id, books.title, data.format , book_content.content from books, data, book_content where ( author_sort like ? or title like ? ) and books.id = data.book and books.id = book_content.id ", (q,q))
|
|
for id, title, format, content in res:
|
|
print(f"{title}.{format.lower()}")
|
|
filename = f"{title}.{format.lower()}"
|
|
with open(filename, mode='wb') as file:
|
|
file.write( content )
|