Browse Source

added tag

master
naomiEve 3 years ago
parent
commit
0f1f93ae6e
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      importer.py

+ 1
- 1
importer.py View File

@ -31,7 +31,7 @@ for f in glob.glob("post/*.txt"):
r += line + "\n"
if r != "": rs.append([*meta, r])
out.write("DELETE FROM x;\n")
out.write("INSERT INTO posts (title, content, author, date_posted, is_op, ip) VALUES (" + con.escape(title) + ", "+con.escape(contents)+", "+con.escape(author)+", "+(make_datetime(rs[0][1]) if len(rs) > 0 else "CURRENT_TIMESTAMP()")+", TRUE, '');\n")
out.write("INSERT INTO posts (title, content, author, date_posted, is_op, ip, tag) VALUES (" + con.escape(title) + ", "+con.escape(contents)+", "+con.escape(author)+", "+(make_datetime(rs[0][1]) if len(rs) > 0 else "CURRENT_TIMESTAMP()")+", TRUE, '', 'imported');\n")
out.write("INSERT INTO x (id) VALUES (LAST_INSERT_ID());\n")
for comment in rs:
out.write("INSERT INTO posts (content, author, parent, date_posted, is_op, ip, is_signed_author) VALUES ("+con.escape(comment[2])+", "+con.escape(comment[0])+", (SELECT id FROM x), "+make_datetime(comment[1])+", FALSE, '', FALSE);\n")


Loading…
Cancel
Save