Compare commits

..

No commits in common. "develop" and "master" have entirely different histories.

7 changed files with 43 additions and 133 deletions

View file

@ -1,12 +0,0 @@
version: 2
updates:
- package-ecosystem: "pip"
directory: "/"
target-branch: "develop"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
target-branch: "develop"
schedule:
interval: "daily"

View file

@ -1,35 +0,0 @@
name: Create release on tag push
on:
push:
tags:
- 'release/*'
jobs:
build:
name: Pre-compile for Windows
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Make exe
run: make exe
- name: Create .zip archive
run: make release
- name: Draft release
uses: ncipollo/release-action@v1
with:
artifacts: "elite-scripts.zip"
bodyFile: "CHANGELOG.md"
draft: true

View file

@ -1,29 +1,15 @@
# devel
## Added
* `spansh.py`: `--raw` option. Prints the raw JSON returned from a query.
* `spansh.py`: `--nofeet` option for `outdatedstations`. Excludes Odyssey
settlements from the result set.
## Changed
* `spansh.py`: Now uses <https://spansh.uk> instead of <https://spansh.co.uk>.
-----
# 0.7 (2021-01-28)
## Changed
* `spansh.py`: Fleet carriers are now explicitly excluded from the outdated
* spansh.py: Fleet carriers are now explicitly excluded from the outdated
stations list.
## Fixed
* `explorationtools.py`: Searching for a CMDR with public profile, but hidden
* explorationtools.py: Searching for a CMDR with public profile, but hidden
activity will no longer error out.
* `explorationtools.py`: Searching for a CMDR with public profile, but hidden
* explorationtools.py: Searching for a CMDR with public profile, but hidden
flight log will no longer error out.
-----

View file

@ -12,12 +12,12 @@ docs:
exe:
pip install --user --upgrade -r requirements.txt
pip install --user --upgrade -r pyEDSM\requirements.txt
pip install --user --upgrade pywin32-ctypes cffi
pip install --user --upgrade pyinstaller
python -m PyInstaller --clean -yF edsm-getnearest.py
python -m PyInstaller --clean -yF edts.py
python -m PyInstaller --clean -yF explorationtools.py
python -m PyInstaller --clean -yF spansh.py
python -OO -m PyInstaller --clean -yF edsm-getnearest.py
python -OO -m PyInstaller --clean -yF edts.py
python -OO -m PyInstaller --clean -yF explorationtools.py
python -OO -m PyInstaller --clean -yF spansh.py
# probably wont work unless youre me :)
release: clean
pwsh -Command "Compress-Archive -Path .\dist\*.exe elite-scripts.zip"
rsync -avz gezocks:/mnt/d/git/elite-scripts/dist/ build/
cd build && zip -r ../$(zipfile) *

View file

