Skip to content

Commit

Permalink
Added 'import' command for importing one or more stations from a text…
Browse files Browse the repository at this point in the history
… file
  • Loading branch information
kfsone committed Nov 22, 2014
1 parent a7adac2 commit 1174024
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
TradeDangerous, Copyright (C) Oliver "kfsone" Smith, July 2014
==============================================================================

v6.0.5 Nov 22 2014 (w/Gamma 1)
. (kfsone) Added "import" sub-command for loading 1+ stations from a file
. (kfsone) Added Pilot's Federation/Jameson Memorial

v6.0.4 Nov 21 2014 (Beta 3.9.1)
. (kfsone) Added "sell" command (find places to sell a specific item)
. (kfsone) Reactive Armor changed to Reactive Armour
Expand Down
2 changes: 1 addition & 1 deletion cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ def buildCache(tdenv, dbPath, sqlPath, pricesPath, importTables, defaultZero=Fal

######################################################################

def importDataFromFile(tdenv, tdb, path, reset=False):
def importDataFromFile(tdb, tdenv, path, reset=False):
"""
Import price data from a file on a per-station basis,
that is when a new station is encountered, delete any
Expand Down
1 change: 1 addition & 0 deletions commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'buildcache',
'buy',
'local',
'import',
'nav',
'run',
'sell',
Expand Down
4 changes: 2 additions & 2 deletions commands/update_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def editUpdate(tdb, cmdenv, stationID):
"Suit you, sir! Oh!"
])))
else:
cache.importDataFromFile(cmdenv, tdb, tmpPath)
cache.importDataFromFile(tdb, cmdenv, tmpPath)

tmpPath.unlink()
tmpPath = None
Expand All @@ -269,7 +269,7 @@ def guidedUpdate(tdb, cmdenv):
try:
render(tdb, cmdenv, tmpPath)
cmdenv.DEBUG0("Got results, importing")
cache.importDataFromFile(cmdenv, tdb, tmpPath)
cache.importDataFromFile(tdb, cmdenv, tmpPath)
except Exception as e:
print("*** ERROR ENCOUNTERED ***")
print("*** YOUR UPDATES WILL BE SAVED AS {} ***".format(
Expand Down
2 changes: 1 addition & 1 deletion tradedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def reloadCache(self):
return

self.tdenv.DEBUG0(".prices has changed: re-importing")
cache.importDataFromFile(self.tdenv, self, self.pricesPath, reset=True)
cache.importDataFromFile(self, self.tdenv, self.pricesPath, reset=True)
return

self.tdenv.DEBUG0("Rebuilding DB Cache [{}]", str(changedPaths))
Expand Down

0 comments on commit 1174024

Please sign in to comment.