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

This commit is contained in:
IamTheFij 2021-03-08 15:36:02 -05:00
parent 4af4f84147
commit 44a245bc9d
4 changed files with 16 additions and 6 deletions

View File

@ -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

View File

@ -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(

View File

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

View File

@ -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 $*