I have the idea to create a "script" that will walk a directory tree to classify files and take actions (If it is a photo, upload to Flickr. If it is a video, move to a folder, ..).
I have no knwoledge of Go but would like to change that. The file discovery and classification don't seems to be the big part. routines and channels seems to be enough to have a non blocking system.
My main concern is more about the actions to take. I will certainly code some actions like "FlickrUpload" or "Shell" (for mv
, cp
, ..). But I would like to have a configurable system where I can attach an action to a mime type. I think an Xml structure could be nice to configure it and seems simple to parse.
<?xml version="1.0" standalone="yes">
<configuration>
<file type="image/jpg">
<action name="FlickrUpload" />
<action name="Shell">
mv ${file} /some/absolute/path/
</action>
<!-- or -->
<FlickrUpload />
</file>
</configuration>
But I have no idea on how to bind the action and his arguments (from Xml) to an action
that will be an interface
(unless you say other).
type action interface {
execute(path string) error
}