#=================================================#
#   ██████╗ ██████╗ ███╗   ███╗███████╗████████╗  #
#  ██╔════╝██╔═══██╗████╗ ████║██╔════╝╚══██╔══╝  #
#  ██║     ██║   ██║██╔████╔██║█████╗     ██║     #
#  ██║     ██║   ██║██║╚██╔╝██║██╔══╝     ██║     #
#  ╚██████╗╚██████╔╝██║ ╚═╝ ██║███████╗   ██║     #
#   ╚═════╝ ╚═════╝ ╚═╝     ╚═╝╚══════╝   ╚═╝     #
#          Thank you for using Comet! 🚀          #
#=================================================#

# ============================== #
# Stremio Addon Configuration    #
# ============================== #
ADDON_ID=stremio.comet.fast
ADDON_NAME=Comet

# ============================== #
# FastAPI Server Configuration   #
# ============================== #
FASTAPI_HOST=0.0.0.0
FASTAPI_PORT=8000
FASTAPI_WORKERS=1 # set to -1 for auto-scaling (min((os.cpu_count() or 1) * 2 + 1, 12))
USE_GUNICORN=True # Will use uvicorn if False or if on Windows

# ============================== #
# Dashboard Settings             #
# ============================== #
ADMIN_DASHBOARD_PASSWORD=CHANGE_ME # The password to access the dashboard
PUBLIC_METRICS_API=False # Set to True to allow public access to the metrics API (/admin/api/metrics)

# ============================== #
# Database Configuration         #
# ============================== #
DATABASE_TYPE=sqlite # Options: sqlite, postgresql - If you have enabled auto-scaling for FASTAPI_WORKERS and are using PostgreSQL, remember to drastically increase your maximum number of connections to your DB if Comet is experiencing connection issues
DATABASE_URL=username:password@hostname:port # For PostgreSQL
DATABASE_PATH=data/comet.db # Only relevant for SQLite
DATABASE_BATCH_SIZE=20000 # The batch size for the database import and export operations

# ============================== #
# Cache Settings (Seconds)       #
# ============================== #
METADATA_CACHE_TTL=2592000  # 30 days
TORRENT_CACHE_TTL=1296000  # 15 days
DEBRID_CACHE_TTL=86400  # 1 day
METRICS_CACHE_TTL=60  # 1 minute
SCRAPE_LOCK_TTL=300  # 5 minutes - Duration for distributed scraping locks
SCRAPE_WAIT_TIMEOUT=30  # 30 seconds - Max time to wait for other instance to complete scraping

# ======================================================= #
# Background Scraper                                      #
# Zilean and no-ratelimit indexers/scrapers recommended!  #
# PostgreSQL recommended for high worker count!           #
# ======================================================= #
BACKGROUND_SCRAPER_ENABLED=False
BACKGROUND_SCRAPER_CONCURRENT_WORKERS=1 # Number of concurrent workers for scraping (adjust depending on whether you are often ratelimited by scrapers)
BACKGROUND_SCRAPER_INTERVAL=3600 # Interval between scraping cycles in seconds
BACKGROUND_SCRAPER_MAX_MOVIES_PER_RUN=100 # Maximum number of movies to scrape per run
BACKGROUND_SCRAPER_MAX_SERIES_PER_RUN=100 # Maximum number of series to scrape per run

# ============================== #
# Proxy Configuration            #
# ============================== #
BYPASS_PROXY_URL=http://warp:1080 # To bypass scraper IP blacklists

# ============================== #
# Indexer Manager Settings       #
# ============================== #
INDEXER_MANAGER_TYPE=none # Options: jackett, prowlarr, none
INDEXER_MANAGER_URL=http://127.0.0.1:9117
INDEXER_MANAGER_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
INDEXER_MANAGER_MODE=both # Context mode: live, background, both, false - Controls when indexer is used
INDEXER_MANAGER_TIMEOUT=60  # Max time to get search results (seconds)
INDEXER_MANAGER_INDEXERS='["EXAMPLE1_CHANGETHIS", "EXAMPLE2_CHANGETHIS"]' # Jackett/Prowlarr indexers - get names from https://github.com/Jackett/Jackett/tree/master/src/Jackett.Common/Definitions for Jackett

# ============================== #
# Torrent Settings               #
# ============================== #
GET_TORRENT_TIMEOUT=5 # Max time to obtain torrent info hash (seconds)
DOWNLOAD_TORRENT_FILES=False # Enable torrent file retrieval (instead of magnet link only)

# ============================== #
# Scraping Configuration         #
# ============================== #
# Multi-Instance Scraping Support:
# - Single URL: Use a simple string for one instance (default behavior)
# - Multiple URLs: Use JSON array format for multiple instances
# - Example single: COMET_URL=https://comet.elfhosted.com
# - Example multi: COMET_URL='["https://comet1.example.com", "https://comet2.example.com"]'
#
# Scraper Context Modes:
# Each SCRAPE_* setting and INDEXER_MANAGER_MODE can control when scrapers are used:
# - true/both: Used for live scraping AND background scraping (default)
# - live: Only used for live scraping (when users request content)
# - background: Only used for background scraping (automatic content pre-caching)
# - false: Completely disabled
#
# Examples:
# SCRAPE_COMET=both          # Used for both live and background scraping
# SCRAPE_TORRENTIO=live      # Fast live scraping only
# SCRAPE_ZILEAN=background   # Background cache building only
# SCRAPE_NYAA=false          # Completely disabled
# INDEXER_MANAGER_MODE=live  # Jackett/Prowlarr for live scraping only

