Browse Source

Add a bit more debugging and pin python version to 3.7 since there are issues with 3.9

master
IamTheFij 2 months ago
parent
commit
44a245bc9d
  1. 2
      Makefile
  2. 17
      google_photo_to_vcard/build_photo_json.py
  3. 1
      requirements.txt
  4. 2
      vdirsyncer-wrapper

2
Makefile

@ -4,7 +4,7 @@ default: add-photos
virtualenv: virtualenv_run
virtualenv_run:
virtualenv --python python3 virtualenv_run
virtualenv --python python3.7 virtualenv_run
./virtualenv_run/bin/pip install -r ./requirements.txt
build/email_to_photo.json: virtualenv_run

17
google_photo_to_vcard/build_photo_json.py

@ -129,7 +129,7 @@ def main():
request=service.people().connections().list(
resourceName='people/me',
pageSize=100,
personFields='emailAddresses,photos',
personFields='emailAddresses,photos,names',
),
key='connections',
)
@ -141,7 +141,15 @@ def main():
for person in connections:
count += 1
logging.debug('Processing %s', person.get('resourceName'))
displayName = "Unknown"
if "names" in person:
displayName = person['names'][0]['displayName']
logging.info(
'Processing %s: %s',
person.get('resourceName'),
displayName,
)
primary_photo = get_primary_photo(person)
if not primary_photo:
logging.debug('No photo for person')
@ -153,11 +161,12 @@ def main():
emails = person.get('emailAddresses', [])
if emails:
all_photos.add(primary_photo)
else:
logging.debug("No email for person")
for email in emails:
email_to_photo[email['value']] = primary_photo
logging.debug('Added photos for person')
logging.debug('Added photos for email %s', email['value'])
if count % 50 == 0:
logging.info('Found {} photos for {} emails'.format(

1
requirements.txt

@ -1,3 +1,4 @@
google-api-python-client
khard
vdirsyncer
oauth2client

2
vdirsyncer-wrapper

@ -2,4 +2,4 @@
# vdirsyncer-wrapper
# Wrapper around vdirsyncer that executes it from within virtualenv using local config
./virtualenv_run/bin/vdirsyncer -c ./vdirsyncer.conf $*
./virtualenv_run/bin/vdirsyncer -vdebug -c ./vdirsyncer.conf $*
Loading…
Cancel
Save