Fixed Handling of Single Game Downloads that are not part of your library

This commit is contained in:
64Core 2022-06-04 15:38:08 -05:00
parent c4052c0f1d
commit a123b4dd16
3 changed files with 8 additions and 5 deletions

View file

@ -87,10 +87,12 @@ def main():
lib.games = [game]
break
if len(lib) > 1:
print("Game Is Not In Library, terminating")
return -1
# matches = re.match(r"https://(.+)\.itch\.io/(.+)", args.download_game)
# lib.load_game(matches.group(1), matches.group(2))
print("Game Is Not In Library, Checking for Free Downloads")
lib.games = []
matches = re.match(r"https://(.+)\.itch\.io/(.+)", args.download_game)
lib.load_game(matches.group(1), matches.group(2))
else:
lib.load_owned_games()

View file

@ -171,7 +171,6 @@ class Game:
+ f"download?api_key={token}&download_key_id={self.id}&uuid={j['uuid']}"
)
else:
print("!! NO DOWNLOAD KEY !!")
url = (
f"https://api.itch.io/uploads/{d['id']}/"
+ f"download?api_key={token}&uuid={j['uuid']}"

View file

@ -57,6 +57,8 @@ class Library:
)
k = json.loads(gsp.text)
self.games.append(Game(k))
self.games[-1].id = False
self.games[-1].game_id = j["id"]
def load_games(self, publisher):
"""Load all games by publisher"""