perkeep / gphotos-cdp

This program uses the Chrome DevTools Protocol to drive a Chrome session that downloads your photos stored in Google Photos.
Apache License 2.0
651 stars 36 forks source link

A flag to not overwrite existing downloads (only download new photos) #21

Open karan opened 4 years ago

karan commented 4 years ago

I am finding that the method to find the oldest photo is not quite working as expected. It doesn't truly go to the oldest place (~2002) for me for some reason.

So what I'm trying is delete the .lastdone file and run the tool repeatedly, however, that causes all existing images to be downloaded again even if they exist on disk.

I can understand why that would be useful by default (sync changes to existing photos), but it would be nice to have a flag that only downloads new files and ignores the ones that exist on disk.

mpl commented 4 years ago

Hmm maybe. But in your specific use-case, doesn't the existing -start flag address your problem?

karan commented 4 years ago

-start could work but I use https://github.com/JakeWharton/docker-gphotos-sync/ which makes setting the flag at the run time not that easy (I would have to run through the download dir and find the latest one).

JakeWharton commented 4 years ago

I'm happy to add whatever functionality is needed to the container. Presumably the IDs are ordered do we only need to take the newest lexicographically?

karan commented 3 years ago

Actually, I don't think start will work. It seems that in my case some photos are sporadically missing. So if I have photos 5 4 3 2 1, the tool only seems to have downloaded 5 3 1. In that case, I can't use -start. What I need is to tell the tool to walk the entire library again, and only download the ones for which there is no existing directory.

So ideally, I'd like the flow to be:

  1. Run with --no-overwrite (or similar)
  2. Get last done (optional).*
  3. Open last done URL
  4. Navigate left
  5. Check if directory with ID exists
  6. Download item <- ONLY if the directory for it doesn't exit

Thoughts?

*In this concept, since each run is basically idempotent, the meaning of lastdone is different. So the sequence should always start from the first (or pre-set) location (--start=URL)

gc-ss commented 2 years ago

So if I have photos 5 4 3 2 1, the tool only seems to have downloaded 5 3 1

@karan can you redirect

docker container logs -f <docker-gphotos-sync-container> and find out what happened to 4 2?

nirajsanghvi commented 1 year ago

I'm hoping this request is still being considered, because it's also useful if you add older photos to your library, or save photos from a shared album into your library that predate .lastdone and want to sync everything locally without missing those additions.