Twitter2FF: Crowdsourcing Speed and Brains
There are two glaring problems with Twitter2FF:
- It relies on Twitter usernames to match FriendFeed nicknames in order to locate un-subscribed FF'ers
- It makes a ton of real-time API calls, which can slow performance or kill the app (if Google slaps my wrist)
So, I implemented some simple Datastore routines to cache some data. Nothing personally identifying, just information I use when rendering results (like usernames, profile photo urls, etc). Here are the class definitions:
class TwitterUser(db.Model): username = db.StringProperty(required=True) name = db.StringProperty() image_url = db.StringProperty() date = db.DateTimeProperty(auto_now_add=True)
class FFUser(db.Model): nickname = db.StringProperty(required=True) name = db.StringProperty() twitter_user = db.ReferenceProperty(TwitterUser) date = db.DateTimeProperty(auto_now_add=True)
You'll notice that I link Twitter records to FF records with a ReferenceProperty in the FFUser model. These links can occur (without the need for matching usernames) when a user is ALREADY subscribed to the same person on both services and the FF profile data provides an explicit link-back to the Twitter account. As more and more people use Twitter2FF, more information is cached in the database, and this results in a faster experience for everyone (presuming there is a reasonable amount of overlap between friend lists).
A wonderful side-effect of this process is to discover information about T-FF links, which can then benefit other Twitter2FF users. I'll give you an illustrative example:
User B: Follows dalmaer, but doesn’t know he’s on FF. When he goes to sync his contacts, the relationship is pulled from the database (thanks to User A), and he is presented with the option of subscribing to dion!
So, the more people who use Twitter2FF, the more information there is to better match Twitter and FriendFeed accounts. Still not a “perfect” sync, but a step in the right direction!