Blog - #plans #programming #google #photos

First Older Archive Newer Latest

Google photos download service

Tracks what photos Google has, and downloads any that we don't have copies of.

Google gives photos a unique id. If we periodically get a list of photos from google and compare it to a list of photos that we've got, we can download any new ones.

(First download is going to be lots of photos)

For each photo in Google, we need to track:
Our DB ID
Google ID
If it's been downloaded
Our file (not strictly needed, but useful to keep track of)

We can simplify by having our file a nullable foreign key, if it doesn't exist, we haven't downloaded the photo.

GooglePhoto {
public long ID;
public string GoogleID;
public virtual UploadImage? UploadImage;
public virtual User Owner;
public int DownloadAttempts =0;
}

Build a background service that:
* Polls google for a list of photos
* Adds any new ones to the DB
* Queues a download task for the new photo
* Download photo
* Add to database
* Add standard thumbnail to database
* Tracks number of retries for each photo, and gives up after a few

The background task needs the Google token for each user who wants to sync photos.


First Older Archive Newer Latest