FSDTarget contains the target system under `SystemAddress`, meaning that
any time you selected a star other than the current one, plugins'
`this.system_address` was updated to that target, rather than the
current system. Said updating causes the links provided from system_url
to reflect that update (for providers that support ID64s).
This changes the journal_entry behaviour to only update
`this.system_address` when the event is any of Location, Docked,
or FSDJump, all of which contain only the current system.
* If you request docking successfully then show the station namd and
have the link work.
* This is then only undone if you:
1) Dock and undock
2) Supercruise away
3) Jump away
It is *not* undone if you simply cancel the docking request.
Tested only with same provider for system and station for each of the
three, not the other 6 combinations.
* Make all plugins use `requests.utils.requote_uri()`
* Make all plugins use roughly the same logic, without if/else trees
(as the bodies do a `return ...`), ending with `return ''` if input
parameters are None.
This throws away the inara fallback to `this.station or this.system` as
it's unlikely the in-plugin tracking did a better job than the
monitor.py code.
By default the ttkHyperlinkLabels for 'system' and 'station' names have
their 'url' members set to the functions in EDMarketConnector.App.
The EDDB one used to override the function as it had to do that special
name -> EDDB ID lookup from systems.p. When I changed the code to not
need that any more I didn't fully understand what these overrides were.
After updating the EDDB code I then made sure the same logic was also in
the other plugins which meant they *also* set static strings, overriding
the call to the EDMarketConnector.App functions (which chain through to
the current plugin providers).
Unfortunately I didn't quite update the EDSM code enough causing
journal_entry() code to *not* set a new system 'url' despite changing
the 'text'. This meant that only CAPI updates (so docking and login)
caused the URL to change, despite updating the 'text' to the correct
system name.
Rather than have everything setting static strings just do away with the
overrides as they're not needed!
FSDTarget contains the target system under `SystemAddress`, meaning that
any time you selected a star other than the current one, plugins'
`this.system_address` was updated to that target, rather than the
current system. Said updating causes the links provided from system_url
to reflect that update (for providers that support ID64s).
This changes the journal_entry behaviour to only update
`this.system_address` when the event is any of Location, Docked,
or FSDJump, all of which contain only the current system.
* If you request docking successfully then show the station namd and
have the link work.
* This is then only undone if you:
1) Dock and undock
2) Supercruise away
3) Jump away
It is *not* undone if you simply cancel the docking request.
Tested only with same provider for system and station for each of the
three, not the other 6 combinations.
* Make all plugins use `requests.utils.requote_uri()`
* Make all plugins use roughly the same logic, without if/else trees
(as the bodies do a `return ...`), ending with `return ''` if input
parameters are None.
This throws away the inara fallback to `this.station or this.system` as
it's unlikely the in-plugin tracking did a better job than the
monitor.py code.
By default the ttkHyperlinkLabels for 'system' and 'station' names have
their 'url' members set to the functions in EDMarketConnector.App.
The EDDB one used to override the function as it had to do that special
name -> EDDB ID lookup from systems.p. When I changed the code to not
need that any more I didn't fully understand what these overrides were.
After updating the EDDB code I then made sure the same logic was also in
the other plugins which meant they *also* set static strings, overriding
the call to the EDMarketConnector.App functions (which chain through to
the current plugin providers).
Unfortunately I didn't quite update the EDSM code enough causing
journal_entry() code to *not* set a new system 'url' despite changing
the 'text'. This meant that only CAPI updates (so docking and login)
caused the URL to change, despite updating the 'text' to the correct
system name.
Rather than have everything setting static strings just do away with the
overrides as they're not needed!
This replaces the list+queue system that the inara plugin originally
used with a deque based one.
The main differences here are that the list the worker thread uses to
send to inara and the list that events are added to is the same, with
the worker thread making a duplicate and clearing the original each time
it sends events (losing events if it fails to upload three times).
The format of the data has changed as well, from simple tuples to
NamedTuple classes that provide some extra type safety and sanity when
accessing fields.
The event queue itself is actually multiple queues, one per
API/FID/CMDR_name triplicate, thus allowing multiple commander switches
while we're running without causing any weird issues
I had to pull a diff out of the old branch, apply it, and reverse things
like the addition of logging. This needs to be the minimum change for
the fix.
Tested with a quick login, then spamming market buy/sell orders. They
were correctly queued and then sent after 30s since previous API calls.
timeout_session provides two things, TimeoutAdapter, a HTTP adapter
subclass that automatically adds timeouts to all requests, and
new_session, which automatically creates a request.Session with the
adapter in the correct place.
This adds a new thread that will run in a loop sending inara events once
ever 30 seconds. The old method of sending once for "special" events has
been removed.
Using:
from EDMarketConnector import logger
causes issues if EDMarketConnector is already importing 'this' file.
So just get a logger using logger.getLogger(appname) instead.
`from config import appname` if needs be.
* Track all of: this.system_address, this.system_population,
this.system_marketid
* Use this.system_address if set (only from journal) for no-dupes Inara
system URL.
* Added the "'x' if undocked and show system info" functionality from
EDDB plugin.
* This version will set target station name/link if you request docking
with it, whether that succeeds or not. Cleared not only on Undock, but
also FSDJump and SupercruiseEntry (in case you never actually docked).
* No longer bothering setting system and station URLs from Inara API
response as we have working ones anyway. So even those without Inara
API Key set get the functionality now.