Freeseer/freeseer — pull request #373 by mtomwing (2013-09-14 07:52:37+00:00)
Title: Config framework refactor

This new config framework makes it easier to make persistent configuration files with Pythonic access.

```python
from freeseer import settings

profile, storage = settings.setup_profile_and_storage('default', 'freeseer.conf')
config = storage.load(settings.FreeseerConfig(), 'Global')
storage.store(config, 'Global')
```

This creates a profile @ `$HOME/.freeseer/profiles/default` and creates a default config in `freeseer.conf` with the defaults of any options defined inside the FreeseerConfig class.

```python
class FreeseerConfig(Config):
# TODO: This should probably be in a constants file somewhere
resmap = {
'default': '0x0',
'240p': '320x240',
'360p': '480x360',
'480p': '640x480',
'720p': '1280x720',
'1080p': '1920x1080'
}

videodir = options.FolderOption('/home/mtomwing/Videos', auto_create=True)
auto_hide = options.BooleanOption(True)
resolution = options.ChoiceOption(resmap.keys(), 'default')
enable_audio_recording = options.BooleanOption(True)
enable_video_recording = options.BooleanOption(True)
videomixer = options.StringOption('Video Passthrough')
audiomixer = options.StringOption('Audio Passthrough')
record_to_file = options.BooleanOption(True)
record_to_file_plugin = options.StringOption('Ogg Output')
record_to_stream = options.BooleanOption(False)
record_to_stream_plugin = options.StringOption('RTMP Streaming')
audio_feedback = options.BooleanOption(False)
video_preview = options.BooleanOption(True)
default_language = options.StringOption('tr_en_US.qm')
```

And the file it created:

```ini
[Global]
audio_feedback = false
audiomixer = Audio Passthrough
auto_hide = true
default_language = tr_en_US.qm
enable_audio_recording = true
enable_video_recording = true
record_to_file = true
record_to_file_plugin = Ogg Output
record_to_stream = false
record_to_stream_plugin = RTMP Streaming
resolution = default
video_preview = true
videodir = /home/mtomwing/Videos
videomixer = Video Passthrough
```