Feature #303
[patch] Multiple named DVR configurations
0%
Description
I see a common requirement to use different recording options for different types of TV programmes. For instance, I want to have movies recorded to one directory, while I want series recorded to another directory with the channel name in the file name.
Therefore I experimented a bit and finally created the attached patch to let tvheadend handle multiple DVR configurations.
At the user interface level, the patch makes the following changes:
- add an editable combobox with the configuration name in the toolbar of the DVR configuration; the existing "save" button saves the configuration under the optional name typed into the combobox; a new "Delete configuration" button deletes the selected configuration;
- add a combobox to select the DVR configuration in the the Record Program dialog box;
- add a DVR Configuration column to the Recorder Schedule grid;
- add an editable DVR Configuration column to the Automatic Recorder grid;
- the UI changes are limited and can be ignored by users not interested in the feature, in which case the default configuration is used and the system works as before.
Screenshots are attached to illustrate this.
Under the hood, it does the following:
- create a dvr_config_t data structure, store the configuration options in a list and add the necessary methods to manipulate it:
/* find config by name or return null if named config not found */ dvr_config_t *dvr_config_find_by_name(const char *name); /* find config by name and return defaut config if named config not found */ dvr_config_t *dvr_config_find_by_name_default(const char *name); /* create new named config with default options */ dvr_config_t *dvr_config_create(const char *name); /* delete named config */ void dvr_config_delete(const char *name);
- dvr_init and dvr_save initialize, load and save the corresponding configurations as dvr/config* files.
- add a config_name field in dvr_autorec_entry_t and dvr_entry_t
- pass the configuration name or dvr_config_t data structure around wherever dvr configuration options are required
Whenever a configuration is not found (for instance when it has been deleted while still being used by sheduled recordings), the system falls back to the default configuration which must always exist. A warning is logged is such cases.
I've been running tvheadend with this patch since a few days and it seems to work well.
Let me know what you think and, if you believe it's useful, how I can improve it to get it applied.
Files
History
Updated by Andreas Smas about 14 years ago
Looks good. Extra good karma for staying with the source code style :-)