From 05aac598360b30b89972cf74f007644e6cfcff53 Mon Sep 17 00:00:00 2001 From: derrod Date: Fri, 31 Dec 2021 21:24:47 +0100 Subject: [PATCH] [cli/core] Allow bottle downloads to specify a base url --- legendary/cli.py | 3 ++- legendary/core.py | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/legendary/cli.py b/legendary/cli.py index 759c9e5..57fd6d4 100644 --- a/legendary/cli.py +++ b/legendary/cli.py @@ -2240,7 +2240,8 @@ class LegendaryCLI: return bottle_name = clean_filename(new_name).strip() - dlm, ares, path = self.core.prepare_bottle_download(bottle_name, install_candidate['manifest']) + dlm, ares, path = self.core.prepare_bottle_download(bottle_name, install_candidate['manifest'], + base_url=install_candidate.get('base_url')) logger.info(f'Bottle install directory: {path}') logger.info(f'Bottle size: {ares.install_size / 1024 / 1024:.2f} MiB') diff --git a/legendary/core.py b/legendary/core.py index dd445ca..45764ee 100644 --- a/legendary/core.py +++ b/legendary/core.py @@ -1839,11 +1839,13 @@ class LegendaryCore: lgd_version_data = self.lgd.get_cached_version() return lgd_version_data.get('data', {}).get('cx_bottles', []) - def prepare_bottle_download(self, bottle_name, manifest_url): + def prepare_bottle_download(self, bottle_name, manifest_url, base_url=None): r = self.egs.unauth_session.get(manifest_url) r.raise_for_status() manifest = self.load_manifest(r.content) - base_url = manifest_url.rpartition('/')[0] + + if not base_url: + base_url = manifest_url.rpartition('/')[0] path = mac_get_bottle_path(bottle_name) if os.path.exists(path):