Categories
Posts

GPlusFS: Google+ Data as a Filesystem

With the basics of a Google+ API announced last week I started poking around. I liked that there was an option to simply sign up for an API key, allowing me to quickly try it out from the command line using cURL. The JSON formatted results were easy enough to understand.

That led to hooking up FUSE and Python to provide the ability to mount the people.get data as a filesystem. A bit more hacking and gplusfs was born. It is still basic, but has been working fine so far with my profile. This is all still read-only, since the Google+ API is read-only.

Here is what a directory listing of my profile looks like:

[sourcecode lang=”plain”]
> ls -la *
-r——– 1 root root 57 1970-01-01 00:00 aboutMe.txt
-r——– 1 root root 12 1970-01-01 00:00 displayName.txt
-r——– 1 root root 4 1970-01-01 00:00 gender.txt
-r——– 1 root root 21 1970-01-01 00:00 id.txt
-r——– 1 root root 5117 1970-01-01 00:00 image.jpg
-r——– 1 root root 11 1970-01-01 00:00 kind.txt
-r——– 1 root root 45 1970-01-01 00:00 url.txt

organizations:
total 1
dr——– 2 root root 0 1970-01-01 00:00 ./
dr——– 2 root root 0 1970-01-01 00:00 ../
-r——– 1 root root 10 1970-01-01 00:00 work.txt

urls:
total 1
dr——– 2 root root 0 1970-01-01 00:00 ./
dr——– 2 root root 0 1970-01-01 00:00 ../
-r——– 1 root root 63 1970-01-01 00:00 json.txt
-r——– 1 root root 45 1970-01-01 00:00 profile.txt
[/sourcecode]

For JSON values that are strings I used the key name for the file, with an added .txt extension. The size of the file is determined by the length of the string. It works the way you’d expect:

[sourcecode lang=”plain”]
> more displayName.txt
Joseph Scott
[/sourcecode]

For the profile image the API provides the URL of the image, gplusfs grabs a copy of the image and exposes that to the filesystem instead of the URL string.

The other special case is list values, which are exposed as directories. The JSON data provides multiple values for these, so breaking these out as separate directories with their own files seemed like the path of least surprise.

The source code is available at https://github.com/josephscott/gplusfs and configuration wise it just needs your Google+ user id and an API key. Give it a spin and let me know if you run into any issues with your profile data.

2 replies on “GPlusFS: Google+ Data as a Filesystem”

I forked your project and made it private. Then I cloned my new repo and mounted a directory under my repo. Then I just added the files to my repo and committed them.

A very simple way to back up my google data. Admittedly, it’s not a lot, but it’s a beginning. Thank you for the gplusfs idea.

Leave a Reply

Your email address will not be published. Required fields are marked *