Rewrite export script in Python; use build dir
This commit is contained in:
parent
e5e046b70d
commit
aa8fa31195
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -141,3 +141,4 @@ cython_debug/
|
||||||
*.db
|
*.db
|
||||||
*.db-journal
|
*.db-journal
|
||||||
*.gptc
|
*.gptc
|
||||||
|
build/
|
||||||
|
|
20
export.py
Normal file
20
export.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import sqlite3
|
||||||
|
|
||||||
|
try:
|
||||||
|
shutil.rmtree("build")
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
os.mkdir("build")
|
||||||
|
|
||||||
|
shutil.copy("articles.db", "build/articles.db")
|
||||||
|
shutil.copy("sources.toml", "build/sources.toml")
|
||||||
|
shutil.copy("model.gptc", "build/model.gptc")
|
||||||
|
|
||||||
|
con = sqlite3.Connection("build/articles.db")
|
||||||
|
con.execute("UPDATE articles SET text = '***';")
|
||||||
|
con.commit()
|
||||||
|
con.execute("VACUUM;")
|
||||||
|
con.commit()
|
||||||
|
con.close()
|
Loading…
Reference in New Issue
Block a user