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