google / skicka

Command-line utility for working with Google Drive. Join the mailing list at https://groups.google.com/forum/#!forum/skicka-users.
Apache License 2.0
1.3k stars 118 forks source link

support multiple gdrive accounts #73

Closed helal00 closed 9 years ago

helal00 commented 9 years ago

-tokencache=filename any file name, even ~/.skicka.tokencache.json , is throwing the following error: skicka: error creating Google Drive client: OAuthError: CacheFile.PutToken: open : no such file or directory

-config=filename is silently ignored in favor of default config if not used with -tokencache

when used both options, the above error was thrown.

The issue is with https://code.google.com/p/goauth2 library, which is already deprecated in favor of https://godoc.org/golang.org/x/oauth2

anyway to avoid this error?

mmp commented 9 years ago

Can you try and see if it works for you if you use -tokencache filename (i.e., with a space instead of an equals sign)? I think the issue is that skicka is no longer trying to do tilde expansion on its own. (And then I think it's better to just not support the "=" syntax, rather than duplicating that functionality with the shell.)

helal00 commented 9 years ago

I tried with absolute path, without = sign as you suggested and with = sign also, same result in all cases.

helal00 commented 9 years ago

My bad!! actually this was some kind of bash scripting typo. These options are working fine. But the metafile needs to be deleted on every new gdrive account added.

Thanks

mmp commented 9 years ago

Ok, great on the options working!

Can you describe in some more detail your usage case for using multiple gdrive accounts is? The system doesn't really support that well now (as you've discovered), but if you can say more about what you're trying to do, it would likely be possible to improve it in this respect...

helal00 commented 9 years ago

Any user can easily opted to use Google's free 15 GB space multiple times. As a user can create multiple accounts with little or no restrictions, they will surely be interested using 'skicka' for multiple accounts. This is also true for me. I usually backup my laptop or desktop data to different accounts of google drive, as 15 GB is not sufficient. Those data backup is only for disaster management.

The problems I am facing right now with 'skicka' is: 1) It takes long time (~1.5hr )to sync (uploading) a long diretctory tree (~600MB). 2) ~/.skicka.metadata.cache file need to be deleted almost every time you use a new -config and -tokencache file. You have to do the oauth2 verifification for the default config files first, then for the custom config. If you do opposite, you have to delete the metadata file first to get any custom config can access the drive.

To oevercome these limitations, 'skicka' should use a different metacache file for every new custom config. There might be a option -metacachefile or so.

To decrease the syncing time the meta data cache file should be used more effectively. I didn't see the code yet, how you people did it though. But I think the first sync for a location could take time, that’s reasonable. But the subsequent syncs should only fetch the changes list after the last sync time from the Google drive (Last time I saw, there is a way in drive api to get the change list only after or before a time period). Then this list should be compared with local directory changes list and upload or download only the changes. The local and remote listing process should run simultaneously in different threads.

Any way, thanks for the efforts you people put here to make it workable. I didn't come across any such working thing yet for linux distros. TC.

mmp commented 9 years ago

Ah, yes, there actually already was a -metadata-cache-file option (but it wasn't documented :-( ). That's now fixed. If you have multiple accounts, and if you specify a separate -config, -tokencache, and -metadata-cache-file for each of them, then you should be able to seamlessly switch between accounts.

The metadata caching is implemented as you describe--it only gets the new changes, so is generally pretty fast after the first sync. You may not be seeing this behavior if you're trying to use the same file over multiple accounts (or for that matter, are removing it each time you switch accounts.) Let me know if you see better behavior on that front once you switch to using -metadata-cache-file to specify different caches for each account...

helal00 commented 9 years ago

ah yeah, now the behaviour improves a lot. And the subsequent syncing is also pretty quick. Keep up the good work.

mmp commented 9 years ago

Ok, great! Closing this out.