Add download progress dialog and some mod loader parse function.

This commit is contained in:
wei
2026-07-28 13:35:04 +08:00
parent 8d850408cd
commit 07d5b8a378
17 changed files with 1873 additions and 1025 deletions
+7 -1
View File
@@ -180,6 +180,7 @@ def download_file(file: FileObject, overwrite=True, progress_callback: Callable[
try:
with requests.get(file.url, stream=True) as r:
r.raise_for_status()
current_chunk = 0
total_bytes = r.headers.get("content-length", None)
logger.debug("URL: {}".format(file.url))
@@ -211,7 +212,7 @@ def download_file(file: FileObject, overwrite=True, progress_callback: Callable[
if any([file.expected_sha1, file.expected_md5, file.expected_sha256]):
logger.debug("File hash is match as the expected hash.")
else:
logger.warning("File hash is not checked.")
logger.warning("Hash is not checked for file: {}".format(file.posix_path))
return file
@@ -299,3 +300,8 @@ def get_platform_info():
return platform_name, arch, os_version
def is_valid_zipfile(path: Path) -> bool:
try:
return zipfile.is_zipfile(path)
except OSError:
return False