Initial Commit
[Projects.git] / sinks / run
blobdc6e442183f67e391c5ad8fb61a8da9fee66dc69
1 #!/usr/bin/env python
3 import ConfigParser
4 import sink
5 import os
7 def stupidConfig(config):
8 a={}
9 for atts in config: a.update({atts[0]:atts[1]})
10 return a
11 def getSinks(file):
12 s=[]
13 config = ConfigParser.ConfigParser()
14 config.read([file])
15 for section in config.sections():
16 module = __import__('sinks.%s'%section.lower(),globals(),locals(),section.lower())
17 s.append(getattr(module, 'sink')(stupidConfig(config.items(section))))
18 return s
19 def run():
20 files=[]
21 print "initializing..."
22 if os.path.isdir('config'):
23 for file in os.listdir('config'):
24 files.append(getSinks(os.path.join('config',file)))
25 sink.init(files)
26 print "done initializing..."
28 #sink.loop(files)
30 run()