Skip to content

Commit

Permalink
Implement OS compatibility info
Browse files Browse the repository at this point in the history
  • Loading branch information
AvaS314 committed Aug 8, 2020
1 parent 015872f commit 7f91bef
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ Note that many games on Itch are not listed in IGDB and therefore will show up a

## Current Features
* Show all purchases in library
* Filter by operating system

## Features planned to be added
* Check local games
* Install purchased games
* Launch games
* Read platform information
* List designated collections as "Subscriptions"
* Game time tracking

Expand Down
2 changes: 1 addition & 1 deletion requirements/app.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# make sure they are installable on all systems your plugin should support

# check newest API version: https://pypi.org/project/galaxy.plugin.api/
galaxy.plugin.api==0.65
galaxy.plugin.api==0.66
aiohttp==3.6.2
15 changes: 12 additions & 3 deletions src/itch.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,31 @@ async def get_user_data(self):
self.authenticated = True
return resp.get("user")

@staticmethod
def parse_json_into_games(resp, games):
def parse_json_into_games(self, resp, games):
for key in resp:
game = key.get("game")
if not game.get("classification") == "game":
continue
game_name = game.get("title")
game_num = game.get("id")
game_num = str(game.get("id"))
logging.debug('Parsed %s, %s', game_name, game_num)
self.persistent_cache[game_num] = game
this_game = Game(
game_id=game_num,
game_title=game_name,
license_info=LicenseInfo(LicenseType.SinglePurchase),
dlcs=[])
games.append(this_game)

async def get_os_compatibility(self, game_id, context):
try:
compat = self.persistent_cache[str(game_id)].get("traits")
os = (OSCompatibility.Windows if "p_windows" in compat else OSCompatibility(0)) | (OSCompatibility.MacOS if "p_osx" in compat else OSCompatibility(0)) | (OSCompatibility.Linux if "p_linux" in compat else OSCompatibility(0))
logging.debug("Compat value: %s", os)
if not os == 0:
return os
except KeyError:
logging.error("Key not found in cache: %s", game_id)

def main():
create_and_run_plugin(ItchIntegration, sys.argv)
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Itch.io integration",
"platform": "itch",
"guid": "2df02142-4d8a-4a4b-9b6e-c3a0bc62f93b",
"version": "0.0.4",
"version": "0.0.5",
"description": "Itch integration",
"author": "Tauqua",
"email": "tauqua@icloud.com",
Expand Down

0 comments on commit 7f91bef

Please sign in to comment.