mirror of https://github.com/perkeep/perkeep.git
![]() The Picasa importer was deadlocking inside the golang.org/x/oauth2 package because the Picasa code was mutating its parent's context and accidentally creating a cycle of *oauth2.reuseTokenSource values (double-acquisition of the reuseTokenSource's sync.Mutex was the deadlock) The Picasa code really just wanted to create a subcontext from the base context, where the subcontext did the oauth2 wrapping, but then picasa was storing that subcontext in the camlistore.org/pkg/importer-provided mutable "RunContext" structure's public, embedded "context.Context" field. Unfortunately, the picasa importer code had already used that *RunContext (pre-mutation) as the context.Context for the base HTTP client. This change changes the camlistore.org/pkg/importer.RunContext to not have a public embedded Context field. Instead, it only has a read-only accessor to get at the base context, similar to Go 1.7's net/http.Request.Context() field. This will prevent this class of error in the future. Fixes #698 Change-Id: I9114b64aa1bfd7ea83b36ea1ab18ed88b4a44f7e |
||
---|---|---|
.. | ||
testdata | ||
README | ||
picasa.go | ||
picasa_test.go | ||
testdata.go |
README
Picasa Importer =============== This is a working Camlistore importer for Picasa. So far it can import all photos but not their metadata. To use: 1) Retrieve an api credential from a project of you from https://console.developers.google.com/ Select/create a project, then under APIs & auth / Credentials, create a new web application client id. 2a) Start the devcam server with picasakey flag: $ devcam server -verbose -picasakey='Client ID:Client secret' 2b) Place the Client ID and the Client secret in your (low-level) server-config.json: "/importer-picasa/": { "handler": "importer-picasa", "handlerArgs": { "apiKey": "Client ID:Client secret" } }, and start your camlistore server. 3) Navigate to http://<server>/importer-picasa/start and authorize the app to manage your Photos. 4) Watch import progress on the command line (start devcam with -verbose flag). TODO ---- * The used OAuth2 scope is for managing (read & modify) photos, but this needs only read rights. Is a stricter scope available? * The album's author name is not used yet, and the album's short name is needed. * Picasa Web dumps a lot of metadata on us. Which would be usable? See https://camlistore.org/issue/391