Skip to content

Commit

Permalink
Merge branch 'master' into station_updates
Browse files Browse the repository at this point in the history
Conflicts:
	data/Station.csv
  • Loading branch information
orphu committed Dec 27, 2014
2 parents e8f05f8 + f7da999 commit 67fbc22
Show file tree
Hide file tree
Showing 15 changed files with 21,788 additions and 21,371 deletions.
4 changes: 3 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ TradeDangerous, Copyright (C) Oliver "kfsone" Smith, July 2014
==============================================================================

v6.3.1 [wip]
. (kfsone) You can now use "--opt=help" to get help for plugins, e.g.
trade.py import --plugin=maddavo --opt=help
. (kfsone) Added "--ls-penalty" ("--lsp") for biasing "run" calculations
in favor of shorter supercruise times.
+ Stations, data: kfsone
+ Stations, Systems, data: kfsone, maddavo, gazelle, shirkan

v6.3.0 Dec 23 2014
. (OpenSS) Script for Windows users (see scripts/README.txt)!
Expand Down
92 changes: 55 additions & 37 deletions cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,15 @@ class BuildCacheBaseException(TradeException):
def __init__(self, fromFile, lineNo, error=None):
self.fileName = fromFile.name
self.lineNo = lineNo
self.category = "ERROR"
self.error = error or "UNKNOWN ERROR"

def __str__(self):
return "{}:{} {}".format(self.fileName, self.lineNo, self.error)
return "{}:{} {} {}".format(
self.fileName, self.lineNo,
self.category,
self.error,
)


class UnknownStationError(BuildCacheBaseException):
Expand Down Expand Up @@ -310,6 +315,18 @@ def processPrices(tdenv, priceFile, db, defaultZero):
DELETED = corrections.DELETED
items, buys, sells = [], [], []

warnings = 0

def ignoreOrWarn(error):
nonlocal warnings
if not tdenv.ignoreUnknown:
raise error
if not tdenv.quiet:
error.category = "WARNING"
print(error)
warnings += 1


def changeStation(matches):
nonlocal categoryID, facility, stationID
nonlocal processedStations, processedItems
Expand Down Expand Up @@ -361,12 +378,10 @@ def changeStation(matches):
stationID = -1

if stationID < 0 :
ex = UnknownStationError(priceFile, lineNo, facility)
if not tdenv.ignoreUnknown:
raise ex
stationID = DELETED
if not tdenv.quiet:
print(ex)
ignoreOrWarn(
UnknownStationError(priceFile, lineNo, facility)
)
return

# Check for duplicates
Expand Down Expand Up @@ -411,12 +426,10 @@ def changeCategory(matches):
categoryID = categoriesByName[categoryName]
tdenv.DEBUG1("Renamed: {}", categoryName)
except KeyError:
ex = UnknownCategoryError(priceFile, lineNo, categoryName)
if not tdenv.ignoreUnknown:
raise ex
if not tdenv.quiet:
print(ex)
categoryID = DELETED
ignoreOrWarn(
UnknownCategoryError(priceFile, lineNo, categoryName)
)
return


Expand All @@ -440,11 +453,9 @@ def processItemLine(matches):
itemID = itemByName[itemName]
tdenv.DEBUG1("Renamed {} -> {}", oldName, itemName)
except KeyError:
ex = UnknownItemError(priceFile, lineNo, itemName)
if not tdenv.ignoreUnknown:
raise ex
if not tdenv.quiet:
print(ex)
ignoreOrWarn(
UnknownItemError(priceFile, lineNo, itemName)
)
return

# Check for duplicate items within the station.
Expand Down Expand Up @@ -560,7 +571,7 @@ def processItemLine(matches):

processItemLine(matches)

return items, buys, sells
return warnings, items, buys, sells


######################################################################
Expand All @@ -571,26 +582,33 @@ def processPricesFile(tdenv, db, pricesPath, defaultZero=False):
assert isinstance(pricesPath, Path)

