got area working in a flat text field; TODO make area table and refactor
parent
83f140d3a6
commit
a57b6577f8
|
@ -44,7 +44,15 @@ def main():
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
c.execute(stmt)
|
c.execute(stmt)
|
||||||
stypes = c.fetchall()
|
stypes = c.fetchall()
|
||||||
# print(traits)
|
|
||||||
|
# TODO FIX THIS FOR SPELL COMPONENTS
|
||||||
|
|
||||||
|
# load in ids for spelltypes from spelltypes table so we only call this once
|
||||||
|
# instead of every spell
|
||||||
|
stmt = "SELECT spelltypes_id, name FROM spelltypes"
|
||||||
|
c = conn.cursor()
|
||||||
|
c.execute(stmt)
|
||||||
|
stypes = c.fetchall()
|
||||||
|
|
||||||
# List the various triggers and see if there are any duplicates
|
# List the various triggers and see if there are any duplicates
|
||||||
# THERE ARE NOT IN THE CRB SO NOT BOTHERING WITH SEPARATE TRIGGERS TABLE YET
|
# THERE ARE NOT IN THE CRB SO NOT BOTHERING WITH SEPARATE TRIGGERS TABLE YET
|
||||||
|
@ -65,6 +73,8 @@ def main():
|
||||||
do_sources_pages(i,id,conn)
|
do_sources_pages(i,id,conn)
|
||||||
do_spell_traits(i,id,conn,traits)
|
do_spell_traits(i,id,conn,traits)
|
||||||
do_spell_types(i,id,conn,stypes)
|
do_spell_types(i,id,conn,stypes)
|
||||||
|
# TODO spell components
|
||||||
|
# TODO spell targets
|
||||||
|
|
||||||
def do_spell_types(i,id,conn,stypes):
|
def do_spell_types(i,id,conn,stypes):
|
||||||
res = 0
|
res = 0
|
||||||
|
@ -178,8 +188,9 @@ def do_basic_sql(i, id, conn):
|
||||||
level,
|
level,
|
||||||
descr,
|
descr,
|
||||||
range_text,
|
range_text,
|
||||||
trigger)
|
trigger,
|
||||||
VALUES (?,?,?,?,?,?,?,?,?)"""
|
area_text)
|
||||||
|
VALUES (?,?,?,?,?,?,?,?,?,?)"""
|
||||||
|
|
||||||
rge = None
|
rge = None
|
||||||
if 'range' in i:
|
if 'range' in i:
|
||||||
|
@ -193,7 +204,11 @@ def do_basic_sql(i, id, conn):
|
||||||
if 'trigger' in i:
|
if 'trigger' in i:
|
||||||
trg = i['trigger']
|
trg = i['trigger']
|
||||||
|
|
||||||
inp = (id, 1, i['source'], i['nethysUrl'], i['name'], i['level'], dscr, rge, trg)
|
area = None
|
||||||
|
if 'area' in i:
|
||||||
|
area = i['area']
|
||||||
|
|
||||||
|
inp = (id, 1, i['source'], i['nethysUrl'], i['name'], i['level'], dscr, rge, trg, area)
|
||||||
try:
|
try:
|
||||||
conn.execute(stmt, inp)
|
conn.execute(stmt, inp)
|
||||||
except:
|
except:
|
||||||
|
|
|
@ -26,17 +26,21 @@ CREATE TABLE spellschools (
|
||||||
|
|
||||||
-- TODO eventually once data is finalized, lock down variables as NOT NULL /
|
-- TODO eventually once data is finalized, lock down variables as NOT NULL /
|
||||||
-- UNIQUE as sanity requires :)
|
-- UNIQUE as sanity requires :)
|
||||||
|
-- TODO Area eventually needs its own table
|
||||||
CREATE TABLE spells (
|
CREATE TABLE spells (
|
||||||
spells_id INTEGER PRIMARY KEY,
|
spells_id INTEGER PRIMARY KEY,
|
||||||
sources_id INTEGER NOT NULL, -- generated in spells.py from scraped data
|
sources_id INTEGER NOT NULL, -- generated in spells.py from scraped data
|
||||||
sources_pages TEXT, -- generated in spells.py from scraped data
|
sources_pages TEXT, -- generated in spells.py from scraped data
|
||||||
name TEXT NOT NULL UNIQUE, -- scraped from github repo
|
name TEXT NOT NULL UNIQUE, -- scraped from github repo
|
||||||
level INTEGER, -- scraped from github repo
|
level INTEGER, -- scraped from github repo
|
||||||
trigger TEXT, -- scraped from spells.py NOTE, there are no duplicate triggers as of CRB, so not bothering with a separate spell triggers table at this time
|
trigger TEXT, -- scraped from spells.py NOTE, there are no duplicate triggers
|
||||||
|
-- as of CRB, so not bothering with a separate spell triggers
|
||||||
|
-- table at this time
|
||||||
descr TEXT, -- scraped from github repo
|
descr TEXT, -- scraped from github repo
|
||||||
spelltypes_id INTEGER, -- generated from spells.py
|
spelltypes_id INTEGER, -- generated from spells.py
|
||||||
range_text TEXT, -- scraped from github repo
|
range_text TEXT, -- scraped from github repo
|
||||||
range_ft INTEGER, -- generated from text in spells.py
|
range_ft INTEGER, -- generated from text in spells.py
|
||||||
|
area_text TEXT, -- TODO need to figure out some sort of programmatic representation for this too
|
||||||
targets TEXT, -- TODO in spells.py
|
targets TEXT, -- TODO in spells.py
|
||||||
nethysurl TEXT, -- scraped from github repo
|
nethysurl TEXT, -- scraped from github repo
|
||||||
FOREIGN KEY (sources_id) REFERENCES sources(sources_id),
|
FOREIGN KEY (sources_id) REFERENCES sources(sources_id),
|
||||||
|
|
Loading…
Reference in New Issue