nextcloud / integration_google

🇬 Google integration into Nextcloud
GNU Affero General Public License v3.0
102 stars 33 forks source link

Photos outside of albums are not imported #41

Closed teemue closed 1 year ago

teemue commented 3 years ago

It seems that photos have to be inside albums to be imported. If this is intended / can't be changed, it should be mentioned in Data migration-page.

jrial commented 3 years ago

Haven't done an analysis to see whether it limits to albums only, but I also noticed that from the thousands of photos in my account, going all the way back to 2010, it only picks up 415.

[EDIT] After selecting all photos in my account and adding them to a new album, it suddenly jumped to almost 3000 photos, so it appears the issue is indeed that it only imports from albums.

julien-nc commented 3 years ago

Hi, thanks for the bug report. Photos outside of albums are imported fine on my side.

Which app version are you using? Do you see related errors/warnings in nextcloud.log during the import?

carlos-moreira commented 3 years ago

@eneiluj I just looked at the source code and I found out that this function (getPhotoNumber): https://github.com/nextcloud/integration_google/blob/master/lib/Service/GooglePhotosAPIService.php#L55 Is not taking into account photos outside albums, so if there are 0 albums on your account the import photos option won't show up: https://github.com/nextcloud/integration_google/blob/master/src/components/PersonalSettings.vue#L84

The solution might be: 1) Make the function getPhotoNumber take into account photos outside albums, and that is impossible currently: https://issuetracker.google.com/issues/111716613 It would require navigate on all pages of this endpoint: https://developers.google.com/photos/library/reference/rest/v1/mediaItems/list to find out the amount of photos, and this is bad because there are people with a lot of photos (like 100.000+) 2) Add a conditional on the function getPhotoNumber that if there are no albums, make a single request to the endpoint: https://developers.google.com/photos/library/reference/rest/v1/mediaItems/list if this endpoint returns at least one page them you can conclude that there is at least one photo outside an album, so you need to create another status to allow the import photo option showing besides nbPhotos > 0, maybe (nbPhotos > 0 || atLeastOneOutside == true)

The only problem with the last solution is that you would lose the total progress bar, because you wouldn't know the total amount of photos, but that is ok, at least the functionality is working.

As a workaround for this problem, you just need to create a single album on your photo library, this is suffice to make the photo import option to show up on nextcloud.

Joshua2504 commented 3 years ago

Same issue. Why isn't this solved yet?

Literally impossible to switch to Nextcloud if you have 100.000 Photos in Google, because data export isn't an option as nextcloud will then sort files by their last modify date.

talondnb commented 2 years ago

Same problem here.

I get the following log entry:

Google API error getting album list to get photo number, no "albums" key in []

When I run a test and add some photos to an album, it appears correctly.

FYI, I have zero photos in any album (my photos are only sync'd via the google app on my phone) and the integration in nextcloud does not show any photo integration at all. When I ran the test above with a few photos, it finally appears when I go to the Data migration section in nextcloud.

talondnb commented 2 years ago

As a workaround for this problem, you just need to create a single album on your photo library, this is suffice to make the photo import option to show up on nextcloud.

Any idea how I can move all of my photos to an album? I can't find a way to select all..

Fede-26 commented 2 years ago

As a workaround for this problem, you just need to create a single album on your photo library, this is suffice to make the photo import option to show up on nextcloud.

Any idea how I can move all of my photos to an album? I can't find a way to select all..

I think you can use google takeout to download all photos and upload them directly in a folder on nextcloud.

ctml91 commented 2 years ago

Same issue here, too bad as I was hoping to use nextcloud for photo synchronization with google photos. Most of my photos aren't located in an album.

marcelklehr commented 1 year ago

Hello everyone! I've taken over maintenance of this app and will look into fixing this soon.

marcelklehr commented 1 year ago

I cannot reproduce this anymore. This has been fixed as far as I can see and reproduce with my own setup. Photos outside of albums can now be imported fine, even when there are no albums.