Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config added: Per server/library configuration example and instructions. #1814

Merged
merged 9 commits into from
Feb 22, 2024
92 changes: 92 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,98 @@ $ plextraktsync --server=Example1 info
INFO Enabled 2 libraries in Plex Server: ['Movies', 'TV Shows']
```

### Per server configuration

If you want to specify your config per server you can do so inside of `servers.yml`. Within the `config` part of the server configuration you can specify how that specific server should work.

```yml
Example1:
token: ~
urls:
- http://localhost:32400
config:
sync:
plex_to_trakt:
collection: true
trakt_to_plex:
liked_lists: false
```
Using `sync` in a server config overrides the global sync-config in `config.yml`.

This can also be used to have different configs between different libraries. To be able to do this you specify the number of servers you need (most likely equal to the number of different config setups you need). For example:

```yml
Example1:
token: ~
urls:
- http://localhost:32400
config:
libraries:
- "Movies"
sync:
plex_to_trakt:
ratings: true
watched_status: true
trakt_to_plex:
ratings: true
watched_status: true
Example2:
token: ~
urls:
- http://localhost:32400
config:
libraries:
- "TV Shows"
sync:
plex_to_trakt:
ratings: true
watched_status: false
trakt_to_plex:
ratings: true
watched_status: false
```
The above config would make it so that the "Movies" library syncs both ratings and watched status, while the "TV Shows" library only syncs ratings.
To then run the sync you need to specify `--server Example1` or `--server Example2` to run the sync for that specific server.

Running the sync command without `--server` will use default server from `.env`

If you want to run these jobs using `ofelia`, you can do so by running something similar to this in your `docker-compose.yml`:
```yml
plextraktsync:
image: ghcr.io/taxel/plextraktsync
command: sync
container_name: plextraktsync
profiles: ["schedule"]
volumes:
- /configs/mediarr/plextraktsync:/app/config
environment:
- PUID=1000
- PGID=1000
depends_on:
- plex
scheduler:
image: mcuadros/ofelia:latest
container_name: scheduler
command: daemon --docker
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
labels:
ofelia.job-run.plextraktsync.schedule: "0 6,18 * * *"
ofelia.job-run.plextraktsync.container: "plextraktsync"
ofelia.job-run.plextraktsync.command: "--server 'Example1' sync"
ofelia.job-run.plextraktsync2.schedule: "0 12,0 * * *"
ofelia.job-run.plextraktsync2.container: "plextraktsync"
ofelia.job-run.plextraktsync2.command: "--server 'Example2' sync"
```
If you are running only one PlexTraktSync container, you need to make sure that the two jobs Ofelia jobs don't run at the same time. Ofelia skips scheduling a new job run if the previous job is still running.

Depending on how long it takes for the job to run on your server you might have to keep the schedule of the two jobs seperated with a few minutes or a few hours. If you have two different PlexTraktSync containers in your docker compose, you can run them at the same time.

The above config means that a job is running every 6 hours, alternating between the two "servers". The PlexTraktSync container also has a [docker compose profile] called "schedule" which means that it won't run automatically when you run for example `docker-compose up`.

[docker compose profile]: https://docs.docker.com/compose/profiles/

### Logging

The logging level by default is `INFO`. This can be changed to DEBUG by editing
Expand Down
Loading