Dropbox API + Python to sync a folder

One of the more interesting Kickstarter projects that I saw recently is GameStow – software that would sync your saved game files to the cloud, an alternate to Steam Cloud Sync that’s not tied to Steam. I forget where I first saw it (most likely Slashdot or similar), but I fairly ignored it – I’ve been using Dropbox Folder Sync to sync my saved games, if Steam doesn’t natively support it.

I’m fairly sure I first saw on a site like Slashdot because I remember reading a comment later that went along the lines of “I don’t see anything special about this beyond the fact that it’ll automatically find your games. Sounds just like Dropbox – In fact, might even be Dropbox based, hooked into their API”.

Now, most recently I’ve been working with the dA Sta.sh API to do submissions direct from Lightroom, so when I saw that Dropbox had an API, I took a look at it. It looks interesting – I’d bet that their desktop plugin does proper deltas of files rather than uploading/downloading the entire file, and that what I was interested in, so I kinda forgot about it.

Then I found GameStow again while looking at fonts that were funded through Kickstarter. And at this time I remembered the Dropbox API, so I wondered if maybe the idea of GameStow could be built using the Dropbox API + Python.

So I thought about the structure of the program. Right now I’m using junction points to get the saved game folder into my Dropbox. So, I thought, does Python support making junction points? Answer: Seemingly, yep. Google-fu pulled up a relevant stackoverflow question, which pointed to a module that handled it, so I wouldn’t have to roll my own code.

However, I soon realised that I didn’t think things through. I don’t need to create junction points for every folder – I can specify folders in an app. Dropbox doesn’t care where the files are, just that I give it files to store, and download files from it. So, ok… no need to junction folders.

But! How do I detect changed files with Python? I’d have to monitor the folder anyway – I didn’t think about that initially, assuming that Dropbox would take care of that. But the Dropbox SDK says no, it doesn’t. Ok, back to Google. Another stackoverflow q-and-a later, and I’ve got a nice how to guide.

So, other than the GUI bits, in theory, we’ve got code that will monitor a folder and sync the contents of that folder to Dropbox. Just have to git it all together…

  1. No comments yet.
(will not be published)