Updated changelog.
This commit is contained in:
@@ -16,6 +16,7 @@ import configparser
|
||||
import pathlib
|
||||
import re
|
||||
import simpleaudio as sa
|
||||
import json
|
||||
|
||||
class VoicedMenu:
|
||||
def __init__(self, title="Stormux Game Menu"):
|
||||
@@ -58,6 +59,37 @@ class VoicedMenu:
|
||||
# Track playing sound
|
||||
self.currentSound = None
|
||||
|
||||
# Load downloadable games registry
|
||||
self.downloadable_games = self.load_downloadable_games()
|
||||
|
||||
def load_downloadable_games(self):
|
||||
"""Load downloadable games registry from JSON file"""
|
||||
registry_path = "/usr/share/stormux/downloadable_games.json"
|
||||
try:
|
||||
if os.path.exists(registry_path):
|
||||
with open(registry_path, 'r') as f:
|
||||
data = json.load(f)
|
||||
return data.get('downloadable_games', {})
|
||||
return {}
|
||||
except Exception as e:
|
||||
print(f"Error loading downloadable games registry: {e}")
|
||||
return {}
|
||||
|
||||
def is_game_installed(self, game_id):
|
||||
"""Check if a downloadable game is installed"""
|
||||
if game_id not in self.downloadable_games:
|
||||
return True # Not a downloadable game, assume installed
|
||||
|
||||
game_info = self.downloadable_games[game_id]
|
||||
game_dir = os.path.expanduser(f"~/.local/games/{game_info['directory']}")
|
||||
return os.path.exists(game_dir) and os.path.exists(os.path.join(game_dir, game_info['executable']))
|
||||
|
||||
def get_display_name(self, game_name, game_id=None):
|
||||
"""Get display name for menu item, adding (not installed) if needed"""
|
||||
if game_id and game_id in self.downloadable_games and not self.is_game_installed(game_id):
|
||||
return f"{game_name} (not installed)"
|
||||
return game_name
|
||||
|
||||
def init_speech(self):
|
||||
"""Initialize the speech client"""
|
||||
try:
|
||||
@@ -996,6 +1028,8 @@ if __name__ == "__main__":
|
||||
menu.add_item("Arcade", "Toy Mania", "GAME='Toy Mania' startx")
|
||||
menu.add_item("Arcade", "Villains From Beyond", "GAME='Villains From Beyond' startx")
|
||||
menu.add_item("Arcade", "Wicked Quest", "GAME='Wicked Quest' startx")
|
||||
menu.add_item("Arcade", menu.get_display_name("Wreckingball", "wreckingball"), "GAME='Wreckingball' startx")
|
||||
menu.add_item("Arcade", menu.get_display_name("Wreckingball (Pulped)", "wreckingball-pulped"), "GAME='Wreckingball (Pulped)' startx")
|
||||
menu.add_item("Arcade", "Zombowl", "GAME='Zombowl' startx")
|
||||
|
||||
# Add board and card games section
|
||||
@@ -1103,6 +1137,7 @@ if __name__ == "__main__":
|
||||
menu.add_item("System", "Set Timezone", "GAME='Set Timezone' /home/stormux/.clirc")
|
||||
menu.add_item("System", "Upload Files", "/home/stormux/.local/upload_server/uploader.py")
|
||||
menu.add_item("System", "Download Files", "/home/stormux/.local/download_server.py")
|
||||
menu.add_item("System", "Update System", "sudo /usr/local/bin/live-update.sh")
|
||||
menu.add_item("System", "Restart: Can Take Several Minutes", "sudo reboot")
|
||||
menu.add_item("System", "Power Off: Wait 2 Minutes Before Disconnecting Power", "sudo poweroff")
|
||||
# Service menu items will be added dynamically in run() method via update_service_menu_items()
|
||||
|
||||
Reference in New Issue
Block a user