mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-01 16:11:18 +03:00
monitor/tracking: Move .station_marketid to state['MarketID']
1. plugins/eddb.py uses this for MarketID-based station URLs. * So do the 'rename'. * Remove EDDB tracking in favour of this. * Update PLUGINS.md
This commit is contained in:
parent
2a8dd14e24
commit
31e8d0372d
@ -1295,9 +1295,9 @@ class AppWindow(object):
|
||||
|
||||
self.capi_query_holdoff_time = capi_response.query_time + companion.capi_query_cooldown
|
||||
|
||||
elif capi_response.capi_data['lastStarport']['id'] != monitor.station_marketid:
|
||||
elif capi_response.capi_data['lastStarport']['id'] != monitor.state['MarketID']:
|
||||
logger.warning(f"MarketID mis-match: {capi_response.capi_data['lastStarport']['id']!r} !="
|
||||
f" {monitor.station_marketid!r}")
|
||||
f" {monitor.state['MarketID']!r}")
|
||||
raise companion.ServerLagging()
|
||||
|
||||
elif not monitor.state['OnFoot'] and capi_response.capi_data['ship']['id'] != monitor.state['ShipID']:
|
||||
|
@ -607,7 +607,7 @@ This gets called when EDMarketConnector sees a new entry in the game's journal.
|
||||
Content of `state` (updated to the current journal entry):
|
||||
|
||||
| Field | Type | Description |
|
||||
|:---------------------|:---------------------------:|:----------------------------------------------------------------------------------------------------------------|
|
||||
|:----------------------|:---------------------------:|:----------------------------------------------------------------------------------------------------------------|
|
||||
| `GameLanguage` | `Optional[str]` | `language` value from `Fileheader` event. |
|
||||
| `GameVersion` | `Optional[str]` | `version` value from `Fileheader` event. |
|
||||
| `GameBuild` | `Optional[str]` | `build` value from `Fileheader` event. |
|
||||
@ -655,12 +655,13 @@ Content of `state` (updated to the current journal entry):
|
||||
| `Dropship` | `Optional[bool]` | Whether or not the above taxi is a Dropship |
|
||||
| `SystemAddress`[3] | `Optional[int]` | Unique [ID64](http://disc.thargoid.space/ID64) of the star system we're currently in |
|
||||
| `SystemName`[3] | `Optional[str]` | Name of the star system we're currently in |
|
||||
| `SystemPopulation`[3]| `Optional[int]` | Population of the star system we're currently in |
|
||||
| `SystemPopulation`[3] | `Optional[int]` | Population of the star system we're currently in |
|
||||
| `StarPos`[3] | `Optional[tuple[float]]` | Galaxy co-ordinates of the system we're currently in |
|
||||
| `Body`[3][4] | `Optional[str]` | Name of the body we're currently on / in the SOI of |
|
||||
| `BodyID`[3][4] | `Optional[int]` | ID of the body we're currently on / in the SOI of |
|
||||
| `BodyType`[3][4] | `Optional[str]` | The type of body that `Body` refers to |
|
||||
| `StationName` | `Optional[str]` | Name of the station we're docked at, if applicable |
|
||||
| `StationName`[3] | `Optional[str]` | Name of the station we're docked at, if applicable |
|
||||
| `MarketID`[3] | `Optional[str]` | MarketID of the station we're docked at, if applicable |
|
||||
|
||||
[1] - Contents of `NavRoute` not changed if a `NavRouteClear` event is seen,
|
||||
but plugins will see the `NavRouteClear` event.
|
||||
@ -807,7 +808,7 @@ now track in the same manner as prior core EDDN plugin code. Check the
|
||||
documentation above for some caveats. Do not just blindly use this data, or
|
||||
the 'Body' name value.
|
||||
|
||||
`StationName` added to the `state` dictionary.
|
||||
`StationName` and `MarketID` added to the `state` dictionary.
|
||||
|
||||
___
|
||||
|
||||
|
25
monitor.py
25
monitor.py
@ -116,7 +116,6 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
self.mode: str | None = None
|
||||
self.group: str | None = None
|
||||
self.cmdr: str | None = None
|
||||
self.station_marketid: int | None = None
|
||||
self.stationtype: str | None = None
|
||||
self.started: int | None = None # Timestamp of the LoadGame event
|
||||
|
||||
@ -311,7 +310,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
self.state['BodyID'] = None
|
||||
self.state['BodyType'] = None
|
||||
self.state['StationName'] = None
|
||||
self.station_marketid = None
|
||||
self.state['MarketID'] = None
|
||||
self.stationtype = None
|
||||
self.stationservices = None
|
||||
self.is_beta = False
|
||||
@ -541,7 +540,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
|
||||
if self.state['StationName']:
|
||||
entry['Docked'] = True
|
||||
entry['MarketID'] = self.station_marketid
|
||||
entry['MarketID'] = self.state['MarketID']
|
||||
entry['StationName'] = self.state['StationName']
|
||||
entry['StationType'] = self.stationtype
|
||||
|
||||
@ -586,7 +585,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
self.state['Body'] = None
|
||||
self.state['BodyID'] = None
|
||||
self.state['StationName'] = None
|
||||
self.station_marketid = None
|
||||
self.state['MarketID'] = None
|
||||
self.stationtype = None
|
||||
self.stationservices = None
|
||||
self.started = None
|
||||
@ -625,7 +624,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
self.state['BodyID'] = None
|
||||
self.state['BodyType'] = None
|
||||
self.state['StationName'] = None
|
||||
self.station_marketid = None
|
||||
self.state['MarketID'] = None
|
||||
self.stationtype = None
|
||||
self.stationservices = None
|
||||
self.started = timegm(strptime(entry['timestamp'], '%Y-%m-%dT%H:%M:%SZ'))
|
||||
@ -758,7 +757,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
|
||||
elif event_type == 'undocked':
|
||||
self.state['StationName'] = None
|
||||
self.station_marketid = None
|
||||
self.state['MarketID'] = None
|
||||
self.stationtype = None
|
||||
self.stationservices = None
|
||||
self.state['IsDocked'] = False
|
||||
@ -780,8 +779,10 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
# • StationType
|
||||
# • MarketID
|
||||
self.state['StationName'] = None
|
||||
self.state['MarketID'] = None
|
||||
if entry.get('OnStation'):
|
||||
self.state['StationName'] = entry.get('StationName', '')
|
||||
self.state['MarketID'] = entry.get('MarketID', '')
|
||||
|
||||
self.state['OnFoot'] = False
|
||||
self.state['Taxi'] = entry['Taxi']
|
||||
@ -845,7 +846,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
###############################################################
|
||||
self.state['IsDocked'] = True
|
||||
self.state['StationName'] = entry.get('StationName') # It may be None
|
||||
self.station_marketid = entry.get('MarketID') # It may be None
|
||||
self.state['MarketID'] = entry.get('MarketID') # It may be None
|
||||
self.stationtype = entry.get('StationType') # It may be None
|
||||
self.stationservices = entry.get('StationServices') # None under E:D < 2.4
|
||||
|
||||
@ -957,7 +958,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
###############################################################
|
||||
if event_type == 'fsdjump':
|
||||
self.state['StationName'] = None
|
||||
self.station_marketid = None
|
||||
self.state['MarketID'] = None
|
||||
self.stationtype = None
|
||||
self.stationservices = None
|
||||
|
||||
@ -969,7 +970,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
if entry.get('BodyType') and entry['BodyType'] == 'Station':
|
||||
self.state['StationName'] = entry.get('Body')
|
||||
|
||||
self.station_marketid = entry.get('MarketID') # May be None
|
||||
self.state['MarketID'] = entry.get('MarketID') # May be None
|
||||
self.stationtype = entry.get('StationType') # May be None
|
||||
self.stationservices = entry.get('StationServices') # None in Odyssey for on-foot 'Location'
|
||||
###############################################################
|
||||
@ -1008,7 +1009,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
# Track: Current station, if applicable
|
||||
###############################################################
|
||||
self.state['StationName'] = None
|
||||
self.station_marketid = None
|
||||
self.state['MarketID'] = None
|
||||
self.stationtype = None
|
||||
self.stationservices = None
|
||||
###############################################################
|
||||
@ -1713,7 +1714,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
self.state['BodyID'] = None
|
||||
self.state['BodyType'] = None
|
||||
self.state['StationName'] = None
|
||||
self.station_marketid = None
|
||||
self.state['MarketID'] = None
|
||||
self.stationtype = None
|
||||
self.stationservices = None
|
||||
self.state['OnFoot'] = False
|
||||
@ -1732,7 +1733,7 @@ class EDLogs(FileSystemEventHandler): # type: ignore # See below
|
||||
self.state['BodyID'] = None
|
||||
self.state['BodyType'] = None
|
||||
self.state['StationName'] = None
|
||||
self.station_marketid = None
|
||||
self.state['MarketID'] = None
|
||||
self.stationtype = None
|
||||
self.stationservices = None
|
||||
|
||||
|
@ -188,16 +188,7 @@ def journal_entry(
|
||||
this.system_name = state['SystemName']
|
||||
this.system_population = state['SystemPopulation']
|
||||
this.station_name = state['StationName']
|
||||
|
||||
this.station_marketid = entry.get('MarketID') or this.station_marketid
|
||||
# We might pick up StationName in DockingRequested, make sure we clear it if leaving
|
||||
if entry['event'] in ('Undocked', 'FSDJump', 'SupercruiseEntry'):
|
||||
this.station_marketid = None
|
||||
|
||||
if entry['event'] == 'Embark' and not entry.get('OnStation'):
|
||||
# If we're embarking OnStation to a Taxi/Dropship we'll also get an
|
||||
# Undocked event.
|
||||
this.station_marketid = None
|
||||
this.station_marketid = state['MarketID']
|
||||
|
||||
# Only change URL text if we are current provider.
|
||||
if config.get_str('station_provider') == 'eddb':
|
||||
|
Loading…
x
Reference in New Issue
Block a user