Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rclone Google Photos cannot sync the data before 2000 #3630

Closed
ghost opened this issue Oct 16, 2019 · 16 comments
Closed

rclone Google Photos cannot sync the data before 2000 #3630

ghost opened this issue Oct 16, 2019 · 16 comments

Comments

@ghost
Copy link

ghost commented Oct 16, 2019

Output of rclone version

rclone v1.49.5

Describe the issue

rclone Google Photos cannot sync the data before 2000,but gphotos-sync(https://pypi.org/project/gphotos-sync/) can do this.

@ncw
Copy link
Member

ncw commented Oct 16, 2019

You should be able to read the media in media/all and in album.

It is quite expensive finding the oldest file in the photos album so rclone hard codes the 2000 value.

This could be a parameter? What do you think?

And the reply on the forum was:

I synced only media/all and album.
I don't know where to look for photos data before 2000(year).

@ncw
Copy link
Member

ncw commented Oct 16, 2019

media/all should get you all the photos regardless of age.

This could be made configurable

for year := 2000; year <= currentYear; year++ {

@ghost
Copy link
Author

ghost commented Oct 16, 2019

i think made it configurable maybe better… thanks

@ncw
Copy link
Member

ncw commented Oct 17, 2019

Do you want to try doing this? I can talk you through it.

@ghost
Copy link
Author

ghost commented Oct 17, 2019

Yes!Please tell me the test method.

@sakshamkhanna
Copy link
Contributor

It doesn't feel right, having this in a config param.
While setting up a connection, the user shouldn't be expected to know the timestamp of the oldest photo in the library.

One way to do it could be in the googlephotos.init().
Right after registering the regInfo, make a bunch of api calls to GET media with DateFilter.Range param used like a binary search between 1800(??) and time.Now() to narrow down to the year in which the first media item appears

This seems a bit hacky, which leads to an idea for a new feature.
A callback function that gets triggered everytime a remote is added/authenticated/refreshed to enable unique workflows like this.

Any thoughts?

@ncw
Copy link
Member

ncw commented Oct 18, 2019

It doesn't feel right, having this in a config param.

It isn't ideal!

While setting up a connection, the user shouldn't be expected to know the timestamp of the oldest photo in the library.

One way to do it could be in the googlephotos.init().
Right after registering the regInfo, make a bunch of api calls to GET media with DateFilter.Range param used like a binary search between 1800(??) and time.Now() to narrow down to the year in which the first media item appears

Binary search is a nice idea :-)

It will take about 8 queries to do this at 1-2 second each so a noticeable amount of time.

This seems a bit hacky, which leads to an idea for a new feature.
A callback function that gets triggered everytime a remote is added/authenticated/refreshed to enable unique workflows like this.

There is one already. So this could run to update the value stored in the config file.

@ncw
Copy link
Member

ncw commented Oct 18, 2019

@YNZone wrote:

Yes!Please tell me the test method.

First step create a new option here, called start_year type int, default 2000, Advanced: true

Add it to the options struct

type Options struct {

Next step use that option here

func years(ctx context.Context, f lister, prefix string, match []string) (entries fs.DirEntries, err error) {

You'll need to make years a method on Fs so it can read f.opt.StartYear

@ghost
Copy link
Author

ghost commented Oct 19, 2019

Sorry, this is a bit difficult. I think it would be better to wait for the 1.51 version.

@sakshamkhanna
Copy link
Contributor

There is one already. So this could run to update the value stored in the config file.

@ncw could point me to where the callback function is configured. I cant seem to find it

@ncw
Copy link
Member

ncw commented Oct 22, 2019

This is the config callback

Config: func(name string, m configmap.Mapper) {

@darkLord19
Copy link

@ncw
Hi I just came across this project and I am interested in contributing to the project and I find this issue a good start to get in.

You'll need to make years a method on Fs so it can read f.opt.StartYear

When you say make years a method on Fs, do you mean to make years a method of interface Fs defined here?

rclone/fs/fs.go

Line 254 in ab89539

type Fs interface {

@ncw
Copy link
Member

ncw commented Oct 27, 2019

When you say make years a method on Fs, do you mean to make years a method of interface Fs defined here?

rclone/fs/fs.go

Line 254 in ab89539

type Fs interface {

The function years needs to be a method on the type Fs defined in the backend

so become

 func (f *Fs) years(ctx context.Context, f lister, prefix string, match []string) (entries fs.DirEntries, err error) { 

Then instead of using the constant 2000 you can use f.opt.StartYear

for year := 2000; year <= currentYear; year++ {

@ncw ncw modified the milestones: v1.51, v1.52 Feb 1, 2020
@ghost
Copy link

ghost commented Apr 2, 2020

I'd like to tackle this one if no one has yet.

@ncw
Copy link
Member

ncw commented Apr 2, 2020

@dooven wrote:

I'd like to tackle this one if no one has yet.

That would be great - thank you :-)

@ncw
Copy link
Member

ncw commented Apr 15, 2020

Thanks to @dooven this is fixed!

I've merged this to master now which means it will be in the latest beta in 15-30 mins and released in v1.52

dbramwell pushed a commit to dbramwell/rclone that referenced this issue May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants