gmail sync #5

Closed
ghost opened this Issue Dec 20, 2012 · 17 comments

Comments

Projects
None yet
7 participants
@ghost

ghost commented Dec 20, 2012

Hi

While I love using the command line, syncing several hundred vcard files with a smartphone is not exactly the thing I want to spend my spare time with. Thus, I'd love to have it sync with gmail, so my smartphone can easily access it too.

Benedikt Müller

I was just about to open this exact thing, +1. I'd also add that the ability to populate ppl with data exported from Google Contacts would be a great way to get people using this. 2-way sync is just icing on the cake.

Owner

hnrysmth commented Dec 20, 2012

Yeah, it does sound nice indeed. It looks like Google has a Contacts API that ought to do the trick.

My only concern is their insistence on OAuth. I tried out GoogleCL, which is some Googler's CLI client for various bits and pieces of Google APIs, and it authenticated me by spawning a browser window to deal with the OAuth steps. I hope that's not the only way to handle authentication, because I bet most people would find that really jarring and unpleasant in a CLI application!

hnrysmth was assigned Dec 21, 2012

would be amazing. having contacts in git would prevent any sync disasters, of which i've had too many

bf4 commented Dec 21, 2012

A manual method you could turn into a script, would require patching vpim/lib/rfc2425:82 to read cards.each_line

  1. export your google contacts as a vcf (manually or something like http://spiegl.de/blog/nano/archives/2010/05/26/automatic_backup_of_google_contacts/ )

  2. convert to ascii format. (or do it in the code)

iconv -f utf8 -t ascii -c contacts.vcf > contacts-ascii.vcf
  1. split into individual files
require 'vpim'
cards = Vpim::Vcard.decode File.open('./contacts-ascii.vcf','r:ascii').read
cards.each {|card| File.open(card.name.fullname.gsub(/\s+/,'')+'.vcf','w') {|f| f.write(card.to_s) } }

or

cards = Vpim::Vcard.decode File.open('./contacts.vcf').read.encode('ascii','utf-8', :invalid => :replace, :undef => :replace, :fallback => Proc.new {''})
  1. git add *.vcf && git commit -m "import google contacts"

repeat and tada

hnrysmth closed this Dec 21, 2012

hnrysmth reopened this Dec 22, 2012

Owner

hnrysmth commented Dec 22, 2012

Damnit I had absolutely no intention of closing this issue, I think I must have accidentally clicked "Close & Comment".

That would be great :)

I'd like to suggest the more "unix-esque" approach and keep this out of ppl. I'd prefer a separate project (mission statement: "sync a folder of vcf files with google contacts") that can be run via cron and maybe provide a "post-save-hook" in ppl to optionally run it after changes.

There are some projects on github to read from google contacts but nothing too promissing.

There might be a way to set something up with http://gcaldaemon.sourceforge.net/
But that appears to be rather heavyweight and used to be buggy in the past . . .

Owner

hnrysmth commented Dec 23, 2012

I'd like to suggest the more "unix-esque" approach and keep this out of ppl.

I think this is a discussion that's worth having. In its current form, ppl is essentially little more than a bit of "glue" between git, vCard and the command-line. To paraphrase Clean Code, that "glue" functionality is one thing. Programs should do one thing (and do it well). There's a sentence on the front page of ppladressbook,org:

ppl does its best to be a proper UNIX-style comand line program.

At the moment, ppl at least fulfils the UNIX criteria of doing only one thing. I wouldn't say it does it particularly well yet, because it's immature there's a lot of expressiveness still missing from the provided commands. If we expand the scope to include syncing Google Contacts with *.vcf files, then not only does ppl not do its job well yet, it also no longer does just one thing.

In short, I think you might have a point.

Owner

hnrysmth commented Dec 27, 2012

I'd also add that the ability to populate ppl with data exported from Google Contacts would be a great way to get people using this. 2-way sync is just icing on the cake.

Note to self: this would still be a good process to investigate and document regardless of whether or not full-on gmail sync is too much of a scope increase for the project. Good point @jvandyke!

bf4 commented Dec 27, 2012

I think the code I posted above h2s#5 (comment) would be a valid use-case: parsing a vcf that contains multiple entries into one. Another script outside the scope of this code can handle downloading the vcf from google.

dear h2s,
I'm hoping that's ok with you but following that "unix-esque" approach I started a project with the above mentioned mission statement "sync a folder of vcf files with google contacts".
It's in very early planing stages, there is no code yet and I don't expect there to be some for some time. But I'm very open to suggestions, ideas and wishes right now. So everybody (!) feel free to drop by leave your comments (I did some early drafts in the issues section)

https://github.com/axelGschaider/nucky/

Owner

hnrysmth commented Dec 28, 2012

That is excellent news, what a great idea! An interesting little README file too!

Owner

hnrysmth commented Jan 1, 2013

I think we might be done with this issue for now. I'm going to close it and direct any future issues about this idea to this thread.

In case it isn't completely clear, the verdict from this discussion is that ppl will not be adding support for GMail sync. At least not any time soon. The reasons for this decision are as follows:

  1. I'm the only developer on this project and I want to focus my effort on building the features I need.
  2. Syncing with GMail is a bit too much of a scope increase compared to the project's original purpose.
  3. Google rivals Facebook in its willingness to do things like deprecate APIs, so I would expect this functionality to be a very painful long-term maintenance headache. One of my goals for ppl is for it to reach a semi-complete low maintenance part of its lifespan once the core functionality is down.

hnrysmth closed this Jan 1, 2013

Glad you like the idea.
Totally agree on sympathize with everything from 1 to 3.

Had a little fleshing-out-ideas session over at https://github.com/axelGschaider/nucky/
I'm still open to suggestion though ;)

FWIW this can actually be done now, see hnrysmth#47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment