feat: support pre-downloading game & voicepacks

This commit is contained in:
2022-08-23 17:02:20 +07:00
parent 34a8ab6d99
commit 04dc922230
5 changed files with 62 additions and 49 deletions

View File

@ -10,7 +10,10 @@ class Game:
@staticmethod
def from_dict(data):
diffs = []
for diff in data['diffs']:
diffs.append(Diff.from_dict(diff))
return Game(Latest.from_dict(data['latest']), diffs, data)
try:
diffs = []
for diff in data['diffs']:
diffs.append(Diff.from_dict(diff))
return Game(Latest.from_dict(data['latest']), diffs, data)
except (KeyError, ValueError):
return data

View File

@ -27,4 +27,4 @@ class Resource:
@staticmethod
def from_dict(data):
return Resource(Game.from_dict(data['game']), data['plugin'], data['web_url'], data['force_update'],
data['pre_download_game'], data['deprecated_packages'], data['sdk'], data)
Game.from_dict(data['pre_download_game']), data['deprecated_packages'], data['sdk'], data)