Skip to content
Snippets Groups Projects
Commit 5cee743f authored by Vicki Pfau's avatar Vicki Pfau
Browse files

scripts: Add steamcmd download script

parent 5c92c2ea
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
import getpass
import io
import os
import requests
import retro.data
import subprocess
import sys
import tarfile
import tempfile
username = input('Username: ')
password = getpass.getpass('Password (leave blank if cached): ')
if password:
password = password + '\n'
authcode = input('Steam Guard code (leave blank if unknown): ')
if authcode:
password = password + authcode + '\n'
with tempfile.TemporaryDirectory() as dir:
if sys.platform.startswith('linux'):
r = requests.get('https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz')
elif sys.platform.startswith('darwin'):
r = requests.get('https://steamcdn-a.akamaihd.net/client/installer/steamcmd_osx.tar.gz')
else:
raise RuntimeError('Unknown platform %s' % sys.platform)
tarball = tarfile.open(fileobj=io.BytesIO(r.content))
tarball.extractall(dir)
command = ['%s/steamcmd.sh' % dir,
'+login', username,
'+force_install_dir', dir,
'+@sSteamCmdForcePlatformType', 'windows',
'+app_update', '34270', 'validate',
'+quit']
print('Downloading ROMs...')
subprocess.run(command, check=True, input=password.encode('utf-8'), stdout=subprocess.DEVNULL)
romdir = os.path.join(dir, 'uncompressed ROMs')
roms = [os.path.join(romdir, rom) for rom in os.listdir(romdir)]
retro.data.merge(*roms, quiet=False)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment