1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Bump version

This commit is contained in:
Steffo 2019-11-09 16:41:22 +01:00
parent 697f5fb577
commit 58b37f478c
2 changed files with 1 additions and 34 deletions

View file

@ -1,33 +0,0 @@
import os
import re
import datetime
import difflib
import uuid
from royalnet.database import Alchemy
from royalnet.packs.common.tables import User
from royalnet.packs.royal.tables import WikiPage, WikiRevision
if __name__ == "__main__":
alchemy = Alchemy(os.environ["DB_PATH"], {User, WikiPage, WikiRevision})
with open(r"data.txt") as file, alchemy.session_cm() as session:
for line in file.readlines():
match = re.match("^([^\t]+)\t([^\t]+)\t([tf])$", line)
if match is None:
continue
title = match.group(1)
content = match.group(2).replace(r"\r\n", "\n").replace(r"\t", "\t")
page = alchemy.WikiPage(page_id=uuid.uuid4(),
title=title,
content=content)
session.flush()
revision = alchemy.WikiRevision(revision_id=uuid.uuid4(),
page=page,
author_id=31, # Royalbot
timestamp=datetime.datetime.now(),
reason="Imported from 'four' database",
diff="\n".join(difflib.unified_diff([], content.split("\n"))))
session.add(page)
session.add(revision)
print(f"{title} done.")
session.commit()

View file

@ -1,4 +1,4 @@
semantic = "5.0a90"
semantic = "5.0a91"
if __name__ == "__main__":
print(semantic)