mattd / google-photos-downloader

Downloads photos from Google Photos.
The Unlicense
18 stars 7 forks source link

added sync_start.txt to resume failed/stopped download #19

Closed lahuna closed 1 year ago

lahuna commented 1 year ago

Matt, what do you think about this change to resume a download using a sync_start.txt file? See processMediaItemsPageResponse comments for explanation.

mattd commented 1 year ago

Hi Lahuna!

Unfortunately, this PR won't work quite how you expect. It doesn't handle the case where:

  1. A job was aborted, thus creating both a sync-stop.txt and a sync-start.txt.
  2. A second job begins running, reaches the sync-stop.txt - and ends the process.

This problem is actually going to be a bit harder to work through, as there are actually a number of situations - once you start trying to fix all edge cases - where the global.STOP_AT is reached earlier than the global.START_AT.

I think what you'd actually have to do is wait to write a new STOP_AT value to disk until after the run is completed ... but then that creates edge cases of its own.

If you'd like to take another stab at it, please do! (But I also know I've let this sit for the better half of a year before responding, so I suspect you've probably moved on.)