Revert "Fix for aidg.club website being taken read-only"

This reverts commit 23a031d852.
This commit is contained in:
ebolam 2022-07-19 16:54:32 -04:00
parent c3fdee68a8
commit f58064e72c
1 changed files with 75 additions and 91 deletions

View File

@ -5782,27 +5782,11 @@ def importgame():
def importAidgRequest(id):
exitModes()
#prompts.aidg.club is dead now. They are serving up a sqllite db, so we'll download that if it's not already saved and use that instead
#urlformat = "https://prompts.aidg.club/api/"
#req = requests.get(urlformat+id)
if not os.path.exists("aidgclub.db"):
import urllib.request
urllib.request.urlretrieve("https://prompts.aidg.club/backup.db", "aidgclub.db")
import sqlite3
con = sqlite3.connect("aidgclub.db")
cur = con.cursor()
js = {}
sql = "select * from Prompts where CorrelationId = {}".format(id)
for row in cur.execute(sql):
js['promptContent'] = row[6]
js['memory'] = row[3]
js['authorsNote'] = row[1]
js['worldInfos'] = []
for row in cur.execute("select * from WorldInfos where PromptId = {}".format(id)):
js['worldInfos'].append({'keys': row[2], 'entry': row[1]})
urlformat = "https://prompts.aidg.club/api/"
req = requests.get(urlformat+id)
if(req.status_code == 200):
js = req.json()
# Import game state
vars.gamestarted = True