diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..ef4fc83 --- /dev/null +++ b/Readme.md @@ -0,0 +1,37 @@ +# Google Photo to VCard + +A set of scripts to download profile images from Google and write them to vcards. Useful for completing the migration from Google to Nextcloud or ownCloud. + +## Setup + +To run, you first need to set up a few config files + +### Google Credentials + +To get people info from your Google account, you first need to create an application from the Google Cloud Console and then download your credentials. + +1. Go to https://console.developers.google.com and create a new project +1. Add access to the Google People API (Library > Search for People > Enable) +1. Create a new set of credentials (Credentials > Create credentials > OAuth client ID > other (Give it a name) > Create) +1. Click the download icon next to the new credentials and save to this project directory as `client_secret.json` + + +### Vdirsyncer Config + +This is the config that will allow you to sync to and from your remote VCard directory. The following instructions are for Nextcloud, but you can refer to the [official documentation](https://vdirsyncer.pimutils.org/en/stable/tutorial.html) for more instructions. + +Edit ./vdirsyncer.conf.example adding your server url, username, and password in the `[storage my_contacts_remote]` section. + +## Running + +Once your configuration is set up, you should be able to download and add photos to all your contacts by executing: + +``` +make add-photos +``` + +It's then worth taking a look and making sure that the results are as you expected. When you're happy with them, you can push the contacts back up to your remote server by running: + +``` +make sync-contacts +``` diff --git a/vdirsyncer.conf.example b/vdirsyncer.conf.example index 527a0ab..1527bc6 100644 --- a/vdirsyncer.conf.example +++ b/vdirsyncer.conf.example @@ -1,23 +1,17 @@ # An example configuration for vdirsyncer. # -# Move it to ~/.vdirsyncer/config or ~/.config/vdirsyncer/config and edit it. -# Run `vdirsyncer --help` for CLI usage. -# # Optional parameters are commented out. # This file doesn't document all available parameters, see # http://vdirsyncer.pimutils.org/ for the rest of them. [general] # A folder where vdirsyncer can store some metadata about each pair. -status_path = "~/.vdirsyncer/status/" +status_path = "./build/vdirsyncer/status/" # CARDDAV -[pair bob_contacts] -# A `[pair ]` block defines two storages `a` and `b` that should be -# synchronized. The definition of these storages follows in `[storage ]` -# blocks. This is similar to accounts in OfflineIMAP. -a = "bob_contacts_local" -b = "bob_contacts_remote" +[pair my_contacts] +a = "my_contacts_local" +b = "my_contacts_remote" # Synchronize all collections that can be found. # You need to run `vdirsyncer discover` if new calendars/addressbooks are added @@ -34,37 +28,15 @@ metadata = ["displayname"] # `"b wins"` - assume b's items to be more up-to-date #conflict_resolution = null -[storage bob_contacts_local] +[storage my_contacts_local] # A storage references actual data on a remote server or on the local disk. # Similar to repositories in OfflineIMAP. type = "filesystem" -path = "~/.contacts/" +path = "./build/contacts/" fileext = ".vcf" -[storage bob_contacts_remote] +[storage my_contacts_remote] type = "carddav" -url = "https://nextcloud.example.com/" -#username = -# The password can also be fetched from the system password storage, netrc or a -# custom command. See http://vdirsyncer.pimutils.org/en/stable/keyring.html -#password = - -# CALDAV -[pair bob_calendar] -a = "bob_calendar_local" -b = "bob_calendar_remote" -collections = ["from a", "from b"] - -# Calendars also have a color property -metadata = ["displayname", "color"] - -[storage bob_calendar_local] -type = "filesystem" -path = "~/.calendars/" -fileext = ".ics" - -[storage bob_calendar_remote] -type = "caldav" -url = "https://nextcloud.example.com/" -#username = -#password = +url = "https://my.nextcloud.com/remote.php/dav" +username = "my_user" +password = "my_pass"