mirror of
https://gitlab.com/Mr_Goldberg/goldberg_emulator.git
synced 2024-11-09 22:28:38 +01:00
Don't crash script when some controller configs don't have URLs.
This commit is contained in:
parent
3c1fc7f53d
commit
7e1409596a
1 changed files with 11 additions and 6 deletions
5
scripts/generate_emu_config.py
Normal file → Executable file
5
scripts/generate_emu_config.py
Normal file → Executable file
|
@ -183,12 +183,17 @@ def download_published_file(client, published_file_id, backup_directory):
|
||||||
with open(os.path.join(backup_directory, "info.txt"), "w") as f:
|
with open(os.path.join(backup_directory, "info.txt"), "w") as f:
|
||||||
f.write(str(ugc_info.body))
|
f.write(str(ugc_info.body))
|
||||||
|
|
||||||
|
if len(file_details.file_url) > 0:
|
||||||
with urllib.request.urlopen(file_details.file_url) as response:
|
with urllib.request.urlopen(file_details.file_url) as response:
|
||||||
data = response.read()
|
data = response.read()
|
||||||
with open(os.path.join(backup_directory, file_details.filename.replace("/", "_").replace("\\", "_")), "wb") as f:
|
with open(os.path.join(backup_directory, file_details.filename.replace("/", "_").replace("\\", "_")), "wb") as f:
|
||||||
f.write(data)
|
f.write(data)
|
||||||
return data
|
return data
|
||||||
return None
|
return None
|
||||||
|
else:
|
||||||
|
print("Could not download file", published_file_id, "no url (you can ignore this if the game doesn't need a controller config)")
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_inventory_info(client, game_id):
|
def get_inventory_info(client, game_id):
|
||||||
return client.send_um_and_wait('Inventory.GetItemDefMeta#1', {
|
return client.send_um_and_wait('Inventory.GetItemDefMeta#1', {
|
||||||
|
|
Loading…
Reference in a new issue