From e34cad1889e6d3309e7b92dfa2080ba66aa56501 Mon Sep 17 00:00:00 2001 From: ikun Date: Fri, 20 Sep 2024 21:35:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B0=91=E4=B8=AA=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/main_func.py | 2 +- common/migration.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/common/main_func.py b/common/main_func.py index 82e3b55..889f868 100644 --- a/common/main_func.py +++ b/common/main_func.py @@ -60,7 +60,7 @@ async def main(app_id, repos): collected_depots.extend(result) if collected_depots: if isSteamTools: - migrate(st_use=True) + await migrate(st_use=True, session=session) await stool_add(collected_depots, app_id) log.info(' ✅ 找到SteamTools,已添加解锁文件') if isGreenLuma: diff --git a/common/migration.py b/common/migration.py index b37999c..ab410e2 100644 --- a/common/migration.py +++ b/common/migration.py @@ -35,20 +35,20 @@ async def migrate(st_use, session): async with session.get(down_url, stream=True) as r: if r.status == 200: - total_size = int(r.headers.get('Content-Length', 0)) + total_size = int(await r.headers.get('Content-Length', 0)) chunk_size = 8192 progress = tqdm(total=total_size, unit='B', unit_scale=True) async with aiofiles.open(out_path, mode='wb') as f: async for chunk in r.content.iter_chunked(chunk_size=chunk_size): await f.write(chunk) - progress.update(len(chunk)) + await progress.update(len(chunk)) - progress.close() + await progress.close() else: log.error('⚠ 网络错误') subprocess.run(str(out_path)) os.rmdir(temp_path) else: - log.info('✅ 未使用SteamTools,停止迁移') + log.info('✅ 未使用SteamTools,停止迁移') \ No newline at end of file