Load defaults from default_config_file only
This removes the need to duplicate settings in code and json file
@@ -19,26 +19,6 @@ class Config(dict):
"TRAKT_USERNAME",
]
- defaults = {
- "log_debug_messages": False,
- "logging": {
- "append": False,
- },
- "sync": {
- "liked_lists": True,
- "watchlist": True,
- "watched_status": True,
- "collection": True,
- "ratings": True,
- },
- "xbmc-providers": {
- "movies": "imdb",
- "shows": "tvdb",
- },
- "excluded-libraries": [
- ],
- }
-
initialized = False
def __getitem__(self, item):
@@ -47,11 +27,11 @@ def __getitem__(self, item):
return dict.__getitem__(self, item)
def initialize(self):
- self.update(self.defaults)
-
- if not exists(config_file):
with open(default_config_file, "r") as fp:
defaults = json.load(fp)
+ self.update(defaults)
+
+ if not exists(config_file):
with open(config_file, "w") as fp:
fp.write(json.dumps(defaults, indent=4))
