This repository was archived by the owner on Feb 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
46 lines (40 loc) · 1.41 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
import os
import logging
import re
from logging import config as logging_config
BASE_PATH = os.path.realpath(os.path.dirname(__file__))
DEBUG = os.environ.get('TUNEZINC_DEBUG', False)
GMUSIC_USERNAME = os.environ.get('GMUSIC_USERNAME', '')
GMUSIC_PASSWORD = os.environ.get('GMUSIC_PASSWORD', '')
GMUSIC_PLAYLISTS = re.split('\s*;\s*', os.environ.get('GMUSIC_PLAYLISTS', '').strip()) # TODO: Need a better way to manage this
GMUSIC_CREDENTIALS_STORAGE_LOCATION = os.path.join(BASE_PATH, '.gmusic.credentials')
SPOTIFY_USERNAME = os.environ.get('SPOTIFY_USERNAME', '')
SPOTIFY_CREATE_PUBLIC = os.environ.get('SPOTIFY_CREATE_PUBLIC', False)
SPOTIFY_CLIENT_ID = os.environ.get('SPOTIFY_CLIENT_ID', '')
SPOTIFY_CLIENT_SECRET = os.environ.get('SPOTIFY_CLIENT_SECRET', '')
log_output_level = logging.DEBUG if DEBUG else logging.INFO
logging_config.dictConfig({
'version': 1,
'formatters': {
'default': {
'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s'
}
},
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'default',
'level': log_output_level
}
},
'loggers': {
'app': {
'handlers': ['console'],
'level': log_output_level
},
'gmusicapi': {
'handlers': ['console'] if DEBUG else [],
'level': log_output_level
}
}
})