tradedangerous 10.15.1__py3-none-any.whl → 10.16.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tradedangerous might be problematic. Click here for more details.
- tradedangerous/cache.py +3 -0
- tradedangerous/plugins/eddblink_plug.py +115 -722
- tradedangerous/plugins/spansh_plug.py +237 -121
- tradedangerous/templates/Category.csv +17 -0
- tradedangerous/version.py +1 -1
- {tradedangerous-10.15.1.dist-info → tradedangerous-10.16.0.dist-info}/METADATA +1 -1
- {tradedangerous-10.15.1.dist-info → tradedangerous-10.16.0.dist-info}/RECORD +11 -10
- {tradedangerous-10.15.1.dist-info → tradedangerous-10.16.0.dist-info}/LICENSE +0 -0
- {tradedangerous-10.15.1.dist-info → tradedangerous-10.16.0.dist-info}/WHEEL +0 -0
- {tradedangerous-10.15.1.dist-info → tradedangerous-10.16.0.dist-info}/entry_points.txt +0 -0
- {tradedangerous-10.15.1.dist-info → tradedangerous-10.16.0.dist-info}/top_level.txt +0 -0
|
@@ -9,17 +9,26 @@ import requests
|
|
|
9
9
|
import simdjson
|
|
10
10
|
import sqlite3
|
|
11
11
|
|
|
12
|
-
from .. import plugins, cache, fs, transfers
|
|
12
|
+
from .. import plugins, cache, fs, transfers, csvexport
|
|
13
13
|
|
|
14
14
|
SOURCE_URL = 'https://downloads.spansh.co.uk/galaxy_stations.json'
|
|
15
15
|
|
|
16
16
|
STATION_TYPE_MAP = {
|
|
17
|
-
'
|
|
18
|
-
'
|
|
17
|
+
'None' : [0, False],
|
|
18
|
+
'Outpost' : [1, False],
|
|
19
|
+
'Coriolis Starport' : [2, False],
|
|
20
|
+
'Ocellus Starport' : [3, False],
|
|
21
|
+
'Orbis Starport' : [4, False],
|
|
22
|
+
'Planetary Outpost' : [11, True],
|
|
23
|
+
'Planetary Port' : [12, True],
|
|
24
|
+
'Mega ship' : [13, False],
|
|
25
|
+
'Asteroid base' : [14, False],
|
|
26
|
+
'Drake-Class Carrier': [24, False], # fleet carriers
|
|
27
|
+
'Settlement': [25, True], # odyssey settlements
|
|
19
28
|
}
|
|
20
29
|
|
|
21
|
-
System = namedtuple('System', 'name,pos_x,pos_y,pos_z,modified')
|
|
22
|
-
Station = namedtuple('Station', 'name,distance,max_pad_size,market,black_market,shipyard,outfitting,rearm,refuel,repair,planetary,type,modified')
|
|
30
|
+
System = namedtuple('System', 'id,name,pos_x,pos_y,pos_z,modified')
|
|
31
|
+
Station = namedtuple('Station', 'id,name,distance,max_pad_size,market,black_market,shipyard,outfitting,rearm,refuel,repair,planetary,type,modified')
|
|
23
32
|
Commodity = namedtuple('Commodity', 'id,name,category,demand,supply,sell,buy,modified')
|
|
24
33
|
|
|
25
34
|
|
|
@@ -63,102 +72,166 @@ class ImportPlugin(plugins.ImportPluginBase):
|
|
|
63
72
|
super().__init__(*args, **kwargs)
|
|
64
73
|
self.url = self.getOption('url')
|
|
65
74
|
self.file = self.getOption('file')
|
|
66
|
-
self.maxage = float(self.getOption('maxage'))
|
|
75
|
+
self.maxage = float(self.getOption('maxage')) if self.getOption('maxage') else None
|
|
67
76
|
self.listener = self.getOption('listener')
|
|
68
77
|
assert not (self.url and self.file), 'Provide either url or file, not both'
|
|
69
78
|
if self.file and (self.file != '-'):
|
|
70
79
|
self.file = (Path(self.tdenv.cwDir) / self.file).resolve()
|
|
71
|
-
|
|
80
|
+
if not self.tdb.dbPath.exists():
|
|
81
|
+
ri_path = self.tdb.dataPath / Path("RareItem.csv")
|
|
82
|
+
rib_path = ri_path.with_suffix(".tmp")
|
|
83
|
+
if ri_path.exists():
|
|
84
|
+
if rib_path.exists():
|
|
85
|
+
rib_path.unlink()
|
|
86
|
+
ri_path.rename(rib_path)
|
|
87
|
+
cache.buildCache(self.tdb, self.tdenv)
|
|
88
|
+
if ri_path.exists():
|
|
89
|
+
ri_path.unlink()
|
|
90
|
+
if rib_path.exists():
|
|
91
|
+
rib_path.rename(ri_path)
|
|
92
|
+
|
|
93
|
+
# self.known_space = self.load_known_space()
|
|
94
|
+
self.known_systems = self.load_known_systems()
|
|
95
|
+
self.known_stations = self.load_known_stations()
|
|
72
96
|
self.known_commodities = self.load_known_commodities()
|
|
73
97
|
|
|
74
98
|
def print(self, *args, **kwargs):
|
|
75
99
|
return self.tdenv.uprint(*args, **kwargs)
|
|
76
100
|
|
|
77
101
|
def run(self):
|
|
78
|
-
fs.ensurefolder(self.tdenv.tmpDir)
|
|
79
|
-
filePath = self.tdenv.tmpDir / Path("spansh.prices")
|
|
80
|
-
if self.tdenv.detail
|
|
102
|
+
# fs.ensurefolder(self.tdenv.tmpDir)
|
|
103
|
+
# filePath = self.tdenv.tmpDir / Path("spansh.prices")
|
|
104
|
+
if not self.tdenv.detail:
|
|
81
105
|
self.print('This will take at least several minutes...')
|
|
82
106
|
self.print('You can increase verbosity (-v) to get a sense of progress')
|
|
83
|
-
with
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
107
|
+
with Timing() as timing:
|
|
108
|
+
# with open(filePath, 'w') as f, Timing() as timing:
|
|
109
|
+
# self.print(f'Writing prices to {filePath}')
|
|
110
|
+
# f.write('# Generated from spansh galaxy data\n')
|
|
111
|
+
# f.write(f'# Source: {self.file or self.url}\n')
|
|
112
|
+
# f.write('#\n')
|
|
113
|
+
# f.write((
|
|
114
|
+
# '# {name:50s} {sell:>7s} {buy:>7s} '
|
|
115
|
+
# '{demand:>11s} {supply:>11s} {ts}\n'
|
|
116
|
+
# ).format(
|
|
117
|
+
# name='Item Name',
|
|
118
|
+
# sell='SellCr',
|
|
119
|
+
# buy='BuyCr',
|
|
120
|
+
# demand='Demand',
|
|
121
|
+
# supply='Supply',
|
|
122
|
+
# ts='Timestamp',
|
|
123
|
+
# ))
|
|
99
124
|
system_count = 0
|
|
100
125
|
total_station_count = 0
|
|
101
126
|
total_commodity_count = 0
|
|
102
|
-
self.need_commit = False
|
|
103
|
-
|
|
127
|
+
# self.need_commit = False
|
|
128
|
+
# self.update_cache = False
|
|
129
|
+
# seen_stations = set()
|
|
104
130
|
for system, stations in self.data_stream():
|
|
105
131
|
self.ensure_system(system)
|
|
106
132
|
station_count = 0
|
|
107
133
|
commodity_count = 0
|
|
108
134
|
for station, commodities in stations:
|
|
109
135
|
fq_station_name = f'@{system.name.upper()}/{station.name}'
|
|
110
|
-
if (datetime.now() - station.modified) > timedelta(days=self.maxage):
|
|
111
|
-
if self.tdenv.detail
|
|
112
|
-
self.print(f' |
|
|
136
|
+
if self.maxage and (datetime.now() - station.modified) > timedelta(days=self.maxage):
|
|
137
|
+
if self.tdenv.detail:
|
|
138
|
+
self.print(f' | {fq_station_name:50s} | Skipping station due to age: {datetime.now() - station.modified}, ts: {station.modified}')
|
|
113
139
|
continue
|
|
114
|
-
if (system.name.upper(), station.name.upper()) in seen_stations:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
seen_stations.add((system.name.upper(), station.name.upper()))
|
|
140
|
+
# if (system.name.upper(), station.name.upper()) in seen_stations:
|
|
141
|
+
# if self.tdenv.detail:
|
|
142
|
+
# self.print(f' | {fq_station_name:50s} | Skipping duplicate station record')
|
|
143
|
+
# continue
|
|
144
|
+
# seen_stations.add((system.name.upper(), station.name.upper()))
|
|
119
145
|
self.ensure_station(system, station)
|
|
120
|
-
f.write('\n')
|
|
121
|
-
f.write(f'@ {system.name.upper()}/{station.name}\n')
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
146
|
+
# f.write('\n')
|
|
147
|
+
# f.write(f'@ {system.name.upper()}/{station.name}\n')
|
|
148
|
+
|
|
149
|
+
items = []
|
|
150
|
+
for commodity in commodities:
|
|
151
|
+
commodity = self.ensure_commodity(commodity)
|
|
152
|
+
result = self.execute("""SELECT modified FROM StationItem
|
|
153
|
+
WHERE station_id = ? AND item_id = ?""",
|
|
154
|
+
station.id, commodity.id, ).fetchone()
|
|
155
|
+
modified = parse_ts(result[0]) if result else None
|
|
156
|
+
if modified and commodity.modified <= modified:
|
|
157
|
+
if self.tdenv.detail > 2:
|
|
158
|
+
self.print(f' | {commodity.name:50s} | Skipping older commodity data')
|
|
159
|
+
continue
|
|
160
|
+
items.append((station.id, commodity.id, commodity.modified,
|
|
161
|
+
commodity.sell, commodity.demand, -1,
|
|
162
|
+
commodity.buy, commodity.supply, -1, 0))
|
|
163
|
+
if items:
|
|
164
|
+
for item in items:
|
|
165
|
+
self.execute("""INSERT OR REPLACE INTO StationItem (
|
|
166
|
+
station_id, item_id, modified,
|
|
167
|
+
demand_price, demand_units, demand_level,
|
|
168
|
+
supply_price, supply_units, supply_level, from_live
|
|
169
|
+
) VALUES (
|
|
170
|
+
?, ?, IFNULL(?, CURRENT_TIMESTAMP),
|
|
171
|
+
?, ?, ?,
|
|
172
|
+
?, ?, ?, ?
|
|
173
|
+
)""", *item )
|
|
174
|
+
self.execute('COMMIT')
|
|
175
|
+
commodity_count += 1
|
|
176
|
+
|
|
177
|
+
# categories = self.categorise_commodities(commodities)
|
|
178
|
+
# for category_name, category_commodities in categories.items():
|
|
179
|
+
# f.write(f' + {category_name}\n')
|
|
180
|
+
# for commodity in category_commodities:
|
|
181
|
+
# commodity = self.ensure_commodity(commodity)
|
|
182
|
+
# f.write((
|
|
183
|
+
# ' {name:50s} {sell:7d} {buy:7d} '
|
|
184
|
+
# '{demand:10d}? {supply:10d}? {modified}\n'
|
|
185
|
+
# ).format(
|
|
186
|
+
# name=commodity.name,
|
|
187
|
+
# sell=commodity.sell,
|
|
188
|
+
# buy=commodity.buy,
|
|
189
|
+
# demand=commodity.demand,
|
|
190
|
+
# supply=commodity.supply,
|
|
191
|
+
# modified=commodity.modified,
|
|
192
|
+
# ))
|
|
193
|
+
# commodity_count += 1
|
|
139
194
|
station_count += 1
|
|
140
195
|
system_count += 1
|
|
141
196
|
total_station_count += station_count
|
|
142
197
|
total_commodity_count += commodity_count
|
|
143
|
-
if self.tdenv.detail
|
|
198
|
+
if self.tdenv.detail:
|
|
144
199
|
self.print(
|
|
145
200
|
f'{system_count:6d} | {system.name.upper():50s} | '
|
|
146
201
|
f'{station_count:3d} st {commodity_count:6d} co'
|
|
147
202
|
)
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
203
|
+
# self.execute('COMMIT')
|
|
204
|
+
# if self.need_commit:
|
|
205
|
+
# self.execute('COMMIT')
|
|
206
|
+
# self.need_commit = False
|
|
207
|
+
# self.update_cache = True
|
|
208
|
+
|
|
209
|
+
# Need to make sure cached tables are updated, if changes were made
|
|
210
|
+
# if self.update_cache:
|
|
211
|
+
# for table in [ "Item", "Station", "System" ]:
|
|
212
|
+
# _, path = csvexport.exportTableToFile( self.tdb, self.tdenv, table )
|
|
213
|
+
|
|
214
|
+
self.execute('COMMIT')
|
|
215
|
+
# Need to make sure cached tables are updated
|
|
216
|
+
for table in [ "Item", "Station", "System", "StationItem" ]:
|
|
217
|
+
_, path = csvexport.exportTableToFile( self.tdb, self.tdenv, table )
|
|
218
|
+
|
|
151
219
|
self.print(
|
|
152
220
|
f'{timedelta(seconds=int(timing.elapsed))!s} Done '
|
|
153
221
|
f'{total_station_count} st {total_commodity_count} co'
|
|
154
222
|
)
|
|
155
223
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
224
|
+
with Timing() as timing:
|
|
225
|
+
self.print('Exporting to cache...')
|
|
226
|
+
cache.regeneratePricesFile(self.tdb, self.tdenv)
|
|
227
|
+
self.print(f'Cache export completed in {timedelta(seconds=int(timing.elapsed))!s}')
|
|
228
|
+
|
|
229
|
+
# if not self.listener:
|
|
230
|
+
# with Timing() as timing:
|
|
231
|
+
# self.print('Importing to database...')
|
|
232
|
+
# self.tdenv.mergeImport = True
|
|
233
|
+
# cache.importDataFromFile(self.tdb, self.tdenv, filePath)
|
|
234
|
+
# self.print(f'Database import completed in {timedelta(seconds=int(timing.elapsed))!s}')
|
|
162
235
|
return False
|
|
163
236
|
|
|
164
237
|
def data_stream(self):
|
|
@@ -189,56 +262,77 @@ class ImportPlugin(plugins.ImportPluginBase):
|
|
|
189
262
|
return categories
|
|
190
263
|
|
|
191
264
|
def execute(self, query, *params, **kwparams):
|
|
192
|
-
|
|
265
|
+
attempts = 5
|
|
193
266
|
cursor = self.tdb.getDB().cursor()
|
|
194
267
|
while True:
|
|
195
268
|
try:
|
|
196
269
|
return cursor.execute(query, params or kwparams)
|
|
197
270
|
except sqlite3.OperationalError as ex:
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
self.print(f'Retrying query: {ex!s}')
|
|
271
|
+
if not attempts:
|
|
272
|
+
raise
|
|
273
|
+
attempts -= 1
|
|
274
|
+
self.print(f'Retrying query \'{query}\': {ex!s}')
|
|
202
275
|
time.sleep(1)
|
|
203
276
|
|
|
204
|
-
def load_known_space(self):
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
277
|
+
# def load_known_space(self):
|
|
278
|
+
# cache = {}
|
|
279
|
+
# result = self.execute(
|
|
280
|
+
# '''
|
|
281
|
+
# SELECT System.name, Station.name FROM System
|
|
282
|
+
# LEFT JOIN Station USING (system_id)
|
|
283
|
+
# '''
|
|
284
|
+
# ).fetchall()
|
|
285
|
+
# for system, station in result:
|
|
286
|
+
# cache.setdefault(system.upper(), set())
|
|
287
|
+
# if station is not None:
|
|
288
|
+
# cache[system.upper()].add(station.upper())
|
|
289
|
+
# return cache
|
|
290
|
+
|
|
291
|
+
def load_known_systems(self):
|
|
292
|
+
try:
|
|
293
|
+
return dict(self.execute('SELECT system_id, name FROM System').fetchall())
|
|
294
|
+
except:
|
|
295
|
+
return dict()
|
|
296
|
+
|
|
297
|
+
def load_known_stations(self):
|
|
298
|
+
try:
|
|
299
|
+
return dict(self.execute('SELECT station_id, name FROM Station').fetchall())
|
|
300
|
+
except:
|
|
301
|
+
return dict()
|
|
302
|
+
|
|
218
303
|
def load_known_commodities(self):
|
|
219
|
-
|
|
304
|
+
try:
|
|
305
|
+
return dict(self.execute('SELECT fdev_id, name FROM Item').fetchall())
|
|
306
|
+
except:
|
|
307
|
+
return dict()
|
|
220
308
|
|
|
221
309
|
def ensure_system(self, system):
|
|
222
|
-
if system.
|
|
310
|
+
if system.id in self.known_systems:
|
|
223
311
|
return
|
|
224
312
|
self.execute(
|
|
225
313
|
'''
|
|
226
|
-
INSERT INTO System (name, pos_x, pos_y, pos_z, modified) VALUES (?, ?, ?, ?, ?)
|
|
314
|
+
INSERT INTO System (system_id, name, pos_x, pos_y, pos_z, modified) VALUES (?, ?, ?, ?, ?, ?)
|
|
227
315
|
''',
|
|
228
|
-
system.name, system.pos_x, system.pos_y, system.pos_z, system.modified,
|
|
316
|
+
system.id, system.name, system.pos_x, system.pos_y, system.pos_z, system.modified,
|
|
229
317
|
)
|
|
230
|
-
self.
|
|
231
|
-
if self.tdenv.detail
|
|
318
|
+
self.execute('COMMIT')
|
|
319
|
+
if self.tdenv.detail > 1:
|
|
232
320
|
self.print(f' | {system.name.upper():50s} | Added missing system')
|
|
233
|
-
self.
|
|
321
|
+
self.known_systems[system.id] = system.name
|
|
234
322
|
|
|
235
323
|
def ensure_station(self, system, station):
|
|
236
|
-
if station.
|
|
324
|
+
if station.id in self.known_stations:
|
|
325
|
+
system_id = self.execute('SELECT system_id FROM Station WHERE station_id = ?', station.id, ).fetchone()[0]
|
|
326
|
+
if system_id != system.id:
|
|
327
|
+
self.print(f' | {station.name:50s} | Megaship station moved, updating system')
|
|
328
|
+
self.execute("UPDATE Station SET system_id = ? WHERE station_id = ?", system.id, station.id, )
|
|
329
|
+
self.execute('COMMIT')
|
|
237
330
|
return
|
|
238
331
|
self.execute(
|
|
239
332
|
'''
|
|
240
333
|
INSERT INTO Station (
|
|
241
334
|
system_id,
|
|
335
|
+
station_id,
|
|
242
336
|
name,
|
|
243
337
|
ls_from_star,
|
|
244
338
|
max_pad_size,
|
|
@@ -255,10 +349,11 @@ class ImportPlugin(plugins.ImportPluginBase):
|
|
|
255
349
|
)
|
|
256
350
|
VALUES (
|
|
257
351
|
(SELECT system_id FROM System WHERE upper(name) = ?),
|
|
258
|
-
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
|
352
|
+
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
|
|
259
353
|
)
|
|
260
354
|
''',
|
|
261
355
|
system.name.upper(),
|
|
356
|
+
station.id,
|
|
262
357
|
station.name,
|
|
263
358
|
station.distance,
|
|
264
359
|
station.max_pad_size,
|
|
@@ -273,38 +368,60 @@ class ImportPlugin(plugins.ImportPluginBase):
|
|
|
273
368
|
station.modified,
|
|
274
369
|
station.type,
|
|
275
370
|
)
|
|
276
|
-
self.
|
|
277
|
-
if self.tdenv.detail
|
|
371
|
+
self.execute('COMMIT')
|
|
372
|
+
if self.tdenv.detail > 1:
|
|
278
373
|
self.print(f' | {station.name:50s} | Added missing station')
|
|
279
|
-
self.
|
|
374
|
+
self.known_stations[station.id]= station.name
|
|
280
375
|
|
|
281
|
-
def ensure_commodity(self,
|
|
376
|
+
def ensure_commodity(self, commodity):
|
|
282
377
|
if commodity.id in self.known_commodities:
|
|
283
|
-
if self.known_commodities[commodity.id] != commodity.name:
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
378
|
+
# if self.known_commodities[commodity.id] != commodity.name:
|
|
379
|
+
# if self.tdenv.detail >= 3:
|
|
380
|
+
# self.print(f' | - {commodity.name:45s} | Replace with pre-existing "{self.known_commodities[commodity.id]}"')
|
|
381
|
+
# return Commodity(
|
|
382
|
+
# id=commodity.id,
|
|
383
|
+
# name=self.known_commodities[commodity.id],
|
|
384
|
+
# category=commodity.category,
|
|
385
|
+
# demand=commodity.demand,
|
|
386
|
+
# supply=commodity.supply,
|
|
387
|
+
# sell=commodity.sell,
|
|
388
|
+
# buy=commodity.buy,
|
|
389
|
+
# modified=commodity.modified,
|
|
390
|
+
# )
|
|
296
391
|
return commodity
|
|
297
392
|
self.execute(
|
|
298
393
|
'''
|
|
299
|
-
INSERT INTO Item (category_id, name, fdev_id)
|
|
300
|
-
VALUES ((SELECT category_id FROM Category WHERE upper(name) = ?), ?, ?)
|
|
394
|
+
INSERT INTO Item (item_id, category_id, name, fdev_id)
|
|
395
|
+
VALUES (?, (SELECT category_id FROM Category WHERE upper(name) = ?), ?, ?)
|
|
301
396
|
''',
|
|
397
|
+
commodity.id,
|
|
302
398
|
commodity.category.upper(),
|
|
303
399
|
commodity.name,
|
|
304
400
|
commodity.id,
|
|
305
401
|
)
|
|
306
|
-
|
|
307
|
-
|
|
402
|
+
|
|
403
|
+
# Need to update ui_order
|
|
404
|
+
temp = self.execute("""SELECT
|
|
405
|
+
name, category_id, fdev_id
|
|
406
|
+
FROM Item
|
|
407
|
+
ORDER BY category_id, name
|
|
408
|
+
""")
|
|
409
|
+
cat_id = 0
|
|
410
|
+
ui_order = 1
|
|
411
|
+
self.tdenv.DEBUG0("Adding ui_order data to items.")
|
|
412
|
+
for line in temp:
|
|
413
|
+
if line[1] != cat_id:
|
|
414
|
+
ui_order = 1
|
|
415
|
+
cat_id = line[1]
|
|
416
|
+
else:
|
|
417
|
+
ui_order += 1
|
|
418
|
+
self.execute("""UPDATE Item
|
|
419
|
+
set ui_order = ?
|
|
420
|
+
WHERE fdev_id = ?""",
|
|
421
|
+
ui_order, line[2],)
|
|
422
|
+
|
|
423
|
+
self.execute('COMMIT')
|
|
424
|
+
if self.tdenv.detail > 1:
|
|
308
425
|
self.print(f' | {commodity.name:50s} | Added missing commodity')
|
|
309
426
|
self.known_commodities[commodity.id] = commodity.name
|
|
310
427
|
return commodity
|
|
@@ -325,7 +442,8 @@ def ingest_stream(stream):
|
|
|
325
442
|
coords = system_data.get('coords', {})
|
|
326
443
|
yield (
|
|
327
444
|
System(
|
|
328
|
-
|
|
445
|
+
id = system_data.get('id64'),
|
|
446
|
+
name=system_data.get('name', 'Unnamed').strip(),
|
|
329
447
|
pos_x=coords.get('x', 999999),
|
|
330
448
|
pos_y=coords.get('y', 999999),
|
|
331
449
|
pos_z=coords.get('z', 999999),
|
|
@@ -338,7 +456,6 @@ def ingest_stream(stream):
|
|
|
338
456
|
def ingest_stations(system_data):
|
|
339
457
|
"""Ingest system-level data, yielding station-level data."""
|
|
340
458
|
targets = [system_data, *system_data.get('bodies', ())]
|
|
341
|
-
is_planetary = False
|
|
342
459
|
for target in targets:
|
|
343
460
|
for station_data in target.get('stations', ()):
|
|
344
461
|
services = set(station_data.get('services', ()))
|
|
@@ -357,7 +474,8 @@ def ingest_stations(system_data):
|
|
|
357
474
|
max_pad_size = 'S'
|
|
358
475
|
yield (
|
|
359
476
|
Station(
|
|
360
|
-
|
|
477
|
+
id = station_data.get('id'),
|
|
478
|
+
name=station_data.get('name', 'Unnamed').strip(),
|
|
361
479
|
distance=station_data.get('distanceToArrival', 999999),
|
|
362
480
|
max_pad_size=max_pad_size,
|
|
363
481
|
market=True,
|
|
@@ -367,14 +485,12 @@ def ingest_stations(system_data):
|
|
|
367
485
|
rearm='Restock' in services,
|
|
368
486
|
refuel='Refuel' in services,
|
|
369
487
|
repair='Repair' in services,
|
|
370
|
-
planetary=
|
|
371
|
-
type=STATION_TYPE_MAP.get(station_data.get('type')
|
|
488
|
+
planetary=STATION_TYPE_MAP.get(station_data.get('type'))[1] or False,
|
|
489
|
+
type=STATION_TYPE_MAP.get(station_data.get('type'))[0] or 0,
|
|
372
490
|
modified=parse_ts(station_data.get('updateTime')),
|
|
373
491
|
),
|
|
374
492
|
ingest_market(market),
|
|
375
493
|
)
|
|
376
|
-
# first target is system stations, everything else is planetary
|
|
377
|
-
is_planetary = True
|
|
378
494
|
|
|
379
495
|
|
|
380
496
|
def ingest_market(market):
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
unq:category_id,name
|
|
2
|
+
1,'Chemicals'
|
|
3
|
+
2,'Consumer Items'
|
|
4
|
+
3,'Legal Drugs'
|
|
5
|
+
4,'Foods'
|
|
6
|
+
5,'Industrial Materials'
|
|
7
|
+
6,'Machinery'
|
|
8
|
+
7,'Medicines'
|
|
9
|
+
8,'Metals'
|
|
10
|
+
9,'Minerals'
|
|
11
|
+
10,'Slavery'
|
|
12
|
+
11,'Technology'
|
|
13
|
+
12,'Textiles'
|
|
14
|
+
13,'Waste'
|
|
15
|
+
14,'Weapons'
|
|
16
|
+
15,'Unknown'
|
|
17
|
+
16,'Salvage'
|
tradedangerous/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tradedangerous
|
|
3
|
-
Version: 10.
|
|
3
|
+
Version: 10.16.0
|
|
4
4
|
Summary: Trade-Dangerous is a set of powerful trading tools for Elite Dangerous, organized around one of the most powerful trade run optimizers available.
|
|
5
5
|
Home-page: https://github.com/eyeonus/Trade-Dangerous
|
|
6
6
|
Author: eyeonus
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
tradedangerous/__init__.py,sha256=5ZeypoZaM8hlh6c-yTkD8x5hZYP8q3Q8a3bVeicHr90,1122
|
|
2
|
-
tradedangerous/cache.py,sha256=
|
|
2
|
+
tradedangerous/cache.py,sha256=MIoNCWE3AJohhx0r4m5xgf4C_4YkynWgfJyUokhuG98,33859
|
|
3
3
|
tradedangerous/cli.py,sha256=ycGkzMszwpP9OrngFIyhQbYoZ2wzRhJMTDCW1YhLrNI,4727
|
|
4
4
|
tradedangerous/corrections.py,sha256=QMs-7MKLw2imFgIHthnwcpqWT1yJTb3CrABJw9LaKLA,1441
|
|
5
5
|
tradedangerous/csvexport.py,sha256=OcOKe_VIgafw6rCvG3k5tM11KwwoYXMNY5DSSfCC0mU,8705
|
|
@@ -21,7 +21,7 @@ tradedangerous/tradeexcept.py,sha256=aZ-Y31MbkjF7lmAzBAbaMsPPE7FEEfuf4gaX2GvriDk
|
|
|
21
21
|
tradedangerous/tradegui.py,sha256=JbGFnsWupgesk6hrcUgKSdD9NNDyo0U9gh6m3DccAwU,782
|
|
22
22
|
tradedangerous/transfers.py,sha256=NmXXk2aF88YkAvYqc9Syt_aO6d2jJjC-OxoRFoOyQH4,9923
|
|
23
23
|
tradedangerous/utils.py,sha256=PUPvAEqUyxYGqqQa0b_yfLAvq8YVUxK6HfdS-CxM-Lo,5186
|
|
24
|
-
tradedangerous/version.py,sha256=
|
|
24
|
+
tradedangerous/version.py,sha256=S9cBah-KHiN_MJ6V3shYaP0EfZ2tqQeAE8OBfLWQHwE,647
|
|
25
25
|
tradedangerous/commands/TEMPLATE.py,sha256=7oXL124aqxGHwnb0h9yRylUiwc6M5QrRrGVrubwI1gg,2124
|
|
26
26
|
tradedangerous/commands/__init__.py,sha256=6B0WuqkFBOll5Hj67yKDAnhmyr5ZAnHc6nzUNEUh384,9640
|
|
27
27
|
tradedangerous/commands/buildcache_cmd.py,sha256=oJvP06fA8svnHrfrpWkHKR16cba8GIhHdMOyZqds18Y,2332
|
|
@@ -62,18 +62,19 @@ tradedangerous/misc/progress.py,sha256=-_V7E51sIYUtSxeeA1cphBEW4A_OBuH1guEDxUjik
|
|
|
62
62
|
tradedangerous/plugins/__init__.py,sha256=zCEVbTem1CAM1cOV9r96H3ikjqza3dd-XoaubE5_xkc,7868
|
|
63
63
|
tradedangerous/plugins/edapi_plug.py,sha256=IQxfDGM9IqwuJbDZRL8RFIyGMWzd0YmeJVWUVPDA3Ik,42275
|
|
64
64
|
tradedangerous/plugins/edcd_plug.py,sha256=ZPtRzLhcQZEiwEo3AoPyk3Uy4UmRLM6gv2Qi1s7K_Vs,14469
|
|
65
|
-
tradedangerous/plugins/eddblink_plug.py,sha256=
|
|
65
|
+
tradedangerous/plugins/eddblink_plug.py,sha256=Ne_5ltiWC1M3MOxS6XaY0DyESJL3XaGI9f-uLf67YiQ,21681
|
|
66
66
|
tradedangerous/plugins/edmc_batch_plug.py,sha256=3Ptr-SZqaZFR8ViIIrp9Ak7rvfU3zl11AZYBhIceN7s,4224
|
|
67
67
|
tradedangerous/plugins/journal_plug.py,sha256=K1oIeI7E3mb04fvYLXyoAh7fOTyM9NBelibTI88MIDQ,23696
|
|
68
68
|
tradedangerous/plugins/netlog_plug.py,sha256=Gw_HSZWpN17D--OIYEM3Vo8y9SvDOv9UwAUfY24kz28,13460
|
|
69
|
-
tradedangerous/plugins/spansh_plug.py,sha256=
|
|
69
|
+
tradedangerous/plugins/spansh_plug.py,sha256=dDX34KEt_jSjwyP45utQTUgB-oew__F1sYcPb209bC8,21334
|
|
70
70
|
tradedangerous/templates/Added.csv,sha256=8o54civQCcS9y7_DBo0GX196XWRbbREQqKDYTKibsgQ,649
|
|
71
|
+
tradedangerous/templates/Category.csv,sha256=8xwUDcBZE25T6x6dZGlRUMTCqeDLt3a9LXU5h6hRHV8,250
|
|
71
72
|
tradedangerous/templates/DefaultShipIndex.json,sha256=m5cI3vkKiqRk1VKO1Z_8LZrG9nczV0PUMDfBSt4-1RM,94739
|
|
72
73
|
tradedangerous/templates/RareItem.csv,sha256=F1RhRnTD82PiwrVUO-ai2ErGH2PTqNnQaDw5mcgljXs,10483
|
|
73
74
|
tradedangerous/templates/TradeDangerous.sql,sha256=6sjEogGHy-9zYpjPo0Y2a5tElowmHFyJNwrimOUBfHk,8079
|
|
74
|
-
tradedangerous-10.
|
|
75
|
-
tradedangerous-10.
|
|
76
|
-
tradedangerous-10.
|
|
77
|
-
tradedangerous-10.
|
|
78
|
-
tradedangerous-10.
|
|
79
|
-
tradedangerous-10.
|
|
75
|
+
tradedangerous-10.16.0.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
|
|
76
|
+
tradedangerous-10.16.0.dist-info/METADATA,sha256=bVIRRbEj5tfBICwC8Y8M_63Tnlz-zmLIrXDNQCHG7so,4421
|
|
77
|
+
tradedangerous-10.16.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
78
|
+
tradedangerous-10.16.0.dist-info/entry_points.txt,sha256=pSwa-q0ob443uiKux7xFKYQl8uen66iDTnjdrQhNLx8,92
|
|
79
|
+
tradedangerous-10.16.0.dist-info/top_level.txt,sha256=bF29i-oEltmNICgElEKxNsg83oahJvxg3a7YrxZi9Rk,15
|
|
80
|
+
tradedangerous-10.16.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|