#=================================================#
#   ██████╗ ██████╗ ███╗   ███╗███████╗████████╗  #
#  ██╔════╝██╔═══██╗████╗ ████║██╔════╝╚══██╔══╝  #
#  ██║     ██║   ██║██╔████╔██║█████╗     ██║     #
#  ██║     ██║   ██║██║╚██╔╝██║██╔══╝     ██║     #
#  ╚██████╗╚██████╔╝██║ ╚═╝ ██║███████╗   ██║     #
#   ╚═════╝ ╚═════╝ ╚═╝     ╚═╝╚══════╝   ╚═╝     #
#=================================================#

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

# ============================== #
# FastAPI Server Configuration   #
# ============================== #
FASTAPI_HOST=0.0.0.0
FASTAPI_PORT=2020
FASTAPI_WORKERS=-1
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

# ============================== #
# Database Configuration         #
# ============================== #
# The database type to use. If using SQLite, the path to the database file is required.
# If using PostgreSQL, the URL to the database is required.
# Postgres should only be used if you need concurrency e.g. mutliple instances of Comet, or using 
# multiple debrid services with Comet.
DATABASE_TYPE=sqlite                    # Options: sqlite, postgresql
DATABASE_URL=comet:comet@comet_postgres:5432/comet  # 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
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


# ============================== #
# Debrid Proxy Configuration     #
# ============================== #
# Bypass Debrid Services and Torrentio IP blacklist
# You can also use http://gluetun:8080 if you use Gluetun.
DEBRID_PROXY_URL=http://warp:1080 

# ============================== #
# Indexer Manager Settings       #
# ============================== #
INDEXER_MANAGER_TYPE=none                                                 # Options: jackett, prowlarr, none
INDEXER_MANAGER_URL=http://jackett:9117 
INDEXER_MANAGER_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
INDEXER_MANAGER_TIMEOUT=60                                                # Max time to get search results (seconds)
INDEXER_MANAGER_INDEXERS='["EXAMPLE1_CHANGETHIS", "EXAMPLE2_CHANGETHIS"]' # Jackett/Prowlarr indexers


# ======================================================= #
# 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


# ============================== #
# 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
# If self-hosting Zilean, use the following format:
# ZILEAN_URL=http://zilean:8181
# Multi-instance example:
# ZILEAN_URL='["https://zilean1.example.com", "https://zilean2.example.com"]'

SCRAPE_STREMTHRU=False
STREMTHRU_SCRAPE_URL=https://stremthru.13377001.xyz
# You can also use your own instance of StremThru if you are self-hosting it:
# STREMTHRU_SCRAPE_URL=http://stremthru:8080
# Multi-instance example:
# STREMTHRU_SCRAPE_URL='["https://stremthru1.example.com", "https://stremthru2.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
# You can also use your own instance of MediaFusion if you are self-hosting it:
# MEDIAFUSION_URL=http://mediafusion:8000
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

SCRAPE_TORBOX=False
TORBOX_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

# ============================== #
# StremThru Integration          #
# ============================== #
# StremThru is used to provide debrid capability to the addon, and is required for the addon to work.
# It provides cache information too.
STREMTHRU_URL=http://stremthru:8080
# You can instead use this public instance of StremThru which has access to the ElfHosted cache, hosted by
# the developer of StremThru:
# STREMTHRU_URL=https://stremthru.13377001.xyz

# ============================== #
# 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

