Stop tracking user modified config.json
Rename config.json to config.default.json
Copy default_config_file if config file is missing
MODIFY
.gitignore
.gitignore
/.idea/
/.pytrakt.json
/.vscode/
+/config.json
/last_update.log
/trakt_cache.sqlite
__pycache__/

RENAME
config.json
config.default.json
MODIFY
plex_trakt_sync/config.py
plex_trakt_sync/config.py
import json
from dotenv import load_dotenv
from os import getenv
-from plex_trakt_sync.path import config_file, env_file
+from plex_trakt_sync.path import config_file, env_file, default_config_file
+from os.path import exists
class Config(dict):
@@ -21,6 +22,12 @@ def __getitem__(self, item):
return dict.__getitem__(self, item)
def initialize(self):
+ if not exists(config_file):
+ with open(default_config_file, "r") as fp:
+ defaults = json.load(fp)
+ with open(config_file, "w") as fp:
+ fp.write(json.dumps(defaults, indent=4))
+
with open(config_file, "r") as fp:
config = json.load(fp)
self.update(config)

MODIFY
plex_trakt_sync/path.py
plex_trakt_sync/path.py
from os.path import dirname, abspath, join
app_path = dirname(dirname(abspath(__file__)))
+default_config_file = join(app_path, "config.default.json")
config_file = join(app_path, "config.json")
pytrakt_file = join(app_path, ".pytrakt.json")
env_file = join(app_path, ".env")

Stop tracking user modified config.json

- Rename config.json to config.default.json
- Copy default_config_file if config file is missing