imLinguin / nile

Unofficial Amazon Games client
GNU General Public License v3.0
307 stars 16 forks source link

library sync broke nile #4

Closed nebadon2025 closed 1 year ago

nebadon2025 commented 2 years ago

I just ran ./nile library sync and now i get this when i try to list the library

nebadon@BIFROST:~/install/nile/bin$ ./nile library list Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/home/nebadon/install/nile/nile/cli.py", line 247, in <module> sys.exit(main()) File "/home/nebadon/install/nile/nile/cli.py", line 226, in main cli.handle_library() File "/home/nebadon/install/nile/nile/cli.py", line 62, in handle_library games.sort(key=self.sort_by_title) File "/home/nebadon/install/nile/nile/cli.py", line 49, in sort_by_title return element["product"]["title"] KeyError: 'title'

I did a git pull and git reset --hard and git clean and same results.

imLinguin commented 2 years ago

That would suggest some game is missing title field? That issue is really weird. Try syncing again. (I doubt it will change the outcome)

You can also try to find the game that is missing the title in ~/.config/nile/library.json

This script should fail when trying to display the title, but it will show you the id of game it failed on So it will help identifying this issue

import json
import os
import sys

if not sys.argv[1]:
    exit()

file = open(sys.argv[1], 'r')

data = file.read()
file.close()
games = json.loads(data)

for game in games:
    sys.stdout.write(f"{game['id']} ")
    sys.stdout.flush()
    print(f"{game['product']['title']}; FINE")
nebadon2025 commented 2 years ago

ok so I found the issue it appears to a sonic game on steam?

https://gist.github.com/nebadon2025/ba1b1c62d5211a7ee08f7ae9c33d894a

imLinguin commented 2 years ago

So, apparently the metadata for this game (Whiskey & Zombies) is also missing for Amazon Games, like we spoke on Discord. Official launcher also seem to don't have that title metadata (when sorting by title game is on the top). I pushed some stability improving commits to make sure nile won't crash when displaying library.

nebadon2025 commented 2 years ago

I can confirm latest code fixes the crash, Thanks!