MCPcopy Create free account
hub / github.com/Eve-PySpy/PySpy / prepare_ship_data

Function prepare_ship_data

db.py:84–99  ·  view source on GitHub ↗

Download all ship ids and names from ESI and save in OPTIONS_OBJECT.

(conn, cur)

Source from the content-addressed store, hash-verified

82
83
84def prepare_ship_data(conn, cur):
85 '''
86 Download all ship ids and names from ESI and save in OPTIONS_OBJECT.
87 '''
88 ship_data_date = config.OPTIONS_OBJECT.Get("ship_data_date", 0)
89 max_age = config.MAX_SHIP_DATA_AGE
90 max_date = datetime.date.today() - datetime.timedelta(days=max_age)
91 if ship_data_date == 0 or ship_data_date < max_date:
92 config.OPTIONS_OBJECT.Set("ship_data", apis.get_ship_data())
93 config.OPTIONS_OBJECT.Set("ship_data_date", datetime.date.today())
94 # Populate ships table with ids and names for all ships in game
95 cur.executemany(
96 '''INSERT OR REPLACE INTO ships (id, name) VALUES (?, ?)''',
97 config.OPTIONS_OBJECT.Get("ship_data", 0)
98 )
99 conn.commit()
100
101
102def write_many_to_db(conn, cur, query_string, records, keepalive=True):

Callers 2

connect_memory_dbFunction · 0.85
connect_persistent_dbFunction · 0.85

Calls 2

GetMethod · 0.80
SetMethod · 0.80

Tested by

no test coverage detected