# HG changeset patch # User Simon Farnsworth # Date 1184235307 -3600 # Node ID 1d3670e6d9b2dc0257b6ff51054e3956905d311a # Parent c0d229705add86f391b177f02c62b2016b1fe428 Make the location of channels.conf configurable. diff -r c0d229705add -r 1d3670e6d9b2 src/input/input_dvb.c --- a/src/input/input_dvb.c Thu Jul 12 11:13:01 2007 +0100 +++ b/src/input/input_dvb.c Thu Jul 12 11:15:07 2007 +0100 @@ -883,24 +883,25 @@ static channel_t *load_channels(xine_t * FILE *f; char str[BUFSIZE]; - char filename[BUFSIZE]; channel_t *channels = NULL; int num_channels = 0; int num_alloc = 0; int i; struct stat st; + xine_cfg_entry_t channels_conf; + + xine_config_lookup_entry(xine, "media.dvb.channels_conf", &channels_conf); + + f = fopen(channels_conf.str_value, "r"); - snprintf(filename, BUFSIZE, "%s/.xine/channels.conf", xine_get_homedir()); - - f = fopen(filename, "r"); if (!f) { - xprintf(xine, XINE_VERBOSITY_LOG, _("input_dvb: failed to open dvb channel file '%s': %s\n"), filename, strerror (errno)); + xprintf(xine, XINE_VERBOSITY_LOG, _("input_dvb: failed to open dvb channel file '%s': %s\n"), channels_conf.str_value, strerror (errno)); if (!f && stream) - _x_message(stream, XINE_MSG_FILE_NOT_FOUND, filename, "Please run the dvbscan utility.", NULL); + _x_message(stream, XINE_MSG_FILE_NOT_FOUND, channels_conf.str_value, "Please run the dvbscan utility.", NULL); return NULL; } if (fstat(fileno(f), &st) || !S_ISREG (st.st_mode)) { - xprintf(xine, XINE_VERBOSITY_LOG, _("input_dvb: dvb channel file '%s' is not a plain file\n"), filename); + xprintf(xine, XINE_VERBOSITY_LOG, _("input_dvb: dvb channel file '%s' is not a plain file\n"), channels_conf.str_value); fclose(f); return NULL; } @@ -3260,6 +3261,17 @@ static void *init_class (xine_t *xine, v 21, NULL, NULL); + { + static char default_channel_conf_filename[ BUFSIZE ]; + snprintf(default_channel_conf_filename, BUFSIZE, "%s/.xine/channels.conf", xine_get_homedir()); + /* Override the default channels file */ + config->register_string(config, "media.dvb.channels_conf", + default_channel_conf_filename, + _("DVB Channels config file"), + _("DVB Channels config file to use instead of the ~/.xine/channels.conf file."), + 21, NULL, NULL); + } + /* set to 0 to turn off the GUI built into this input plugin */ config->register_bool(config, "media.dvb.gui_enabled", 1,