1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-25 13:02:13 +03:00

98 Commits

Author SHA1 Message Date
Athanasius
bc33bf1b19 Attempt to get develop back to code state before rebase on main. 2021-04-01 14:45:51 +01:00
Athanasius
d8fb17df9f plugins/eddn: Add paranoia about data in is_horizons()
A damaged station has `"modules": []`, so trips over modules.values().
2021-04-01 14:45:51 +01:00
Athanasius
933ec723bd plugins/eddn: Call requests.Session.close() in EDDN.close()
Avoids a `-W default` warning on shutdown.
2021-04-01 14:45:50 +01:00
A_D
051245cf90 Renamed various config values to be backwards compatible 2021-04-01 14:45:48 +01:00
A_D
00629b7420 use _str versions of paths for string ops 2021-04-01 14:45:48 +01:00
A_D
b5a8c03980 Added missing whitespace 2021-04-01 14:45:48 +01:00
A_D
cd67f12f22 Fixed eddn event specific killswitch 2021-04-01 14:45:48 +01:00
A_D
b694bdc965 Added per-event killswitch 2021-04-01 14:45:48 +01:00
A_D
6374fbbeb8 Added event disabling
You can now disable specific event handlers in plugins
2021-04-01 14:45:47 +01:00
A_D
70087a27e4 Added total journal cutoff killswitches 2021-04-01 14:45:47 +01:00
A_D
8dca6783fc Fixed spelling, added utility methods 2021-04-01 14:45:47 +01:00
A_D
d5b62d957b Added support for comments in kill switches 2021-04-01 14:45:47 +01:00
A_D
2d127ae3d0 Added docs, fixed incorrect kill switch names 2021-04-01 14:45:47 +01:00
A_D
d81093760e Added hooks into killswitches in plugins 2021-04-01 14:45:47 +01:00
A_D
1e56f0046e Empty journal dir workaround 2021-04-01 14:45:46 +01:00
A_D
a1576e9979 Fixed missing default keyword arg 2021-04-01 14:45:46 +01:00
A_D
278480b99f replaced ors with defaults in config usage 2021-04-01 14:45:46 +01:00
Athanasius
25852997c5 Updated all source to use new config methods
# Conflicts:
#	monitor.py
2021-04-01 14:45:46 +01:00
Athanasius
bd670b7ff1 Updated plugins to expect that CAPI data is safe
# Conflicts:
#	plugins/eddn.py
2021-04-01 14:45:45 +01:00
Athanasius
983e4d7acb plugins/eddn: Detailed stop logging. 2021-04-01 14:45:44 +01:00
Athanasius
96bb0959f5 EDDN: Only add missing StarPos if for current system
<https://github.com/EDCD/EDMarketConnector/issues/961>

It seems the game can report a Scan event *after* you've jumped to
another system.  So don't blindly set StarPos on Scan, check the
SystemAddress against where we think we are first.
2021-04-01 08:56:35 +01:00
Athanasius
aab2a58a2d Reduce some log spam:
* Comment out the traceback in plugins/eddn.py, the return is enough.
* 'Called with no event_queue' can be TRACE.
* Don't care about "Everything was alright, the near-neutral status just
  wasn't stored." from Inara.
2021-03-23 13:48:44 +00:00
Athanasius
b4d928246e Adjust logging to include type (and not strictly False). 2021-03-22 11:48:52 +00:00
Athanasius
34c0536a7e Paranoia check in sendreplay().
See #926
2021-03-22 11:43:44 +00:00
Athanasius
6bde36ad31 Extend is_horizons() paranoia to type of ships['shipyard_list']
The .values() is on this, so it also needs to be a dict.

I also made the logging of "FC or Damaged Station?" consistent
throughout this file.

Yes, we'll keep these as logger.debug() for now.
2021-03-17 11:26:34 +00:00
Athanasius
740d1bd38a Correct order of arguments to isinstance() 2021-03-15 19:21:17 +00:00
Athanasius
173cffdcfc Add extra logging to is_horizons() if things not as expected.
* Log the type(s) if not dict.
* Log if ships['shipyard_list'] isn't present, despite ships being a
  dict.
