Update to use config.yml by default
MODIFY
.gitignore
.gitignore
/.pytrakt.json
/.vscode/
/config.json
+/config.yml
/config/
/dist/
/docker-compose.override.yml

MODIFY
README.md
README.md
@@ -190,12 +190,12 @@ Installing from GitHub is considered developer mode and it's documented in
## Sync settings
To disable parts of the functionality of this software, look no further than
-`config.json`. Here, in the sync section, you can disable the following things
+`config.yml`. Here, in the sync section, you can disable the following things
by setting them from `true` to `false` in a text editor:
-At first run, the script will create `config.json` based on `config.default.yml`.
+At first run, the script will create `config.yml` based on `config.default.yml`.
If you want to customize settings before first run (eg. you don't want full
-sync) you can copy and edit `config.json` before launching the script.
+sync) you can copy and edit `config.yml` before launching the script.
- Downloading liked lists from Trakt and adding them to Plex
- Downloading your watchlist from Trakt and adding it to Plex
@@ -214,9 +214,9 @@ You can view sync progress in the `plextraktsync.log` file which will be created
### Logging
-The logging level by default is `INFO`. This can be changed to DEBUG by editing the "debug" variable in `config.json` to `true`.
+The logging level by default is `INFO`. This can be changed to DEBUG by editing the "debug" variable in `config.yml` to `true`.
-By default the logs will append, if you wish to maintain the log of only your last run then edit the "append" variable in `config.json` to `false`.
+By default the logs will append, if you wish to maintain the log of only your last run then edit the "append" variable in `config.yml` to `false`.
## Commands
@@ -279,7 +279,7 @@ and scrobble plays. It does NOT run a sync between Plex and Trakt.
[plex-scrobbler]: https://blog.trakt.tv/plex-scrobbler-52db9b016ead
-To restrict scrobbling to your user **only** (recommended), set the following in your `config.json`:
+To restrict scrobbling to your user **only** (recommended), set the following in your `config.yml`:
```json
{

MODIFY
plextraktsync/config.py
plextraktsync/config.py
@@ -113,7 +113,12 @@ def initialize(self):
"""
Config load order:
- load config.defaults.yml
- - if config.yml present, load and merge it
+ - if config.yml missing, write defaults to it
+ - if config.json present and config.yml is not:
+ - load config.json
+ - write config.yml with config.json contents
+ - merge loaded config
+ - else config.yml present, load and merge it
"""
self.initialized = True
@@ -121,10 +126,14 @@ def initialize(self):
defaults = loader.load(default_config_file)
self.update(defaults)
- if not exists(self.config_file):
- loader.write_json(self.config_file, defaults)
+ if exists(self.config_file) and not exists(self.config_yml):
+ config = loader.load(self.config_file)
+ loader.write(self.config_yml, config)
+ else:
+ if not exists(self.config_yml):
+ loader.write(self.config_yml, defaults)
+ config = loader.load(self.config_yml)
- config = loader.load_json(self.config_file)
self.merge(config, self)
override = self["config"]["dotenv_override"]

Update to use config.yml by default