andrewjjenkins / picsync

Sync Google Photos albums to a Nixplay Seed web picture frame
Apache License 2.0
18 stars 2 forks source link

503 from nixplay #9

Closed hypokondrickard closed 1 year ago

hypokondrickard commented 1 year ago

Hi there,

Has been working like a charm, but now I keep getting:

"Error syncing album AllMyStuff: POST 503 Service Temporarily Unavailable"

My poor debugging skills have led me to this function: https://github.com/andrewjjenkins/picsync/blob/master/pkg/nixplay/photo.go#L36

So i assume the 503 is coming from Nixplay.

Any advice for me? I tried changing the name of the album to no avail.

Thanks

/Rickard

andrewjjenkins commented 1 year ago

Thanks for the heads-up Rickard, and sorry it took me a few days to look into this.

It appears something changed in the nixplay API that is causing some of the sync code to misbehave. A big problem here is that there is a bug in the album sync logic, which looks something like this:

  1. See if album "AllMyStuff" already exists
  2. If not, create album AllMyStuff
  3. Sync photos to AllMyStuff

The implementation of "1" is flawed - it considers "I had an error checking if AllMyStuff exists" to be equivalent to "AllMyStuff doesn't exist". Unfortunately, the implementation of "2" seems to still work. I am observing that means many albums named "AllMyStuff" will be created (same name, but different internal ID in the API).

I am going to fix that behavior, add a method to delete the extraneous albums, and fix the photo fetching/syncing issue you're seeing.

andrewjjenkins commented 1 year ago

Rickard, I pushed code to fix this. This is the tag of the container that has the fix:

gcr.io/picsync-build/github.com/andrewjjenkins/picsync:master-0cbf954

master-0cbf954: digest: sha256:e96cb10be53472ae032baad2b5eb89cbf17ebd49fa038807d237247965f56adf

(it is also now the new gcr.io/picsync-build/github.com/andrewjjenkins/picsync:master-latest)

If you (like me) left this running and it made a bunch of duplicate albums named AllMyStuff, you probably want to clean them all up, then re-run sync and re-associate with the frame.

Caution: this will delete all the photos in these albums on nixplay. That is probably not a problem, since they are still in your google photos, but if for some reason you manually put photos into an album on nixplay, I wanted to warn.

picsync nixplay delete album AllMyStuff --delete-multiple

After that, run the usual picsync sync.

I apologize, the bug in the logic that allowed creating duplicate albums when the API breaks created a mess. Thanks again for the report!