Spaces:
Running
Running
import os | |
import logging | |
from dotenv import load_dotenv | |
# Load environment variables from .env file | |
load_dotenv() | |
# Create logger for this module | |
logger = logging.getLogger(__name__) | |
class Config: | |
"""Application configuration class.""" | |
# TMDB API configuration | |
TMDB_API_KEY: str = os.getenv("TMDB_API_KEY", "") | |
# OMDB API configuration | |
OMDB_API_KEY: str = os.getenv("OMDB_API_KEY", "") | |
# Hugging Face token for ML models | |
HF_TOKEN: str = os.getenv("HF_TOKEN", "") | |
# Top 10 countries with extensive movie catalogs - show genre selection | |
TOP_COUNTRIES = [ | |
"United States of America (US)", | |
"France (FR)", | |
"United Kingdom (GB)", | |
"Germany (DE)", | |
"Japan (JP)", | |
"Spain (ES)", | |
"India (IN)", | |
"Canada (CA)", | |
"Italy (IT)", | |
"Brazil (BR)" | |
] | |
# Top 55 countries based on movie count analysis | |
COUNTRIES = [ | |
"United States of America (US)", | |
"France (FR)", | |
"United Kingdom (GB)", | |
"Germany (DE)", | |
"Japan (JP)", | |
"Spain (ES)", | |
"India (IN)", | |
"Canada (CA)", | |
"Italy (IT)", | |
"Brazil (BR)", | |
"China (CN)", | |
"Mexico (MX)", | |
"Russia (RU)", | |
"South Korea (KR)", | |
"Soviet Union (SU)", | |
"Sweden (SE)", | |
"Portugal (PT)", | |
"Australia (AU)", | |
"Netherlands (NL)", | |
"Hong Kong (HK)", | |
"Philippines (PH)", | |
"Turkey (TR)", | |
"Argentina (AR)", | |
"Czechoslovakia (CS)", | |
"Poland (PL)", | |
"Denmark (DK)", | |
"Austria (AT)", | |
"Indonesia (ID)", | |
"Taiwan (TW)", | |
"Greece (GR)", | |
"Switzerland (CH)", | |
"Iran (IR)", | |
"Egypt (EG)", | |
"Finland (FI)", | |
"Hungary (HU)", | |
"Norway (NO)", | |
"Czech Republic (CZ)", | |
"Thailand (TH)", | |
"Belgium (BE)", | |
"Ireland (IE)", | |
"Israel (IL)", | |
"Ukraine (UA)", | |
"Yugoslavia (YU)", | |
"Saudi Arabia (SA)", | |
"Romania (RO)", | |
"Malaysia (MY)", | |
"New Zealand (NZ)", | |
"Bangladesh (BD)", | |
"Singapore (SG)", | |
"Chile (CL)", | |
"Iceland (IS)", | |
"Latvia (LV)", | |
"Colombia (CO)", | |
"Peru (PE)", | |
"Bulgaria (BG)" | |
] | |
# Available decades for movie selection | |
DECADES = [ | |
"1930s", "1940s", "1950s", "1960s", "1970s", | |
"1980s", "1990s", "2000s", "2010s", "2020s" | |
] | |
# Available genres for movie selection | |
GENRES = [ | |
'Action', 'Adventure', 'Animation', 'Comedy', 'Crime', | |
'Documentary', 'Drama', 'Family', 'Fantasy', 'History', | |
'Horror', 'Music', 'Mystery', 'Romance', 'Science Fiction', | |
'Thriller', 'TV Movie', 'War', 'Western' | |
] | |
def validate(cls) -> bool: | |
"""Validate that required configuration is present.""" | |
# Check for TMDB API key | |
if not cls.TMDB_API_KEY: | |
logger.error("TMDB_API_KEY is required. Please set it in your .env file.") | |
raise ValueError("TMDB_API_KEY is required. Please set it in your .env file.") | |
# Check for OMDB API key | |
if not cls.OMDB_API_KEY: | |
logger.error("OMDB_API_KEY is required. Please set it in your .env file.") | |
raise ValueError("OMDB_API_KEY is required. Please set it in your .env file.") | |
logger.info("Configuration validation successful") | |
return True | |
# Global config instance | |
config = Config() |