added extract
This commit is contained in:
parent
3183a2a1b4
commit
53f77cf823
14
scripts/extract.py
Executable file
14
scripts/extract.py
Executable file
@ -0,0 +1,14 @@
|
||||
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 )
|
||||
Loading…
Reference in New Issue
Block a user