I'm thinking about replacing the current config file format, which is based on ConfigObj, by an xml file.
Reasons:
- I'm unhappy with the format for the plugins, too many [[[s, especially as we have to support more than one icon
- the config file will be created via the html interface anyway in some future
- we need to instantiate plugins with the same backend, e.g. two backends using the FSStore. That's not possible with the old configuration.
- another dependency removed
Things I'm uncertain about:
- how to de-/activate subsystem logging and level override
- plugin de-/activation, in the old config file one could just comment something in or out, now I need that active attribute, or remove it completely or wrap it into an xml comment
- same with the global nodes like <interface>
PS: This should have little to none impact to places where Coherence is called as a module and the configuration is passed as a dict.
<config> <serverport>30020</serverport> <interface active="no">eth0</interface> <controlpoint>yes</controlpoint> <web-ui>no</web-ui> <use_dbus>no</use_dbus> <plugin active="yes"> <name>Coherence Test Content</name> <backend>FSStore</backend> <content>tests/content</content> <icon> <mimetype>image/png</mimetype> <width>120</width> <height>106</height> <depth>24</depth> <url>.face</url> </icon> </plugin> <plugin active="yes"> <name>GStreamer Audio Player</name> <backend>GStreamerPlayer</backend> </plugin> <plugin active="no"> <name>Elisa</name> <backend>ElisaPlayer</backend> <host>localhost</host> </plugin> <plugin active="yes"> <name>iRadio</name> <backend>IRadioStore</backend> </plugin> <plugin active="yes"> <name>Flickr Images</name> <backend>FlickrStore</backend> <refresh>60</refresh> <proxy>yes</proxy> <icon> <mimetype>image/png</mimetype> <width>98</width> <height>26</height> <depth>24</depth> <url>flickr-icon.png</url> </icon> </plugin> <plugin active="no"> <name>Coherence MediaStore</name> <backend>MediaStore</backend> <medialocation>/data/audio/music</medialocation> <coverlocation>/data/audio/covers</coverlocation> <mediadb>/tmp/media.db</mediadb> <icon> <mimetype>image/png</mimetype> <width>120</width> <height>106</height> <depth>24</depth> <url>coherence-icon.png</url> </icon> </plugin> <plugin active="no"> <name>Elisa is watching you</name> <backend>AxisCamStore</backend> <cam> <name>Cam 1</name> <url>http://192.168.1.222:554/mpeg4/1/media.amp</url> <protocol>rtsp-rtp-udp:*:video/MP4V-ES:*</protocol> </cam> <cam> <name>Cam 2</name> <url>http://192.168.1.222:554/mpeg4/2/media.amp</url> <protocol>rtsp-rtp-udp:*:video/MP4V-ES:*</protocol> </cam> </plugin> <plugin active="no"> <name>Buzztard Media</name> <backend>BuzztardStore</backend> <host>localhost</host> <port>7654</port> </plugin> <plugin active="no"> <name>Buzztard Player</name> <backend>BuzztardPlayer</backend> <host>localhost</host> <port>7654</port> </plugin> <logging level="warning" > <logfile active="no">coherence.log</logfile> <!-- Coherence Core --> <subsystem name="coherence" level="info" active="no" /> <subsystem name="webserver" level="info" active="no" /> <!-- DBus service --> <subsystem name="dbus" level="info" active="no" /> <!-- WebUI --> <subsystem name="webui" level="info" active="no" /> <subsystem name="webui_menu_fragment" level="info" active="no" /> <subsystem name="webui_device_fragment" level="info" active="no" /> <subsystem name="webui_logging_fragment" level="info" active="no" /> <!-- SSDP/MSEARCH - discovery and notification --> <subsystem name="ssdp" level="info" active="no" /> <subsystem name="msearch" level="info" active="no" /> <!-- device class--> <subsystem name="device" level="info" active="no" /> <!-- service classes for servers and clients --> <subsystem name="service_server" level="info" active="no" /> <subsystem name="service_client" level="info" active="no" /> <!-- UPnP actions --> <subsystem name="action" level="info" active="no" /> <!-- UPnP StateVariables --> <subsystem name="variable" level="info" active="no" /> <!-- UPnP Eventing --> <subsystem name="event_server" level="info" active="no" /> <subsystem name="event_subscription_server" level="info" active="no" /> <subsystem name="event_protocol" level="info" active="no" /> <!-- UPnP Action related SOAP calls --> <subsystem name="soap" level="info" active="yes" /> <!-- UPnP A/V MediaServer --> <subsystem name="mediaserver" level="info" active="no" /> <!-- UPnP A/V MediaRenderer --> <subsystem name="mediarenderer" level="info" active="no" /> <!-- UPnP A/V ControlPoint --> <subsystem name="controlpoint" level="info" active="no" /> <!-- UPnP A/V MediaServer ConnectionManager service--> <subsystem name="connection_manager_server" level="info" active="no" /> <!-- UPnP A/V MediaServer ContentDirectory service--> <subsystem name="content_directory_server" level="info" active="no" /> <!-- client for UPnP A/V MediaServer --> <subsystem name="ms_client" level="info" active="no" /> <!-- client for UPnP A/V MediaRenderer --> <subsystem name="mr_client" level="info" active="no" /> <!-- filesystem based backend --> <subsystem name="fs_store" level="info" active="no" /> <subsystem name="fs_item" level="info" active="no" /> <!-- Elisa MediaRenderer backend --> <subsystem name="elisa_player" level="info" active="no" /> <!-- GStreamer MediaRenderer backend --> <subsystem name="gstreamer_player" level="info" active="no" /> <!-- Shoutcast Internet Radio MediaServer backend --> <subsystem name="iradio_store" level="info" active="no" /> <subsystem name="iradio_item" level="info" active="no" /> <!-- Axis Cam MediaServer backend --> <subsystem name="axis_cam_store" level="info" active="no" /> <subsystem name="axis_cam_item" level="info" active="no" /> <!-- Flickr MediaServer backend --> <subsystem name="flickr_storage" level="info" active="no" /> <!-- Buzztard Controller (MediaServer/MediaRenderer) backend --> <subsystem name="buzztard_client" level="info" active="no" /> <subsystem name="buzztard_factory" level="info" active="no" /> <subsystem name="buzztard_connection" level="info" active="no" /> <subsystem name="buzztard_item" level="info" active="no" /> <subsystem name="buzztard_store" level="info" active="no" /> <subsystem name="buzztard_player" level="info" active="no" /> </logging> </config>
Comments by Lightyear:
I really like the idea of getting away from the ConfigObj?. And the proposal is nice as it is much more readable even though I see one major drawback in the switch from the ini-syntax to xml: the comment - and with it the documentation that allows the user to understand what the settings really mean - are much less readable. But I think that could be solved by not putting the documentation into another place. So in general I would vote for the switch. But I would do some small changes to that proposal: When reading the plugins-part I got a little confused. Because there are some tags in it that are mandatory and have to be there for each plugin meanwhile there are others that are specific to that certain plugin. As both are on the same level that is confusing. I would rather change it to have a mandatory tag like "settings" that contains the plugin specific tags.
The second part of my proposal is about the logging system. I know that logging framework and the way the xml is currently designed looks pretty similar to the way this system works. But that is actually not helping the user. Thinking about the idea of a configuration file, I see it as a more or less static configuration that does not change a lot. Most of the time the user does not care about the logging at all. The whole logging framework - beside warnings and errors - are for debugging purposes only. The only purpose I see in putting the logging settings also in the configuration file is to make it easy changable for the user. That is why I would change the system, too. The purpose is pretty simple. The user can set a general loglevel for everything (also including the log configuration file) and then can set a log level per plugin (this is optional). I know that this requieres some more implementation in the backend but it is more userfriendly. For a more precise logging system I would make the environment variable overwrite anything in the configuration file.
And I would always include a version-attribute in the root tag of configurations so that configuration update can be done easily. Anyway, my proposal would look like this:
<config version=1> <serverport>30020</serverport> <interface active="no">eth0</interface> <controlpoint>yes</controlpoint> <web-ui>no</web-ui> <use_dbus>no</use_dbus> <logging> <level>warning</level> <save-to-file active="no">coherence.log</save-to-file> </logging> <plugin active="yes"> <name>Coherence Test Content</name> <backend>FSStore</backend> <settings> <content>tests/content</content> </settings> <icon> <mimetype>image/png</mimetype> <width>120</width> <height>106</height> <depth>24</depth> <url>.face</url> </icon> </plugin> <plugin active="yes"> <name>GStreamer Audio Player</name> <backend>GStreamerPlayer</backend> <loglevel>info</loglevel> <settings /> </plugin> <plugin active="no"> <name>Elisa</name> <backend>ElisaPlayer</backend> <settings> <host>localhost</host> </settings> </plugin> <plugin active="yes"> <name>iRadio</name> <backend>IRadioStore</backend> <settings /> </plugin> <plugin active="yes"> <name>Flickr Images</name> <backend>FlickrStore</backend> <loglevel>info</loglevel> <settings> <refresh>60</refresh> <proxy>yes</proxy> </settings> <icon> <mimetype>image/png</mimetype> <width>98</width> <height>26</height> <depth>24</depth> <url>flickr-icon.png</url> </icon> </plugin>
