Skip to content

Commit

Permalink
Unlock 100 mods limit
Browse files Browse the repository at this point in the history
  • Loading branch information
equdevel committed Mar 29, 2024
1 parent c03d535 commit 4dbc538
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
2 changes: 2 additions & 0 deletions _doc/README_ENG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 2 additions & 0 deletions _doc/README_RUS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

������������� �� ������� ���� � ��������� CODEX Steam emu � Nemirtingas Epic emu. �������� �� ����� �������� � ������� ��������.

���������� ������: https://www.donationalerts.com/r/equdevel


����������:

Expand Down
33 changes: 22 additions & 11 deletions mod_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import argparse


VERSION = '1.6.5'
VERSION = '1.6.6'


def _exit(status, message=''):
Expand Down Expand Up @@ -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']
Expand Down Expand Up @@ -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)

0 comments on commit 4dbc538

Please sign in to comment.