with pricesPath.open('rU') as pricesFile:
items, buys, sells = processPrices(tdenv, pricesFile, db, defaultZero)
if items:
db.executemany("""
INSERT INTO StationItem
(station_id, item_id, modified)
VALUES (?, ?, IFNULL(?, CURRENT_TIMESTAMP))
""", items)
if sells:
db.executemany("""
INSERT INTO StationSelling
(station_id, item_id, price, units, level, modified)
VALUES (?, ?, ?, ?, ?, IFNULL(?, CURRENT_TIMESTAMP))
""", sells)
if buys:
db.executemany("""
INSERT INTO StationBuying
(station_id, item_id, price, units, level, modified)
VALUES (?, ?, ?, ?, ?, IFNULL(?, CURRENT_TIMESTAMP))
""", buys)
db.commit()
warnings, items, buys, sells = processPrices(
tdenv, pricesFile, db, defaultZero
)

if items:
db.executemany("""
INSERT INTO StationItem
(station_id, item_id, modified)
VALUES (?, ?, IFNULL(?, CURRENT_TIMESTAMP))
""", items)
if sells:
db.executemany("""
INSERT INTO StationSelling
(station_id, item_id, price, units, level, modified)
VALUES (?, ?, ?, ?, ?, IFNULL(?, CURRENT_TIMESTAMP))
""", sells)
if buys:
db.executemany("""
INSERT INTO StationBuying
(station_id, item_id, price, units, level, modified)
VALUES (?, ?, ?, ?, ?, IFNULL(?, CURRENT_TIMESTAMP))
""", buys)

db.commit()

if warnings and not tdenv.quiet:
print("Import completed despite warnings")


######################################################################
Expand Down
5 changes: 2 additions & 3 deletions commands/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import absolute_import, with_statement, print_function, division, unicode_literals
from commands.commandenv import CommandEnv
from textwrap import TextWrapper