SCRAPE_COMET=False
COMET_URL=https://comet.elfhosted.com
# Multi-instance example:
# COMET_URL='["https://comet1.example.com", "https://comet2.example.com"]'

SCRAPE_NYAA=False
NYAA_ANIME_ONLY=True # Only scrape Nyaa if the content is anime
NYAA_MAX_CONCURRENT_PAGES=5 # Maximum number of concurrent requests to Nyaa (consider reducing if you are often ratelimited by Nyaa)

SCRAPE_ZILEAN=False
ZILEAN_URL=https://zilean.elfhosted.com
# Multi-instance example:
# ZILEAN_URL='["https://zilean1.example.com", "https://zilean2.example.com"]'

SCRAPE_STREMTHRU=False
STREMTHRU_SCRAPE_URL=https://stremthru.13377001.xyz
# Multi-instance example:
# STREMTHRU_SCRAPE_URL='["https://stremthru1.example.com", "https://stremthru2.example.com"]'

SCRAPE_BITMAGNET=False
BITMAGNET_URL=https://bitmagnetfortheweebs.midnightignite.me
BITMAGNET_MAX_CONCURRENT_PAGES=5
BITMAGNET_MAX_OFFSET=15000 # Maximum number of entries to scrape
# Multi-instance example:
# BITMAGNET_URL='["https://bitmagnet1.example.com", "https://bitmagnet2.example.com"]'

SCRAPE_TORRENTIO=False
TORRENTIO_URL=https://torrentio.strem.fun
# Multi-instance example:
# TORRENTIO_URL='["https://torrentio.strem.fun", "https://custom-torrentio.example.com"]'

SCRAPE_MEDIAFUSION=False
MEDIAFUSION_URL=https://mediafusion.elfhosted.com
MEDIAFUSION_API_PASSWORD= # API password for MediaFusion instances that require authentication
MEDIAFUSION_LIVE_SEARCH=True
# Multi-instance MediaFusion examples:
# MEDIAFUSION_URL='["https://mediafusion1.example.com", "https://mediafusion2.example.com"]'
# MEDIAFUSION_API_PASSWORD='["password1", "password2"]' # One password per URL in same order
# MEDIAFUSION_API_PASSWORD=single_password # Same password for all instances
# MEDIAFUSION_API_PASSWORD= # No password for any instance

SCRAPE_AIOSTREAMS=False
AIOSTREAMS_URL=https://aio.example.com
AIOSTREAMS_USER_UUID_AND_PASSWORD=user_uuid:password
# Multi-instance AIOStreams examples:
# AIOSTREAMS_URL='["https://aio1.example.com", "https://aio2.example.com"]'
# AIOSTREAMS_USER_UUID_AND_PASSWORD='["uuid1:password1", "uuid2:password2"]' # One credential per URL in same order
# AIOSTREAMS_USER_UUID_AND_PASSWORD=single_uuid:single_password # Same credentials for all instances

SCRAPE_JACKETTIO=False
JACKETTIO_URL=https://jackettio.example.com # Full manifest URL without /manifest.json at the end
# Multi-instance example:
# JACKETTIO_URL='["https://jackettio1.example.com", "https://jackettio2.example.com"]'

SCRAPE_DEBRIDIO=False
DEBRIDIO_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
DEBRIDIO_PROVIDER=realdebrid # alldebrid, debrider, debridlink, easydebrid, premiumize, realdebrid, torbox
DEBRIDIO_PROVIDER_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

SCRAPE_TORBOX=False
TORBOX_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

SCRAPE_YGGTORRENT=False
YGGTORRENT_USERNAME=username
YGGTORRENT_PASSWORD=password
YGGTORRENT_MAX_CONCURRENT_PAGES=5

# ============================== #
# Debrid Stream Proxy Settings   #
# ============================== #
PROXY_DEBRID_STREAM=False
PROXY_DEBRID_STREAM_PASSWORD=CHANGE_ME
PROXY_DEBRID_STREAM_MAX_CONNECTIONS=-1 # -1 to disable connection limits
PROXY_DEBRID_STREAM_DEBRID_DEFAULT_SERVICE=realdebrid
PROXY_DEBRID_STREAM_DEBRID_DEFAULT_APIKEY=CHANGE_ME

# ============================== #
# Content Filtering              #
# ============================== #
REMOVE_ADULT_CONTENT=False

# ============================== #
# UI Customization               #
# ============================== #
CUSTOM_HEADER_HTML=None

# ============================== #
# StremThru Integration          #
# ============================== #
STREMTHRU_URL=https://stremthru.13377001.xyz # needed to use debrid services
