Reduce headphones module-level variables and reduce usage of globals, refactor processing of config from web form.

This should make maintenance of the config a bit easier. Plus, removing globals is always positive. I haven't tested on python 2.6. :(