-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
31 lines (26 loc) · 1.04 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
import json
import os
class Config:
CALIBRE_DB_PATH = None
QUERY_WITH_IDENTIFIER = False
BABELIO_URL = None
SLEEP_BETWEEN_BOOKS = 5
NB_BOOKS_BEFORE_SLEEP = None
SLEEP_AFTER_NB_BOOKS = None
USE_VIRTUEL_LIBRARY_NAME = None
USE_CALIBRE_QUERY = None
DEBUG = None
def __init__(self, f):
config = json.load(f)
self.CALIBRE_DB_PATH = config.get("CALIBRE_DB_PATH")
self.QUERY_WITH_IDENTIFIER = config.get("QUERY_WITH_IDENTIFIER")
self.BABELIO_URL = config.get("BABELIO_URL")
self.SLEEP_BETWEEN_BOOKS = config.get("SLEEP_BETWEEN_BOOKS")
self.NB_BOOKS_BEFORE_SLEEP = config.get("NB_BOOKS_BEFORE_SLEEP")
self.SLEEP_AFTER_NB_BOOKS = config.get("SLEEP_AFTER_NB_BOOKS")
self.USE_VIRTUEL_LIBRARY_NAME = config.get("USE_VIRTUEL_LIBRARY_NAME")
self.USE_CALIBRE_QUERY = config.get("USE_CALIBRE_QUERY")
self.DEBUG = config.get("DEBUG")
config_path = os.path.join(os.path.dirname(__file__), "config.json")
print(config_path)
config = Config(open(config_path, "r"))