Archive for April 21st, 2012

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 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…

No Comments

Vote powered kickbanning – a supybot plugin

So… I’m an IRC operator on a fairly well traffic-ed channel (#twokinds on Nightstar, if you care – we’ve been averaging 55 people or so fairly consistently lately), and one of the things which I have to deal with is general malignants, which is generally done by kicking and banning them.

Now, I’m not the only op around, but there have been periods where all the ops disappear, and a few days ago there was an attack that happened to coincide with one of those periods.

I know this because a) people told me when I returned from being AFK, but also because b) I’ve got a supybot living in the channel providing a bunch of services to the channel. Now, because that bot is authenticated as me to NickServ, it also gets op privileges. So, it seemed time had come for me to implement one of the ideas which I’ve had – vote powered kickbanning, where trusted users can vote to kick and ban a miscreant.

So that covered steps 1-3 of my dev process. Next step was planning it out. And I really do use paper to plan:

Conceptualizing the flow of a plugin

Step 5 involved digging into the guts of existing supybot plugins – I’ll be pulling stuff from the Channel plugins to write it, so that was a starting point. The code is fairly convoluted, and I still don’t understand all of it, but I think I’ve got enough for the basics of the plugin to work.

Now it’s just to actually write the blasted thing, and get it working. 😛

, ,

No Comments