-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of bitbucket.org:kfsone/tradedangerous into devel
Conflicts: data/Added.csv
- Loading branch information
Showing
12 changed files
with
182 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
'buildcache', | ||
'buy', | ||
'local', | ||
'import', | ||
'nav', | ||
'run', | ||
'sell', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from __future__ import absolute_import, with_statement, print_function, division, unicode_literals | ||
from commands.parsing import MutuallyExclusiveGroup, ParseArgument | ||
from commands.exceptions import * | ||
import math | ||
|
||
import cache | ||
from pathlib import Path | ||
|
||
###################################################################### | ||
# Parser config | ||
|
||
help=( | ||
"Imports price data from a '.prices' format file " | ||
"without affecting data for stations not included " | ||
"in the import file." | ||
) | ||
name='import' | ||
epilog=None | ||
wantsTradeDB=True | ||
arguments = [ | ||
ParseArgument('filename', help='Name of the file to read.', type=str), | ||
] | ||
switches = [ | ||
] | ||
|
||
###################################################################### | ||
# Perform query and populate result set | ||
|
||
def run(results, cmdenv, tdb): | ||
filePath = Path(cmdenv.filename) | ||
cache.importDataFromFile(tdb, cmdenv, filePath) | ||
return None | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,15 @@ [email protected]_id,unq:name,ls_from_star | |
'61 Virginis','Artsebarsky Station',0.0 | ||
'68 Draconis','Gaspar De Lemos Port',0.0 | ||
'70 Virginis','Reis Platform',0.0 | ||
'Aiabiko','Gooch Terminal',0.0 | ||
'Aiabiko','White Orbital',0.0 | ||
'Aiabiko','Maxwell Orbital',0.0 | ||
'Aiabiko','Treshchov Port',0.0 | ||
'Aiabiko','Jett Ring',0.0 | ||
'Aiabiko','Haisheng Port',0.0 | ||
'Aiabiko','Savitskaya Station',0.0 | ||
'Aiabiko','Haber Dock',0.0 | ||
'Aiabiko','Weston Dock',0.0 | ||
'Abrogo','Laing Hub',0.0 | ||
'Acihaut','Cuffey Plant',0.0 | ||
'Acurukunabogamal','Aguirre Terminal',0.0 | ||
|
@@ -56,7 +65,11 @@ [email protected]_id,unq:name,ls_from_star | |
'Chapoyo','Piccard Port',0.0 | ||
'Chara','Reilly Refinery',0.0 | ||
'Chaxiraxi','Brother''s Progress',0.0 | ||
'Chemaku','Bartoe Platform',0.0 | ||
'Chemaku','Crampton Port',0.0 | ||
'Chemaku','Kaku Orbital',0.0 | ||
'Chemaku','Ferguson City',0.0 | ||
'Chemaku','Ewald City',0.0 | ||
'Chemaku','Lawson Station',0.0 | ||
'Chi Herculis','Gorbatko Reserve',0.0 | ||
'Chongquan','Eisele Park',0.0 | ||
'CM Draco','Anderson Escape',0.0 | ||
|
@@ -160,7 +173,7 @@ [email protected]_id,unq:name,ls_from_star | |
'LFT 820','Bailey Landing',0.0 | ||
'LFT 859','Stross City',0.0 | ||
'LFT 880','Baker Platform',0.0 | ||
'LFT 926','Onizuka Platform',0.0 | ||
'LFT 926','Meredith City',0.0 | ||
'LFT 945','Hahn Base',0.0 | ||
'LFT 992','Szulkin mines',0.0 | ||
'LHS 1065','Hornblower Platform',0.0 | ||
|
@@ -247,7 +260,7 @@ [email protected]_id,unq:name,ls_from_star | |
'Marasing','Thiele Enterprise',0.0 | ||
'Markanomovoy','Compton Dock',0.0 | ||
'Marsinatani','Hewish Relay',0.0 | ||
'MAUJINAGOTO','Halsell Point',0.0 | ||
'Maujinagoto','Halsell Point',0.0 | ||
'MCC 858','Jacquard Orbital',0.0 | ||
'Melcior','Goddard Dock',0.0 | ||
'Meliae','Shawl Beacon',0.0 | ||
|
@@ -267,6 +280,11 @@ [email protected]_id,unq:name,ls_from_star | |
'NLTT 46621','Hope Point',0.0 | ||
'NLTT 48502','Webb Holdings',0.0 | ||
'NLTT 53889','Roosa Platform',0.0 | ||
'Nuenets','Shriver Hub',0.0 | ||
'Nuenets','Laliberte Enterprise',0.0 | ||
'Nuenets','Harbaugh Port',0.0, | ||
'Nuenets','Forrester Dock',0.0 | ||
'Nuenets','Ryazanski Dock',0.0 | ||
'Nuwang','Schade Outpost',0.0 | ||
'Nzambassee','Garriott Stop',0.0 | ||
'Okinoukhe','Stableford Ring',0.0 | ||
|
@@ -295,10 +313,18 @@ [email protected]_id,unq:name,ls_from_star | |
'Ross 1015','Bowersox Mines',0.0 | ||
'Ross 104','Glenn Dock',0.0 | ||
'Ross 1051','Abetti Platform',0.0 | ||
'ROSS 1057','Wang Estate',0.0 | ||
'Ross 1057','Wang Estate',0.0 | ||
'Ross 128','Warren Prison Mine',0.0 | ||
'Ross 130','Huxley Relay',0.0 | ||
'Ross 210','Viktorenko Park',0.0 | ||
'Ross 210','Swift Gateway',0.0 | ||
'Ross 210','Fernandes De Queiros Dock',0.0 | ||
'Ross 210','Fu City',0.0 | ||
'Ross 210','Tokubei Ring',0.0 | ||
'Ross 210','Lunan Dock',0.0 | ||
'Ross 210','Chebyshev Ring',0.0 | ||
'Ross 210','Quinn Dock',0.0 | ||
'Ross 210','Clauss Gateway',0.0 | ||
'Ross 210','Lanier Orbital',0.0 | ||
'Ross 211','Chilton Vision',0.0 | ||
'Ross 318','Koch Hub',0.0 | ||
'Ross 446','Nowak Laboratory',0.0 | ||
|
@@ -312,6 +338,7 @@ [email protected]_id,unq:name,ls_from_star | |
'Shama','Clairaut Port',0.0 | ||
'Shebayeb','Volta Landing',0.0 | ||
'Sheela Na Gig','Birkhoff Terminal',0.0 | ||
'Shinrarta Dezhra','Jameson Memorial',0.0 | ||
'Sigma Bootis','Meikle Platform',0.0 | ||
'Slatus','Hoffman Orbital',0.0 | ||
'Sofagre','Markov Park',0.0 | ||
|
@@ -350,10 +377,10 @@ [email protected]_id,unq:name,ls_from_star | |
'Wanggu','Besonders Port',0.0 | ||
'Wei Jung','Cooper Dock',0.0 | ||
'Wikmeang','Ivanov Hub',0.0 | ||
'WISE 1506+7027','Silverberg Relay',0.0 | ||
'Wise 1506+7027','Silverberg Relay',0.0 | ||
'Wolf 1409','Carter Vision',0.0 | ||
'Wolf 1478','Franklin Orbital',0.0 | ||
'WOLF 248','Hencke Centre',0.0 | ||
'Wolf 248','Hencke Centre',0.0 | ||
'Wolf 294','Hippalus Station',0.0 | ||
'Wolf 359','Lomas Orbiter',0.0 | ||
'Wolf 393','Lichtenberg Horizons',0.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -433,7 +433,7 @@ unq:name,pos_x,pos_y,pos_z,[email protected]_id,modified | |
'Kaal',-18.34375,66.71875,-21.59375,'Beta3','2014-11-01 06:36:37' | ||
'Kaha''i',-7.03125,60.8125,-21.8125,'Beta3','2014-11-01 06:36:37' | ||
'Kali',33.59375,57.375,-28.84375,'Beta3','2014-11-01 06:36:37' | ||
'Kamchaultultula',-82.0625,1.625,-14.4375,'Beta2','2014-11-01 06:36:37' | ||
'Aiabiko',-82.0625,1.625,-14.4375,'Beta2','2014-11-01 06:36:37' | ||
'Kanati',74.125,46.1875,-19.46875,'Beta3','2014-11-01 06:36:37' | ||
'Kanos',41.375,53.65625,-12.65625,'Beta3','2014-11-01 06:36:37' | ||
'Karovices',-102.4375,6.9375,-14.875,'Beta3','2014-11-01 06:36:37' | ||
|
@@ -768,7 +768,7 @@ unq:name,pos_x,pos_y,pos_z,[email protected]_id,modified | |
'LTT 4447',68.0625,50.40625,23.15625,'Beta3','2014-11-01 06:36:37' | ||
'LTT 4461',49.625,44.84375,15.65625,'Beta3','2014-11-01 06:36:37' | ||
'LTT 4527',49.9375,48.53125,17.28125,'Beta3','2014-11-01 06:36:37' | ||
'LTT 4549',55.71875,17.59375,27.15625,'Beta3','2014-11-01 06:36:37' | ||
'Shinrarta Dezhra',55.71875,17.59375,27.15625,'Gamma1','2014-11-01 06:36:37' | ||
'LTT 4730',22.1875,30.875,9.84375,'Beta3','2014-11-01 06:36:37' | ||
'LTT 4772',50.78125,63.21875,26.53125,'Beta3','2014-11-01 06:36:37' | ||
'LTT 4898',43.0625,39.71875,27.71875,'Beta3','2014-11-01 06:36:37' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#! /usr/bin/env python3 | ||
|
||
from __future__ import absolute_import, with_statement, print_function, division, unicode_literals | ||
|
||
from urllib.parse import urlencode | ||
from urllib.request import Request, urlopen | ||
import json | ||
|
||
class EDStarQuery(object): | ||
url = 'http://edstarcoordinator.com/api.asmx/GetSystems' | ||
|
||
def __init__(self, detail=2, test=False, known=1, confidence=0, **kwargs): | ||
self.params = { | ||
'data': { | ||
'ver': 2, | ||
'test': test, | ||
'outputmode': detail, | ||
'filter': { | ||
'knownstatus': known, | ||
'cr': confidence, | ||
} | ||
} | ||
} | ||
for k, v in kwargs.items(): | ||
self.params.filter[k] = v | ||
|
||
self.jsData = None | ||
|
||
|
||
def fetch(self): | ||
params = json.dumps(self.params).encode('utf-8') | ||
request = Request(EDStarQuery.url, params, { | ||
'Content-Type': 'application/json;charset=utf-8', | ||
'Content-Length': len(params) | ||
}) | ||
|
||
with urlopen(request, params) as stream: | ||
self.jsData = stream.read() | ||
|
||
data = json.loads(self.jsData.decode())['d'] | ||
inputNo = 0 | ||
self.status = data['status']['input'][inputNo]['status'] | ||
|
||
return data | ||
|
||
|
||
if __name__ == "__main__": | ||
edsq = EDStarQuery(test=False, confidence=0) | ||
data = edsq.fetch() | ||
|
||
if edsq.status['statusnum'] != 0: | ||
raise Exception("Query failed: {} ({})".format( | ||
edsq.status['msg'], | ||
edsq.status['statusnum'], | ||
)) | ||
|
||
date = data['date'] | ||
systems = data['systems'] | ||
|
||
for sysinfo in systems: | ||
print(sysinfo['id'], sysinfo['name'], sysinfo['coord']) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters