mirror of
https://github.com/wahyd4/you-music.git
synced 2026-08-09 05:06:44 +10:00
43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
from pydantic_settings import BaseSettings
|
|
from typing import Optional
|
|
import os
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
# API Settings
|
|
API_V1_STR: str = "/api/v1"
|
|
PROJECT_NAME: str = "YouMusic"
|
|
|
|
# Directories
|
|
BASE_DIR: str = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
|
|
MUSIC_DIR: str = os.path.join(BASE_DIR, "data", "music")
|
|
UPLOAD_DIR: str = os.path.join(BASE_DIR, "data", "uploads")
|
|
TEMP_DIR: str = os.path.join(BASE_DIR, "data", "temp")
|
|
|
|
# Database
|
|
DATABASE_URL: str = "sqlite+aiosqlite:///./data/youmusic.db"
|
|
|
|
# CORS
|
|
BACKEND_CORS_ORIGINS: list = ["*"]
|
|
|
|
# Download Settings
|
|
PROXY: Optional[str] = None
|
|
FFMPEG_LOCATION: str = "/usr/local/bin/ffmpeg"
|
|
|
|
# YT-DLP Settings
|
|
YT_DLP_FORMAT: str = "bestaudio/best"
|
|
YT_DLP_AUDIO_FORMAT: str = "mp3"
|
|
YT_DLP_AUDIO_QUALITY: str = "0"
|
|
|
|
class Config:
|
|
case_sensitive = True
|
|
env_file = ".env"
|
|
|
|
|
|
settings = Settings()
|
|
|
|
# Ensure directories exist
|
|
os.makedirs(settings.MUSIC_DIR, exist_ok=True)
|
|
os.makedirs(settings.UPLOAD_DIR, exist_ok=True)
|
|
os.makedirs(settings.TEMP_DIR, exist_ok=True)
|