feat: add -Swp option

perf: tar.extractall wrapped in asyncio.to_thread
This commit is contained in:
tretrauit 2022-06-27 04:09:47 +07:00
parent aa147792e6
commit efc2abf858
Signed by: tretrauit
GPG Key ID: CDDE1C97EE305DAF
3 changed files with 8 additions and 3 deletions

View File

@ -9,7 +9,7 @@ README = (HERE / "README.md").read_text()
setup(
name='worthless',
version='2.1.0',
version='2.1.0-1',
packages=['worthless', 'worthless.classes', 'worthless.classes.launcher', 'worthless.classes.installer'],
url='https://git.froggi.es/tretrauit/worthless-launcher',
license='MIT License',

View File

@ -274,6 +274,8 @@ async def main():
help="Update the game and specified voiceover pack only (or install if not found)")
parser.add_argument("-Sw", "--download-game", action="store_true",
help="Download the full game to the temporary directory")
parser.add_argument("-Swp", "--download-patch", action="store_true",
help="Download/Update the game patch to the temporary directory")
parser.add_argument("-Swv", "--download-voiceover", action="store", type=str,
help="Download the full voiceover to the temporary directory")
parser.add_argument("-Syw", "--download-game-update", action="store", type=str, default="",
@ -330,6 +332,9 @@ async def main():
if args.download_game:
await ui.download_game()
if args.download_patch:
await ui.download_patch()
if args.download_voiceover:
await ui.download_voiceover(args.download_voiceover)

View File

@ -95,8 +95,8 @@ class Patcher:
if not archive:
raise RuntimeError("Cannot download patch repository")
with tarfile.open(archive) as tar:
tar.extractall(self._patch_path)
async with tarfile.open(archive) as tar:
await asyncio.to_thread(tar.extractall, self._patch_path)
def override_patch_url(self, url) -> None:
"""