2021-03-15 17:06:26 +00:00
Athanasius
98be182922 plugins/eddn: Add paranoia about data in is_horizons()
A damaged station has `"modules": []`, so trips over modules.values().
2021-03-15 17:03:39 +00:00
Athanasius
abc1507aa0 Also allow sending empty commodities from Market.json 2020-09-28 13:02:10 +01:00
Athanasius
dea7b3660a Minor formatting cleanups 2020-09-28 12:48:53 +01:00
Athanasius
e908cce242 Change the multi-line conditional to using () not \\n 2020-09-28 12:41:44 +01:00
Athanasius
ca4214fff8 EDDN: Catch and log 'we tried to send empty market'.
Very tight check on this to be sure we don't ignore other errors.

	r.status_code == 400  # Not a different code
	$schemaRef == commodities
	The message had empty commodities list
	r.text == expected return from EDDN Gateway
2020-09-28 12:26:09 +01:00
Athanasius
9564d8ab4f EDDN: Allow sending of empty market data for updating FCs. 2020-09-28 12:00:28 +01:00
Athanasius
a3b69fd94d Switch internal plugins to EDMCLogging.get_main_logger() 2020-09-22 16:20:05 +01:00
Athanasius
f485ffa737 Correctly return and receive bare Tuple, not nested. 2020-09-18 12:59:09 +01:00
Athanasius
22a8da5bf7 Add ships sanity checking, and it's all in a helper function now.
* Moved these modules and ships checks to safe_modules_and_ships().
* Applied some paranoia checks to ships as well.
2020-09-18 11:38:20 +01:00
Athanasius
81f71c88ff Catch where station modules from CAPI is an empty list.
Out of paranoia we're also checking if it's a non-empty list and logging
that as an error if encountered.  It should be a dictionary!
2020-09-18 11:15:15 +01:00
Athanasius
31203270bc Switch to "thing is None" on tests. 2020-09-14 15:43:15 +01:00
Athanasius
735e37e10e Revert is_horizons to modules: MAP_STR_ANY as it works 2020-09-14 13:32:06 +01:00
Athanasius
d45070c249 plugins/eddn: Tweak ships/modules in export of shipyard and outfitting from CAPI
There are cases where a station/FC doesn't have outfitting modules or a
ships list.  Let's make the checks happen in both those functions and be
extra paranoid with some logging.

Closes #671
2020-09-14 13:26:20 +01:00
Athanasius
99bac688af eddn: Tweak replay.jsonl try/except flow
* Catch OSError instead of Exception (which is *too* general).
* Put the set of self.replaylog in try/else so it only runs when there
  are no errors.
2020-09-09 14:36:38 +01:00
Athanasius
5e35012611 eddn: flake8 cleanups
* That "EDDN send failed" was too long, so now it's '''-formatted.
* journal_entry() cognitive complexity isn't changing any time soon.
2020-09-09 14:17:39 +01:00
Athanasius
48077f6a30 eddn: Straighten out replay.jsonl opening & minor cleanups.
* The logic for opening replay.jsonl, and detecting if the file was
  already there or not was tortured.  No longer.
* Changed a few logger.debug(..., exc_info=) to logger.exception().
* Changed all logger.warn() (deprecated) to logger.warning().
2020-09-09 14:03:40 +01:00
Athanasius
5d612822da eddn: Tweak the extra EDDN failed message logging format.
It's more readable with \n between each part, and added a prefix.
2020-09-09 13:51:15 +01:00
Athanasius
e693af1283 EDDN: Log the message we tried to send if it fails. 2020-09-08 18:51:17 +01:00
A_D
de872cdfa6
Added warning log messages 2020-08-07 15:46:46 +02:00
A_D
7adf522de9
Replaced repeated code with helper function 2020-08-07 15:18:33 +02:00
A_D
a88cb454da
Removed todo related to Horizons 2020-08-07 14:54:43 +02:00
A_D
94418dc4fa
Switched to using pathlib 2020-08-07 14:54:04 +02:00
A_D
17f8433a6a
clarify comment 2020-08-07 14:45:48 +02:00