https://github.com/daniele-athome/immich-carddav-sync
Synchronize Immich person information from a CardDAV server
https://github.com/daniele-athome/immich-carddav-sync
carddav immich python vcard
Last synced: 4 months ago
JSON representation
Synchronize Immich person information from a CardDAV server
- Host: GitHub
- URL: https://github.com/daniele-athome/immich-carddav-sync
- Owner: daniele-athome
- Created: 2023-08-18T19:50:14.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-23T09:29:23.000Z (7 months ago)
- Last Synced: 2024-12-21T08:13:17.820Z (5 months ago)
- Topics: carddav, immich, python, vcard
- Language: Python
- Homepage:
- Size: 630 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Immich CardDAV sync tool
========================A tool to sync dates of birth in Immich from a CardDAV server.
Configuration is provided via environment variables (`.env` file is supported).
| Name | Description |
|----------------------------------|------------------------------------------------|
| CARDDAV_SYNC_CARDDAV_URL | URL to the CardDAV server |
| CARDDAV_SYNC_CARDDAV_ADDRESSBOOK | Address book name or ID in the CardDAV server. |
| CARDDAV_SYNC_CARDDAV_USERNAME | Username of CardDAV server |
| CARDDAV_SYNC_CARDDAV_PASSWORD | Password of CardDAV server |
| CARDDAV_SYNC_IMMICH_API_URL | Immich instance API URL (including "/api") |
| CARDDAV_SYNC_IMMICH_API_KEY | Immich API key |
| CARDDAV_SYNC_CRON_EXPRESSION | Cron expression (only for daemon image) |Environment variable LOG_LEVEL will configure the logging level (standard Python logging levels: DEBUG, INFO, WARNING,
ERROR, CRITICAL).## Implementation notes
* matching between contacts and Immich people is between
the [formatted name field](https://datatracker.ietf.org/doc/html/rfc6350#section-6.2.1) of the contact and the Immich
person's name
* people in Immich with the same name will have the same date of birth
* duplicate contacts (i.e. with identical formatted name) are not supported yet (will cause exit with error)## Installation
> TODO package install
Running the tool needs Poetry for now.
FIXME poetry preparation etc.
```shell
poetry run immich-carddav-sync
```## Usage with Docker
Add a cronjob in your system that executes this command:
```shell
docker run --rm --name immich-carddav-sync --env-file=immich-carddav-sync.env ghcr.io/daniele-athome/immich-carddav-sync:master
```The `immich-carddav-sync.env` file should contain all the necessary environment variables (see above). If you prefer you
can add those variables to the Immich `.env` file itself and reference that one.## Integrate in Immich (docker compose)
Configure the variables described above in your `.env` file and add a service to your `docker-compose.yml` file using
the daemon image:```yaml
services:
[...]carddav-sync:
container_name: immich_carddav_sync
image: ghcr.io/daniele-athome/immich-carddav-sync-daemon:latest
env_file:
- .env
restart: always
depends_on:
- immich-server[...]
```## Roadmap
* use s6-overlay instead of simple Debian cron (mainly because of vixie-cron not reacting to signals)
* support for duplicate contacts (ask interactively or assume a predefined behavior)
* match names with a custom (or multiple) vCard field(s)
* dry run mode