diff --git a/worthless/cli.py b/worthless/cli.py index 9312e37..e37d9b8 100644 --- a/worthless/cli.py +++ b/worthless/cli.py @@ -169,7 +169,8 @@ class UI: return await self.download_game() print("Game archive:", game.latest.get_name()) - await self._install_from_archive(self._installer.temp_path.joinpath(game.latest.get_name()), forced) + # I'm too lazy to properly fix things so here we are :D + await self._install_from_archive(self._installer.temp_path.joinpath(game.latest.segments[0]["path"].split("/")[-1]), forced) async def install_voiceover(self, languages: str): res_info = await self._launcher.get_resource_info() diff --git a/worthless/installer.py b/worthless/installer.py index 2796ad3..7e9923d 100644 --- a/worthless/installer.py +++ b/worthless/installer.py @@ -40,13 +40,9 @@ async def _download_file(file_url: str, file_name: str, file_path: Path | str, f if rsp.status == 416: return rsp.raise_for_status() - while True: - chunk = await rsp.content.read(chunks) - await asyncio.sleep(0) - if not chunk: - break - with file_path.open("ab") as f: - f.write(chunk) + with file_path.open("ab") as f: + async for data in rsp.content.iter_chunked(chunks): + f.write(data) def calculate_md5(file_to_calculate):