feat: --download-chunk
Also bump to 2.2.9
This commit is contained in:
parent
178f513e52
commit
95dccf7241
2
setup.py
2
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',
|
||||
|
0
worthless/__main__.py
Executable file → Normal file
0
worthless/__main__.py
Executable file → Normal file
6
worthless/cli.py
Executable file → Normal file
6
worthless/cli.py
Executable file → Normal file
@ -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.")
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user