68 lines
1.9 KiB
Python
68 lines
1.9 KiB
Python
import os
|
|
from pathlib import Path
|
|
from typing import Optional
|
|
|
|
# Base directories
|
|
BASE_DIR = Path(__file__).parent.parent
|
|
DATA_DIR = Path(os.getenv("DATA_DIR", BASE_DIR / "data"))
|
|
TEMP_DIR = Path(os.getenv("TEMP_DIR", BASE_DIR / "temp"))
|
|
|
|
# Logging configuration
|
|
LOG_DIR = DATA_DIR / "logs"
|
|
LOG_FILE = LOG_DIR / "syllabus.log"
|
|
LOG_LEVEL = os.getenv("LOG_LEVEL", "DEBUG")
|
|
LOG_FORMAT = "%(asctime)s - %(levelname)s - %(message)s"
|
|
|
|
# Dropout configuration
|
|
DROPOUT_COOKIES = DATA_DIR / "dropout.cookies.txt"
|
|
DROPOUT_ARCHIVE = LOG_DIR / "dropout.archive.log"
|
|
DROPOUT_JSON = DATA_DIR / "dropout.json"
|
|
DROPOUT_BASE_URL = "https://watch.dropout.tv"
|
|
DROPOUT_POSTER_BASE_URL = os.getenv("DROPOUT_POSTER_BASE_URL", "https://vhx.imgix.net/chuncensoredstaging/assets/")
|
|
|
|
# YouTube configuration
|
|
YOUTUBE_COOKIES = DATA_DIR / "youtube.cookies.txt"
|
|
YOUTUBE_ARCHIVE = LOG_DIR / "youtube.archive.log"
|
|
|
|
# Media directories
|
|
TV_DIR = DATA_DIR / "tv"
|
|
YOUTUBE_DIR = DATA_DIR / "youtube"
|
|
PODCASTS_DIR = DATA_DIR / "podcasts"
|
|
ASMR_DIR = DATA_DIR / "asmr"
|
|
NSFW_DIR = DATA_DIR / "nsfw"
|
|
POSTERS_DIR = DATA_DIR / "posters"
|
|
|
|
# Download settings
|
|
AUDIO_QUALITY = os.getenv("AUDIO_QUALITY", "192")
|
|
DEFAULT_FORMAT = "bestvideo+bestaudio/best"
|
|
AUDIO_FORMAT = "bestaudio/best[ext=mp3]"
|
|
|
|
# Cache settings
|
|
CACHE_TTL = int(os.getenv("CACHE_TTL", "3600")) # 1 hour in seconds
|
|
|
|
# Web UI
|
|
TEMPLATES_DIR = BASE_DIR / "app" / "templates"
|
|
STATIC_DIR = BASE_DIR / "app" / "static"
|
|
|
|
# API settings
|
|
HOST = os.getenv("HOST", "0.0.0.0")
|
|
PORT = int(os.getenv("PORT", "8000"))
|
|
DEBUG = os.getenv("DEBUG", "False").lower() == "true"
|
|
|
|
|
|
def ensure_directories():
|
|
"""Create all required directories if they don't exist."""
|
|
directories = [
|
|
DATA_DIR,
|
|
TEMP_DIR,
|
|
LOG_DIR,
|
|
TV_DIR,
|
|
YOUTUBE_DIR,
|
|
PODCASTS_DIR,
|
|
ASMR_DIR,
|
|
NSFW_DIR,
|
|
POSTERS_DIR,
|
|
]
|
|
for directory in directories:
|
|
directory.mkdir(parents=True, exist_ok=True)
|