Fix for aidg.club website being taken read-only
This commit is contained in:
parent
68d143b80c
commit
23a031d852
24
aiserver.py
24
aiserver.py
|
@ -5782,11 +5782,27 @@ def importgame():
|
|||
def importAidgRequest(id):
|
||||
exitModes()
|
||||
|
||||
urlformat = "https://prompts.aidg.club/api/"
|
||||
req = requests.get(urlformat+id)
|
||||
#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]})
|
||||
|
||||
if(req.status_code == 200):
|
||||
js = req.json()
|
||||
|
||||
# Import game state
|
||||
vars.gamestarted = True
|
||||
|
|
Loading…
Reference in New Issue