@ -36,7 +36,7 @@ positional arguments:
CMDR a list of CMDR names (must have their location public on
EDSM!)
options:
optional arguments:
-h, --help show this help message and exit
--system SYSTEM the target system (must be in EDDN!)
--short short output (only makes sense with `--text`)
@ -51,7 +51,7 @@ usage: edts.py [-h] {coords} ...
Script for interfacing with Alots hosted EDTS API.
options:
optional arguments:
-h, --help show this help message and exit
subcommands:
@ -66,7 +66,7 @@ usage: edts.py coords [-h] [--maxuncertainty [MAXUNCERTAINTY]] system
positional arguments:
system the system name to get coordinates for
options:
optional arguments:
-h, --help show this help message and exit
--maxuncertainty [MAXUNCERTAINTY]
maximum accepted uncertainty, if any
@ -81,7 +81,7 @@ usage: explorationtools.py [-h]
A collection of tools useful for exploration.
options:
optional arguments:
-h, --help show this help message and exit
subcommands:
@ -111,7 +111,7 @@ usage: explorationtools.py bodycount [-h] system
positional arguments:
system system to query
options:
optional arguments:
-h, --help show this help message and exit
```
@ -122,7 +122,7 @@ usage: explorationtools.py distancebetween [-h] [--roundto [ROUNDTO]]
positional arguments:
system the systems to measure
options:
optional arguments:
-h, --help show this help message and exit
--roundto [ROUNDTO] the number of digits to round to (default: 2)
```
@ -135,7 +135,7 @@ positional arguments:
name the commander in question
apikey the commanders EDSM API key. Can be empty for public profiles.
options:
optional arguments:
-h, --help show this help message and exit
--system output the commanders last known system (default)
--coords output the commanders last known position in {x,y,z}
@ -149,7 +149,7 @@ usage: explorationtools.py findsystem [-h] system
positional arguments:
system the system in question
options:
optional arguments:
-h, --help show this help message and exit
```
@ -159,20 +159,19 @@ usage: explorationtools.py systemlist [-h] partialsystem
positional arguments:
partialsystem the partial system name to query against
options:
optional arguments:
-h, --help show this help message and exit
```
### spansh.py ###
```
usage: spansh.py [-h] [--raw] {nearestsystem,oldstations,systemexists} ...
usage: spansh.py [-h] {nearestsystem,oldstations,systemexists} ...
Script for interfacing with Spanshs API.
options:
optional arguments:
-h, --help show this help message and exit
--raw output raw json (mostly for debugging)
subcommands:
{nearestsystem,oldstations,systemexists}
@ -192,7 +191,7 @@ usage: spansh.py nearestsystem [-h] [--short | --parsable]
positional arguments:
coordinate the coordinates to search for (order: x, y, z)
options:
optional arguments:
-h, --help show this help message and exit
--short short output format (system name only)
--parsable parsable output format (<name>|<x>,<y>,<z>|<distance>)
@ -200,9 +199,9 @@ options:
```
usage: spansh.py oldstations [-h] [--system [SYSTEM]] [--count [COUNT]]
[--minage [MINAGE]] [--short] [--nofeet]
[--minage [MINAGE]] [--short]
options:
optional arguments:
-h, --help show this help message and exit
--system [SYSTEM] a single system to query. If not present, get the oldest
stations overall.
@ -210,7 +209,6 @@ options:
--minage [MINAGE] minimum age of data (in days) to be considered
“outdated”. Defaults to 365 (= 1year).
--short short output format (system/station names only)
--nofeet omit Odyssey settlements
```
```
@ -219,7 +217,7 @@ usage: spansh.py systemexists [-h] system
positional arguments:
system the system to search for
options:
optional arguments:
-h, --help show this help message and exit
```

2
pyEDSM

@ -1 +1 @@
Subproject commit 240ada35f78bec7490f6333a227fd8ae80a5c437
Subproject commit da044e918fe17cf18d2b2e18d60ce16a168ea70b

View file

@ -23,7 +23,7 @@ def querystations(url, params):
# ===========================================================================
def getNearestSystem(coords, raw=False):
def getNearestSystem(coords):
params = {
"x": coords[0],
"y": coords[1],
@ -35,8 +35,6 @@ def getNearestSystem(coords, raw=False):
json = response.json()
if raw: return json
ret = None
system = json["system"]
if args.short:
@ -51,7 +49,7 @@ def getNearestSystem(coords, raw=False):
return ret
def getOldStations(raw=False):
def getOldStations():
params = {
"json": JSON.dumps({
"filters": FILTERS,
@ -61,8 +59,6 @@ def getOldStations(raw=False):
}
json = querystations(APIURLS["stations"], params)
if raw: return json
ret = ""
for station in json["results"]:
if args.short:
@ -73,7 +69,7 @@ def getOldStations(raw=False):
return ret[:-1]
def getOldStationsInSystem(system, raw=False):
def getOldStationsInSystem(system):
FILTERS.update(system_name={"value": system})
params = {
"json": JSON.dumps({
@ -83,12 +79,12 @@ def getOldStationsInSystem(system, raw=False):
}
json = querystations(APIURLS["stations"], params)
if raw: return json
ret = ""
if len(json["results"]) == 0:
# exclude carriers
stations = list(filter(lambda station: not station["type"] == "Drake-Class Carrier", json["results"]))
if len(stations) == 0:
raise NotFoundError()
for station in json["results"]:
for station in stations:
# systems including the given name as a word will also trigger;
# looking for e.g. “Mari” will also give you stuff in “Mac Mari”!
if station["system_name"] == system:
@ -100,7 +96,7 @@ def getOldStationsInSystem(system, raw=False):
return ret[:-1]
def systemExists(system, raw=False):
def systemExists(system):
params = {
"json": JSON.dumps({
"filters": {
@ -115,9 +111,6 @@ def systemExists(system, raw=False):
raise ServerError(url, params)
json = response.json()
if raw: return json
if json["count"] == 0:
raise NotFoundError()
@ -132,8 +125,6 @@ def systemExists(system, raw=False):
parser = argparse.ArgumentParser(description="Script for interfacing with "
+ "Spanshs API.")
parser.add_argument("--raw", action='store_true',
help="output raw json (mostly for debugging)")
subparsers = parser.add_subparsers(title="subcommands", help="sub-command help",
dest="subcommand", required=True)
@ -159,8 +150,6 @@ parser_oldstations.add_argument("--minage", nargs="?", type=int, default=365,
+ "365 (= 1year).")
parser_oldstations.add_argument("--short", action='store_true',
help="short output format (system/station names only)")
parser_oldstations.add_argument("--nofeet", action='store_true',
help="omit Odyssey settlements")
parser_systemexists = subparsers.add_parser("systemexists",
help="Checks if a given system exists in the search database.")
@ -173,9 +162,9 @@ args = parser.parse_args()
# ===========================================================================
APIURLS = {
"nearest": "https://spansh.uk/api/nearest",
"stations": "https://spansh.uk/api/stations/search",
"systems": "https://spansh.uk/api/systems/search",
"nearest": "https://spansh.co.uk/api/nearest",
"stations": "https://spansh.co.uk/api/stations/search",
"systems": "https://spansh.co.uk/api/systems/search",
}
try:
@ -188,37 +177,21 @@ try:
"value": [
"2017-11-06",
(datetime.now() - timedelta(days=args.minage)).strftime("%Y-%m-%d")
],
],
"comparison": "<=>"
},
"type":
{
"value": [
"Asteroid base",
"Coriolis Starport",
"Mega ship",
"Ocellus Starport",
"Orbis Starport",
"Outpost",
"Planetary Outpost",
"Planetary Port",
"Settlement" if not args.nofeet else ""
]
}
}
}
SORT = {
"updated_at": {
"direction": "asc"
}
}
}
if args.system:
out = getOldStationsInSystem(args.system, args.raw)
out = getOldStationsInSystem(args.system)
else:
out = getOldStations(args.raw)
if args.raw:
out = JSON.dumps(out, indent=2)
out = getOldStations()
elif args.subcommand == "systemexists":
out = systemExists(args.system, args.raw)
out = systemExists(args.system)
except ServerError as e:
print(e)
sys.exit(1)