import os from dotenv import load_dotenv load_dotenv() # Load .env file for local development ORG = "MML-ANALYSING-SHYPER-AND-API-MID-STRUCTER" HF_TOKEN = os.environ.get("HF_TOKEN", "") TELEGRAM_BOT_TOKEN = os.environ.get("TELEGRAM_BOT_TOKEN", "") TMDB_API_KEY = os.environ.get("TMDB_API_KEY", "") DEV_MODE = os.environ.get("DEV_MODE", "").lower() in ("true", "1", "yes") DB_SPACE_URL = os.environ.get("DB_SPACE_URL", f"https://{ORG.lower()}-db.hf.space") ACCOUNTS = { "main": ORG, "user1": "multimedia-cryptography-benchmarks", "user2": "rayig", "user3": "ToolKit-backend", "user4": "Dgntsnfangskgsjafjyjysjtsjtsjwtjfsjyejyrky", } ACCOUNT_NAMES = { "user1": "Mshary", "user2": "Abdullah", "user3": "Abdulaziz", "user4": "Tariq", } ACCOUNT_TOKENS = { "user1": os.environ.get("HF_TOKEN_USER1", ""), "user2": os.environ.get("HF_TOKEN_USER2", ""), "user3": os.environ.get("HF_TOKEN_USER3", ""), "user4": os.environ.get("HF_TOKEN_USER4", ""), } PROXY_SPACE_TTL = 28800 # 8 hours PROXY_CACHE_TTL = 3600 # 1 hour TMDB_IMAGE_BASE = "https://image.tmdb.org/t/p" CORS_ORIGINS = ["*"] def resolve_proxy_url(account_key: str) -> str: namespace = ACCOUNTS.get(account_key, account_key) slug = namespace.lower().replace("_", "-") return f"https://{slug}-proxy.hf.space" def resolve_archiver_url(account_key: str) -> str: namespace = ACCOUNTS.get(account_key, account_key) slug = namespace.lower().replace("_", "-") return f"https://{slug}-archiver.hf.space" def dataset_for_account(account_key: str) -> str | None: namespace = ACCOUNTS.get(account_key, account_key) if namespace == ORG: return None return f"{namespace}/archive" def account_name_for_key(account_key: str) -> str: return ACCOUNT_NAMES.get(account_key, account_key)