import json import os class Account: def __init__(self): # Load from config/device.json if available, else use defaults config = self._load_config() self.name = config.get("owner_name", "quoije") self.avatar_path = config.get("avatar_path", "img/yaris.png") self.pp_image = None self.car = None def _load_config(self): """Load device config from JSON file, return dict with defaults.""" config_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "config", "device.json") try: if os.path.exists(config_path): with open(config_path, 'r') as f: return json.load(f) except (IOError, json.JSONDecodeError): pass return {}