Thanks Magnus!
I have been wanting to write something like that myself for quite some time now. Too much else to do, I guess.
About categorizing the image: this is very important, and one of the things often ignored by commons newbies. Its also a task that may take some time to do it right.
I have written CommonSense http://tools.wikimedia.de/~daniel/WikiSense/CommonSense.php for automatically suggesting categories, based on where an image is used and/or keywords from the description text. It has a mode with easy to parse output for bots... maybe you can make your thing use it?
Regards Daniel