Spaces:
Running
Running
File size: 3,565 Bytes
f00d260 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
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'
]
@classmethod
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() |