Skip to content

Commit

Permalink
Update NSLGameScanner.py
Browse files Browse the repository at this point in the history
  • Loading branch information
moraroy authored Dec 25, 2024
1 parent 2f200ae commit 49cd078
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions NSLGameScanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1329,31 +1329,36 @@ def get_amazon_games():
# List to store final Itch.io game details
itchgames = []

# Match game_id between 'caves' and 'games' tables
itchgames = []
# Match game_id between 'caves' and 'games' tables and collect relevant game details
for cave in caves:
game_id = cave[1]
if game_id in games_dict:
game_info = games_dict[game_id]
base_path = json.loads(cave[11])['basePath']
candidates = json.loads(cave[11])['candidates']
cave_info = json.loads(cave[11])
base_path = cave_info['basePath']
candidates = cave_info.get('candidates', [])

# Check if candidates exist and are not empty
if candidates:
executable_path = candidates[0].get('path', None)

# If there's no valid executable path, skip this entry
if not executable_path:
print(f"Skipping game (no executable found): {game_info[2]}")
continue

if candidates and isinstance(candidates, list) and len(candidates) > 0:
executable_path = candidates[0].get('path')
if executable_path and executable_path.endswith('.html'):
# Skip games with an executable that ends with '.html' (browser games)
if executable_path.endswith('.html'):
print(f"Skipping browser game: {game_info[2]}")
continue

# Extract the game title
game_title = game_info[2]

# Append the game info (base path, executable path, game title) to the list
itchgames.append((base_path, executable_path, game_title))
else:
print(f"No candidates found for game: {game_info[2]}")


# Extract the game title
game_title = game_info[2]

# Append the game info (base path, executable path, game title) to the list
itchgames.append((base_path, executable_path, game_title))
print(f"Skipping game (no candidates): {game_info[2]}")

# Process each game for creating new entries
for base_path, executable, game_title in itchgames:
Expand All @@ -1367,7 +1372,7 @@ def get_amazon_games():

# Close the database connection
conn.close()

# End of Itch.io Scanner


Expand Down

0 comments on commit 49cd078

Please sign in to comment.