diff --git a/setup.py b/setup.py index 1ae1fea..632e7ef 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ README = (HERE / "README.md").read_text() setup( name='worthless', - version='2.2.8', + version='2.2.9', packages=['worthless', 'worthless.classes', 'worthless.classes.launcher', 'worthless.classes.installer'], url='https://git.froggi.es/tretrauit/worthless-launcher', license='MIT License', diff --git a/worthless/__main__.py b/worthless/__main__.py old mode 100755 new mode 100644 diff --git a/worthless/cli.py b/worthless/cli.py old mode 100755 new mode 100644 index 7932f72..1d8d5de --- a/worthless/cli.py +++ b/worthless/cli.py @@ -12,7 +12,7 @@ import worthless.constants as constants class UI: - def __init__(self, gamedir: str, noconfirm: bool, tempdir: str | Path = None, pre_download=False) -> None: + def __init__(self, gamedir: str, noconfirm: bool, tempdir: str | Path = None, pre_download: bool = False, download_chunk: int = 8192) -> None: self._vo_version = None self._noconfirm = noconfirm self._gamedir = gamedir @@ -22,6 +22,7 @@ class UI: self._pre_download = pre_download if self._pre_download: print("Pre-download is enabled, use at your own risk!") + self._installer.set_download_chunk(download_chunk) def _ask(self, question): if self._noconfirm: @@ -315,11 +316,12 @@ async def main(): "detection", type=str, default=None) parser.add_argument("--noconfirm", action="store_true", help="Do not ask any for confirmation. (Ignored in interactive mode)") + parser.add_argument("--download-chunk", action="store", help="Chunks to download (default 8192 bytes)", type=int, default=8192) args = parser.parse_args() if args.temporary_dir: args.temporary_dir.mkdir(parents=True, exist_ok=True) - ui = UI(args.dir, args.noconfirm, args.temporary_dir, args.predownload) + ui = UI(args.dir, args.noconfirm, args.temporary_dir, args.predownload, args.download_chunk) if args.install and args.update: raise ValueError("Cannot specify both --install and --update arguments.") diff --git a/worthless/installer.py b/worthless/installer.py index 3d46329..a87ade1 100644 --- a/worthless/installer.py +++ b/worthless/installer.py @@ -35,6 +35,7 @@ async def _download_file(file_url: str, file_name: str, file_path: Path | str, f } else: await file_path.touch() + print(f"Downloading {file_url} to {file_path}...") async with aiohttp.ClientSession() as session: rsp = await session.get(file_url, headers=headers, timeout=None) if rsp.status == 416: