mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 01:45:28 +00:00
[cli/core] Allow bottle downloads to specify a base url
This commit is contained in:
parent
edadf1c780
commit
05aac59836
|
@ -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')
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue