-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathconfig.py
96 lines (75 loc) · 2.75 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import os
import logging
from os import getenv
from dotenv import load_dotenv
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)
LOGGER = logging.getLogger(__name__)
if not os.environ.get("ENV"):
load_dotenv('.env', override=True)
class Config(object):
#--------------------
# MAIN BOT VARIABLES
#--------------------
try:
TG_BOT_TOKEN = getenv("TG_BOT_TOKEN")
APP_ID = int(getenv("APP_ID"))
API_HASH = getenv("API_HASH")
DATABASE_URL = getenv("DATABASE_URL")
BOT_USERNAME = getenv("BOT_USERNAME")
ADMINS = set(int(x) for x in getenv("ADMINS").split())
except:
LOGGER.warning("BOT : Essential Configs are missing")
exit(1)
#--------------------
# BOT WORKING DIRECTORY
#--------------------
# For pyrogram temp files
WORK_DIR = getenv("WORK_DIR", "./bot/")
# Just name of the Downloads Folder
DOWNLOADS_FOLDER = getenv("DOWNLOADS_FOLDER", "DOWNLOADS")
DOWNLOAD_BASE_DIR = WORK_DIR + DOWNLOADS_FOLDER
LOCAL_STORAGE = getenv("LOCAL_STORAGE", DOWNLOAD_BASE_DIR)
#--------------------
# FILE/FOLDER NAMING
#--------------------
PLAYLIST_NAME_FORMAT = getenv("PLAYLIST_NAME_FORMAT", "{title} - Playlist")
#ALBUM_NAME_FORMAT = getenv("ALBUM_PATH_FORMAT", "{album} - {albumartist}")
TRACK_NAME_FORMAT = getenv("TRACK_NAME_FORMAT", "{title} - {artist}")
#--------------------
# RCLONE / INDEX
#--------------------
RCLONE_CONFIG = getenv("RCLONE_CONFIG", None)
# No trailing slashes '/' for both index and rclone_dest
RCLONE_DEST = getenv("RCLONE_DEST", 'remote:newfolder')
INDEX_LINK = getenv('INDEX_LINK', None)
#--------------------
# QOBUZ
#--------------------
QOBUZ_EMAIL = getenv("QOBUZ_EMAIL", None)
QOBUZ_PASSWORD = getenv("QOBUZ_PASSWORD", None)
QOBUZ_USER = getenv("QOBUZ_USER", None)
QOBUZ_TOKEN = getenv("QOBUZ_TOKEN", None)
#--------------------
# DEEZER
#--------------------
DEEZER_EMAIL = getenv("DEEZER_EMAIL", None)
DEEZER_PASSWORD = getenv("DEEZER_PASSWORD", None)
DEEZER_BF_SECRET = getenv("DEEZER_BF_SECRET", None)
DEEZER_TRACK_URL_KEY = getenv("DEEZER_TRACK_URL_KEY", None)
DEEZER_ARL = getenv("DEEZER_ARL", None)
#--------------------
# TIDAL
#--------------------
ENABLE_TIDAL = getenv("ENABLE_TIDAL", None)
TIDAL_MOBILE = getenv("TIDAL_MOBILE", None) # only use email pass in mobile session
TIDAL_MOBILE_TOKEN = getenv("TIDAL_MOBILE_TOKEN", None)
TIDAL_ATMOS_MOBILE_TOKEN = getenv("TIDAL_ATMOS_MOBILE_TOKEN", None)
TIDAL_TV_TOKEN = getenv("TIDAL_TV_TOKEN", None)
TIDAL_TV_SECRET = getenv("TIDAL_TV_SECRET", None)
#--------------------
# CONCURRENT
#--------------------
MAX_WORKERS = int(getenv("MAX_WORKERS", 5))