-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
33 lines (24 loc) · 1.2 KB
/
config.py
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
import os
from pathlib import Path
from dotenv import load_dotenv
from constants import BASE_FOLDER
load_dotenv()
SETTINGS_SUFFIX = "NVP"
def value(name: str, default: str) -> str:
return os.getenv(f"{SETTINGS_SUFFIX}_{name}", default)
# !!!ATTENTION!!!
# THE SERVER ASSUMES THAT ALL SETTINGS ARE CONFIGURED CORRECTLY!
# YOU NEED TO CHECK WHETHER ALL SETTINGS ARE CORRECT YOURSELF! (if you are not a hacker, you will probably do them
# all correct)
# !!!ATTENTION!!!
OUTPUT_FOLDER = Path.cwd().joinpath(value("OUTPUT_FOLDER", "./static/output")).relative_to(BASE_FOLDER)
SEGMENTS_API_URL = value("SEGMENTS_API_URL", "https://sponsor.ajay.app/api/skipSegments")
SEGMENTS_CATEGORIES = value("SEGMENTS_CATEGORIES", "sponsor,intro,outro,selfpromo,interaction,music_offtopic") \
.split(",")
IS_DEBUG = bool(int(value("DEBUG", "0")))
DEFAULT_AUDIO_QUALITY = int(value("DEFAULT_AUDIO_QUALITY", "320"))
MIN_AUDIO_QUALITY = int(value("MIN_AUDIO_QUALITY", "65"))
MAX_AUDIO_QUALITY = int(value("MAX_AUDIO_QUALITY", "320"))
DEFAULT_SKIP_SEGMENTS = bool(int(value("DEFAULT_SKIP_SEGMENTS", "1")))
THUMBNAIL_JPEG_QUALITY = int(value("THUMBNAIL_JPEG_QUALITY", "80"))
MAX_AUDIO_LENGTH = int(value("MAX_AUDIO_LENGTH", str(60 * 6)))