mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
Bump version
This commit is contained in:
parent
697f5fb577
commit
58b37f478c
2 changed files with 1 additions and 34 deletions
|
@ -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()
|
|
|
@ -1,4 +1,4 @@
|
||||||
semantic = "5.0a90"
|
semantic = "5.0a91"
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print(semantic)
|
print(semantic)
|
||||||
|
|
Loading…
Reference in a new issue