From 4dbc53872841d82da2b2adf5323237ecd83c1cd9 Mon Sep 17 00:00:00 2001 From: equdevel Date: Fri, 29 Mar 2024 17:51:50 +0800 Subject: [PATCH] Unlock 100 mods limit --- _doc/README_ENG.txt | 2 ++ _doc/README_RUS.txt | 2 ++ mod_installer.py | 33 ++++++++++++++++++++++----------- 3 files changed, 26 insertions(+), 11 deletions(-) diff --git a/_doc/README_ENG.txt b/_doc/README_ENG.txt index 2d2c565..9669df2 100644 --- a/_doc/README_ENG.txt +++ b/_doc/README_ENG.txt @@ -5,6 +5,8 @@ The installer allows you to download mods from mod.io in semi-automatic mode. On Tested on game builds with the CODEX Steam emu and Nemirtingas Epic emu. It may not work with other builds. +DONATE: https://www.donationalerts.com/r/equdevel + Instructions: diff --git a/_doc/README_RUS.txt b/_doc/README_RUS.txt index 52f7c83..6ac5183 100644 --- a/_doc/README_RUS.txt +++ b/_doc/README_RUS.txt @@ -5,6 +5,8 @@ Протестирован на сборках игры с таблеткой CODEX Steam emu и Nemirtingas Epic emu. Возможно не будет работать с другими сборками. +ПОДДЕРЖАТЬ АВТОРА: https://www.donationalerts.com/r/equdevel + Инструкция: diff --git a/mod_installer.py b/mod_installer.py index cece646..80fc506 100644 --- a/mod_installer.py +++ b/mod_installer.py @@ -9,7 +9,7 @@ import argparse -VERSION = '1.6.5' +VERSION = '1.6.6' def _exit(status, message=''): @@ -61,20 +61,30 @@ def _exit(status, message=''): 'X-Modio-Platform': 'Windows' } +print(f'\nSnowRunner/Expeditions mod installer v{VERSION} by equdevel') print('\nChecking subscriptions on mod.io...') -try: - r = requests.get(f'https://api.mod.io/v1/me/subscribed?game_id={GAME_ID}', headers=headers) -except requests.RequestException: - _exit(1, '\nCONNECTION TO mod.io FAILED: please check your Internet connection') -else: - if r.status_code == 401: - _exit(1, f'\nCONNECTION TO mod.io FAILED: please check your access token in .env') - elif r.status_code != 200: - _exit(1, f'\nCONNECTION TO mod.io FAILED: status_code={r.status_code}') +result_offset = 0 +r_data = [] +while True: + try: + r = requests.get(f'https://api.mod.io/v1/me/subscribed?game_id={GAME_ID}&_offset={result_offset}', headers=headers) + except requests.RequestException: + _exit(1, '\nCONNECTION TO mod.io FAILED: please check your Internet connection') + else: + if r.status_code == 401: + _exit(1, f'\nCONNECTION TO mod.io FAILED: please check your access token in .env') + elif r.status_code != 200: + _exit(1, f'\nCONNECTION TO mod.io FAILED: status_code={r.status_code}') + r = r.json() + if r['result_count'] > 0: + r_data.extend(r['data']) + result_offset += 100 + else: + break mods_subscribed = [] -for data in r.json()['data']: +for data in r_data: mod_id = data['id'] mod_name = data['name'] mod_version_download = data['modfile']['version'] @@ -146,4 +156,5 @@ def _exit(status, message=''): with open(USER_PROFILE, mode='w', encoding='utf-8') as f: f.write(json.dumps(user_profile, ensure_ascii=False, indent=4) + '\0') print('\nUpdating user_profile.cfg --> OK') +print('\n\nDONATE: https://www.donationalerts.com/r/equdevel') _exit(0)