diff --git a/tradedangerous/plugins/spansh_plug.py b/tradedangerous/plugins/spansh_plug.py index 56851cbb..a908cc82 100644 --- a/tradedangerous/plugins/spansh_plug.py +++ b/tradedangerous/plugins/spansh_plug.py @@ -259,6 +259,14 @@ def run(self) -> bool: theme = self.tdenv.theme BOLD, CLOSE, DIM, ITALIC = theme.bold, theme.CLOSE, theme.dim, theme.italic # pylint: disable=invalid-name + + if not self.file: + url = self.url or SOURCE_URL + self.print(f'Downloading prices from remote URL: {url}') + self.file = Path(self.tdenv.tmpDir, "galaxy_stations.json") + transfers.download(self.tdenv, url, self.file) + self.print(f'Download complete, saved to local file: "{self.file}"') + sys_desc = f"Importing {ITALIC}spansh{CLOSE} data" with Timing() as timing, Progresser(self.tdenv, sys_desc, total=len(self.known_systems)) as progress: @@ -377,13 +385,6 @@ def run(self) -> bool: return False def data_stream(self): - if not self.file: - url = self.url or SOURCE_URL - self.print(f'Downloading prices from remote URL: {url}') - self.file = Path(self.tdenv.tmpDir, "galaxy_stations.json") - transfers.download(self.tdenv, url, self.file) - self.print(f'Download complete, saved to local file: "{self.file}"') - if self.file == '-': self.print('Reading prices from stdin') stream = sys.stdin