import argparse # For parsing command line args.
import importlib
Expand Down Expand Up @@ -69,8 +70,6 @@ def usage(self, argv):
and the outlying command functionality.
"""

from textwrap import TextWrapper

text = (
"Usage: {prog} <command>\n\n"
"Where <command> is one of:\n\n"
Expand Down Expand Up @@ -187,7 +186,7 @@ def error(self, message):
)
stdArgs.add_argument('--link-ly', '-L',
help='Maximum lightyears between systems to be considered linked.',
default=None, dest='linkLy',
default=None, dest='maxSystemLinkLy',
)

properties = parser.parse_args(argv[1:])
Expand Down
3 changes: 3 additions & 0 deletions corrections.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
DELETED = -111

systems = {
"ARGETLAMH": "Argetlámh",

#ADD_SYSTEMS_HERE
}
Expand All @@ -31,6 +32,8 @@
"ZETA AQUILAE/OEFELIEN": DELETED,
"ZETA AQUILAE/JULIAN GATEWAY": DELETED,
"GROOMBRIDGE 1618/FRANKUN RING": "Franklin Ring",
"WOLF 46/FISCHER CITY": DELETED,
"LTT 9455/OLEARY VISION": DELETED,

#ADD_STATIONS_HERE
}
Expand Down
117 changes: 117 additions & 0 deletions data/ShipVendor.csv
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,52 @@ unq:[email protected]_id,unq:[email protected]_id,unq:[email protected]_id
'Aiabiko','White Orbital','Lakon Type 6'
'Aiabiko','White Orbital','Lakon Type 7'
'Aiabiko','White Orbital','Sidewinder'
'Anlave','Hogg City','Adder'
'Anlave','Hogg City','Cobra'
'Anlave','Hogg City','Dropship'
'Anlave','Hogg City','Eagle'
'Anlave','Hogg City','Hauler'
'Anlave','Hogg City','Lakon Type 6'
'Anlave','Hogg City','Python'
'Anlave','Hogg City','Sidewinder'
'Anlave','Hogg City','Viper'
'Anlave','Kobayashi City','Asp Explorer'
'Anlave','Kobayashi City','Cobra'
'Anlave','Kobayashi City','Eagle'
'Anlave','Kobayashi City','Hauler'
'Anlave','Kobayashi City','Lakon Type 6'
'Anlave','Kobayashi City','Orca'
'Anlave','Kobayashi City','Python'
'Anlave','Kobayashi City','Sidewinder'
'Anlave','Kobayashi City','Viper'
'Anlave','Suri Park','Asp Explorer'
'Anlave','Suri Park','Cobra'
'Anlave','Suri Park','Eagle'
'Anlave','Suri Park','Hauler'
'Anlave','Suri Park','Lakon Type 6'
'Anlave','Suri Park','Orca'
'Anlave','Suri Park','Python'
'Anlave','Suri Park','Sidewinder'
'Anlave','Suri Park','Viper'
'Aptet','Torricelli Port','Dropship'
'Aptet','Torricelli Port','Hauler'
'Aptet','Torricelli Port','Lakon Type 6'
'Aptet','Torricelli Port','Lakon Type 7'
'Aptet','Torricelli Port','Lakon Type 9'
'Aptet','Torricelli Port','Sidewinder'
'Bhritzameno','Feynman Terminal','Adder'
'Bhritzameno','Feynman Terminal','Asp Explorer'
'Bhritzameno','Feynman Terminal','Cobra'
'Bhritzameno','Feynman Terminal','Dropship'
'Bhritzameno','Feynman Terminal','Eagle'
'Bhritzameno','Feynman Terminal','Hauler'
'Bhritzameno','Feynman Terminal','Lakon Type 6'
'Bhritzameno','Feynman Terminal','Lakon Type 7'
'Bhritzameno','Feynman Terminal','Lakon Type 9'
'Bhritzameno','Feynman Terminal','Orca'
'Bhritzameno','Feynman Terminal','Python'
'Bhritzameno','Feynman Terminal','Sidewinder'
'Bhritzameno','Feynman Terminal','Viper'
'Bunuvivia','Ellison Enterprise','Adder'
'Bunuvivia','Ellison Enterprise','Cobra'
'Bunuvivia','Ellison Enterprise','Dropship'
Expand Down Expand Up @@ -59,6 +99,13 @@ unq:[email protected]_id,unq:[email protected]_id,unq:[email protected]_id
'Eravate','Russell Ring','Hauler'
'Eravate','Russell Ring','Lakon Type 6'
'Eravate','Russell Ring','Sidewinder'
'G 175-42','Werber Platform','Adder'
'G 175-42','Werber Platform','Cobra'
'G 175-42','Werber Platform','Eagle'
'G 175-42','Werber Platform','Hauler'
'G 175-42','Werber Platform','Lakon Type 6'
'G 175-42','Werber Platform','Lakon Type 7'
'G 175-42','Werber Platform','Sidewinder'
'Gong Gu','Kelly Dock','Adder'
'Gong Gu','Kelly Dock','Asp Explorer'
'Gong Gu','Kelly Dock','Cobra'
Expand Down Expand Up @@ -95,6 +142,19 @@ unq:[email protected]_id,unq:[email protected]_id,unq:[email protected]_id
'Hu Jona','Russell Station','Lakon Type 6'
'Hu Jona','Russell Station','Lakon Type 7'
'Hu Jona','Russell Station','Sidewinder'
'Iota Persei','Walker City','Adder'
'Iota Persei','Walker City','Anaconda'
'Iota Persei','Walker City','Asp Explorer'
'Iota Persei','Walker City','Cobra'
'Iota Persei','Walker City','Dropship'
'Iota Persei','Walker City','Eagle'
'Iota Persei','Walker City','Hauler'
'Iota Persei','Walker City','Lakon Type 6'
'Iota Persei','Walker City','Lakon Type 7'
'Iota Persei','Walker City','Lakon Type 9'
'Iota Persei','Walker City','Orca'
'Iota Persei','Walker City','Sidewinder'
'Iota Persei','Walker City','Viper'
'LFT 1448','Dirac Enterprise','Anaconda'
'LFT 1448','Dirac Enterprise','Asp Explorer'
'LFT 1448','Dirac Enterprise','Cobra'
Expand Down Expand Up @@ -125,6 +185,27 @@ unq:[email protected]_id,unq:[email protected]_id,unq:[email protected]_id
'Lhangkambe','Yeliseyev Terminal','Hauler'
'Lhangkambe','Yeliseyev Terminal','Sidewinder'
'Lhangkambe','Yeliseyev Terminal','Viper'
'LHS 115','Aleksandrov Gateway','Anaconda'
'LHS 115','Aleksandrov Gateway','Asp Explorer'
'LHS 115','Aleksandrov Gateway','Cobra'
'LHS 115','Aleksandrov Gateway','Dropship'
'LHS 115','Aleksandrov Gateway','Eagle'
'LHS 115','Aleksandrov Gateway','Hauler'
'LHS 115','Aleksandrov Gateway','Lakon Type 7'
'LHS 115','Aleksandrov Gateway','Lakon Type 9'
'LHS 115','Aleksandrov Gateway','Orca'
'LHS 115','Aleksandrov Gateway','Python'
'LHS 115','Aleksandrov Gateway','Sidewinder'
'LHS 115','Aleksandrov Gateway','Viper'
'LHS 1446','Blalock Orbital','Adder'
'LHS 1446','Blalock Orbital','Cobra'
'LHS 1446','Blalock Orbital','Eagle'
'LHS 1446','Blalock Orbital','Hauler'
'LHS 1446','Blalock Orbital','Lakon Type 6'
'LHS 1446','Blalock Orbital','Lakon Type 9'
'LHS 1446','Blalock Orbital','Python'
'LHS 1446','Blalock Orbital','Sidewinder'
'LHS 1446','Blalock Orbital','Viper'
'LHS 3447','Dalton Gateway','Asp Explorer'
'LHS 3447','Dalton Gateway','Hauler'
'LHS 3447','Dalton Gateway','Lakon Type 9'
Expand Down Expand Up @@ -184,6 +265,35 @@ unq:[email protected]_id,unq:[email protected]_id,unq:[email protected]_id
'Peradjariu','Vries Port','Python'
'Peradjariu','Vries Port','Sidewinder'
'Peradjariu','Vries Port','Viper'
'Ross 1069','Viehbock City','Adder'
'Ross 1069','Viehbock City','Asp Explorer'
'Ross 1069','Viehbock City','Dropship'
'Ross 1069','Viehbock City','Eagle'
'Ross 1069','Viehbock City','Hauler'
'Ross 1069','Viehbock City','Lakon Type 6'
'Ross 1069','Viehbock City','Lakon Type 7'
'Ross 1069','Viehbock City','Lakon Type 9'
'Ross 1069','Viehbock City','Sidewinder'
'Ross 1069','Viehbock City','Viper'
'Sol','Columbus','Adder'
'Sol','Columbus','Hauler'
'Sol','Columbus','Lakon Type 6'
'Sol','Columbus','Lakon Type 9'
'Sol','Columbus','Sidewinder'
'Sol','Columbus','Viper'
'Sol','Daedalus','Eagle'
'Sol','Daedalus','Hauler'
'Sol','Daedalus','Lakon Type 7'
'Sol','Daedalus','Lakon Type 9'
'Sol','Daedalus','Sidewinder'
'Sol','Galileo','Eagle'
'Sol','Galileo','Hauler'
'Sol','Galileo','Lakon Type 7'
'Sol','Galileo','Lakon Type 9'
'Sol','Galileo','Sidewinder'
'Sol','M.Gorbachev','Cobra'
'Sol','M.Gorbachev','Lakon Type 6'
'Sol','M.Gorbachev','Viper'
'Tauerni','Rushworth Port','Adder'
'Tauerni','Rushworth Port','Eagle'
'Tauerni','Rushworth Port','Hauler'
Expand All @@ -200,6 +310,13 @@ unq:[email protected]_id,unq:[email protected]_id,unq:[email protected]_id
'Thiansi','Worlidge Port','Python'
'Thiansi','Worlidge Port','Sidewinder'
'Thiansi','Worlidge Port','Viper'
'WISE 1800+0134','Underwood Dock','Adder'
'WISE 1800+0134','Underwood Dock','Cobra'
'WISE 1800+0134','Underwood Dock','Eagle'
'WISE 1800+0134','Underwood Dock','Hauler'
'WISE 1800+0134','Underwood Dock','Lakon Type 6'
'WISE 1800+0134','Underwood Dock','Sidewinder'
'WISE 1800+0134','Underwood Dock','Viper'
'Wolf 562','Hopkins Port','Adder'
'Wolf 562','Hopkins Port','Cobra'
'Wolf 562','Hopkins Port','Dropship'
Expand Down
Loading

0 comments on commit 67fbc22

Please sign in to comment.