1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-06-07 19:03:23 +03:00

Merge branch 'stable' into main

This commit is contained in:
Athanasius 2020-07-14 11:43:57 +01:00
commit a5becb7f7c
4 changed files with 64 additions and 41 deletions

View File

@ -1,6 +1,17 @@
This is the master changelog for Elite Dangerous Market Connector. Entries are in reverse chronological order (latest first). This is the master changelog for Elite Dangerous Market Connector. Entries are in reverse chronological order (latest first).
--- ---
Release 4.0.1.0
===
This fixes a bug with the EDDB 'System Provider' URLs.
* It was possible to pick up, and use, a bad SystemAddress from the Frontier
CAPI. The CAPI will no longer be used as a source for this.
* If we do not yet have a SystemAddress from the Journal we will use the
SystemName instead. This carries the small risk of the player being in one
of the duplicate-name systems, in which case EDDB might not display the
correct system.
Release 4.0.0.0 Release 4.0.0.0
=== ===
Developers please note the new [Contributing.md](https://github.com/EDCD/EDMarketConnector/blob/main/Contributing.md) Developers please note the new [Contributing.md](https://github.com/EDCD/EDMarketConnector/blob/main/Contributing.md)

View File

@ -8,7 +8,7 @@ from sys import platform
appname = 'EDMarketConnector' appname = 'EDMarketConnector'
applongname = 'E:D Market Connector' applongname = 'E:D Market Connector'
appcmdname = 'EDMC' appcmdname = 'EDMC'
appversion = '4.0.0.0' appversion = '4.0.1.0'
copyright = u'© 2015-2019 Jonathan Harris, 2020 EDCD' copyright = u'© 2015-2019 Jonathan Harris, 2020 EDCD'
update_feed = 'https://raw.githubusercontent.com/EDCD/EDMarketConnector/releases/edmarketconnector.xml' update_feed = 'https://raw.githubusercontent.com/EDCD/EDMarketConnector/releases/edmarketconnector.xml'

View File

@ -168,11 +168,22 @@
<!-- Windows --> <!-- Windows -->
<item> <item>
<title>Release 4.0.0.0</title> <title>Release 4.0.1.0</title>
<description> <description>
<![CDATA[ <![CDATA[
<style>body { font-family:"Segoe UI","Tahoma"; font-size: 75%; } h2 { font-family:"Segoe UI","Tahoma"; font-size: 105%; }</style> <style>body { font-family:"Segoe UI","Tahoma"; font-size: 75%; } h2 { font-family:"Segoe UI","Tahoma"; font-size: 105%; }</style>
<h2>Release 4.0.1.0</h2>
<p>This fixes a bug with the EDDB 'System Provider' URLs.</p>
<ul>
<li>It was possible to pick up, and use, a bad SystemAddress from the Frontier
CAPI. The CAPI will no longer be used as a source for this.</li>
<li>If we do not yet have a SystemAddress from the Journal we will use the
SystemName instead. This carries the small risk of the player being in one
of the duplicate-name systems, in which case EDDB might not display the
correct system.</li>
</ul>
<h2>Release 4.0.0.0</h2> <h2>Release 4.0.0.0</h2>
<p>Developers please note the new <a href="https://github.com/EDCD/EDMarketConnector/blob/main/Contributing.md">Contributing.md</a> <p>Developers please note the new <a href="https://github.com/EDCD/EDMarketConnector/blob/main/Contributing.md">Contributing.md</a>
, particularly <a href="https://github.com/EDCD/EDMarketConnector/blob/main/Contributing.md#git-branch-structure-and-tag-conventions">Git branch structure and tag conventions</a> , particularly <a href="https://github.com/EDCD/EDMarketConnector/blob/main/Contributing.md#git-branch-structure-and-tag-conventions">Git branch structure and tag conventions</a>
@ -479,11 +490,11 @@ If any of your plugins are listed in that section then they will need updating,
]]> ]]>
</description> </description>
<enclosure <enclosure
url="https://github.com/EDCD/EDMarketConnector/releases/download/Release/4.0.0.0/EDMarketConnector_win_4.0.0.0.msi" url="https://github.com/EDCD/EDMarketConnector/releases/download/Release/4.0.1.0/EDMarketConnector_win_4.0.1.0.msi"
sparkle:os="windows" sparkle:os="windows"
sparkle:installerArguments="/passive LAUNCH=yes" sparkle:installerArguments="/passive LAUNCH=yes"
sparkle:version="4.0.0.0" sparkle:version="4.0.1.0"
length="10338304" length="11313152"
type="application/octet-stream" type="application/octet-stream"
/> />
</item> </item>

View File

@ -3,17 +3,12 @@
# Station display and eddb.io lookup # Station display and eddb.io lookup
# #
import pickle
import csv
import os
from os.path import join
import sys import sys
import urllib.parse
from config import config from config import config
STATION_UNDOCKED = u'×' # "Station" name to display when not docked = U+00D7 STATION_UNDOCKED: str = u'×' # "Station" name to display when not docked = U+00D7
this = sys.modules[__name__] # For holding module globals this = sys.modules[__name__] # For holding module globals
@ -22,17 +17,19 @@ this.system_population = None
this.station_marketid = None # Frontier MarketID this.station_marketid = None # Frontier MarketID
# Main window clicks # Main window clicks
def system_url(system_address): def system_url(system_name: str) -> str:
if system_address: if this.system_address:
return 'https://eddb.io/system/ed-address/%s' % system_address return 'https://eddb.io/system/ed-address/{}'.format(this.system_address)
elif system_name:
return 'https://eddb.io/system/name/{}'.format(system_name)
else: else:
return '' return ''
def station_url(system_name, station_name): def station_url(system_name: str, station_name: str) -> str:
if this.station_marketid: if this.station_marketid:
return 'https://eddb.io/station/market-id/{}'.format(this.station_marketid) return 'https://eddb.io/station/market-id/{}'.format(this.station_marketid)
else: else:
return system_url(this.system_address) return system_url('')
def plugin_start3(plugin_dir): def plugin_start3(plugin_dir):
return 'eddb' return 'eddb'
@ -46,15 +43,17 @@ def plugin_app(parent):
def prefs_changed(cmdr, is_beta): def prefs_changed(cmdr, is_beta):
if config.get('system_provider') == 'eddb': if config.get('system_provider') == 'eddb':
this.system_link['url'] = system_url(this.system_address) # Override standard URL function this.system_link['url'] = system_url('') # Override standard URL function
def journal_entry(cmdr, is_beta, system, station, entry, state): def journal_entry(cmdr, is_beta, system, station, entry, state):
if config.get('system_provider') == 'eddb': # Always update, even if we're not the *current* system provider.
this.system_address = entry.get('SystemAddress') or this.system_address this.system_address = entry.get('SystemAddress') or this.system_address
this.system_link['url'] = system_url(this.system_address) # Override standard URL function # But only actually change the URL if we are current system provider.
if config.get('system_provider') == 'eddb':
this.system_link['url'] = system_url('') # Override standard URL function
if config.get('station_provider') == 'eddb': # Always update, even if we're not the *current* station provider.
if entry['event'] in ['StartUp', 'Location', 'FSDJump', 'CarrierJump']: if entry['event'] in ['StartUp', 'Location', 'FSDJump', 'CarrierJump']:
this.system_population = entry.get('Population') this.system_population = entry.get('Population')
@ -63,23 +62,25 @@ def journal_entry(cmdr, is_beta, system, station, entry, state):
elif entry['event'] in ['Undocked']: elif entry['event'] in ['Undocked']:
this.station_marketid = None this.station_marketid = None
# But only actually change the URL if we are current station provider.
if config.get('station_provider') == 'eddb':
this.station_link['text'] = station or (this.system_population and this.system_population > 0 and STATION_UNDOCKED or '') this.station_link['text'] = station or (this.system_population and this.system_population > 0 and STATION_UNDOCKED or '')
this.station_link.update_idletasks() this.station_link.update_idletasks()
def cmdr_data(data, is_beta): def cmdr_data(data, is_beta):
if config.get('system_provider') == 'eddb': # Always store initially, even if we're not the *current* system provider.
# Only fill in system_address from CAPI if it's not set yet if not this.station_marketid:
# This is to avoid CAPI lagging causing incorrect value this.station_marketid = data['commander']['docked'] and data['lastStarport']['id']
if not this.system_address:
this.system_address = data['lastSystem']['id']
this.system_link['url'] = system_url(this.system_address) # Override standard URL function
# 'eddb' is also the *default* Station provider # 'eddb' is also the *default* Station provider
if not config.get('station_provider') or config.get('station_provider') == 'eddb': if not config.get('station_provider') or config.get('station_provider') == 'eddb':
# Only use CAPI value if not yet set # Only use CAPI value if not yet set
# This is to avoid CAPI lagging causing incorrect value # This is to avoid CAPI lagging causing incorrect value
if not this.station_marketid: if data['commander']['docked']:
this.station_marketid = data['commander']['docked'] and data['lastStarport']['id'] this.station_link['text'] = data['lastStarport']['name']
this.station_link['text'] = data['commander']['docked'] and data['lastStarport']['name'] or (data['lastStarport']['name'] and data['lastStarport']['name'] != "" and STATION_UNDOCKED or '') elif data['lastStarport']['name'] and data['lastStarport']['name'] != "":
this.station_link['text'] = STATION_UNDOCKED
else:
this.station_link['text'] = ''
this.station_link.update_idletasks() this.station_link.update_idletasks()