diff --git a/debian/changelog b/debian/changelog index e81d8c69..d1e6858f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,7 +15,7 @@ hts-tvheadend (2.8) hts; urgency=low * More intelligent arbitration amongst all sources when a subscription is about to start for a channel. If we cannot descramble or if no input is detected, skip to next source. - Fixes ticket #89 + Fixes ticket #89 * Add option for editing channel icon URL in the channel config tab. @@ -27,11 +27,15 @@ hts-tvheadend (2.8) hts; urgency=low * Add support for extracting provider in the PMT for SECA/Mediaguard - * Add support for NIT-other tables. + * Add support for NIT-other tables. In particular useful for Ziggo DVB-C networks in the Netherlands. * Fix various bugs related to RTP encapsulated IPTV + * Tvheadend now support placement of configurations and settings at any path. + Use the '-c' command line option for this. By default Tvheadend puts + configuration at $HOME/.hts/tvheadend + hts-tvheadend (2.7) hts; urgency=low * Added support for DVB subtitles. Currently only forwarded over HTSP diff --git a/src/main.c b/src/main.c index c0a5d25c..ca431106 100644 --- a/src/main.c +++ b/src/main.c @@ -75,6 +75,28 @@ int log_debug_to_syslog; int log_debug_to_comet; int log_debug_to_console; +static char confpath[256]; + + +static void +set_confpath(void) +{ + char buf[256]; + const char *homedir = getenv("HOME"); + struct stat st; + + if(homedir != NULL) { + snprintf(buf, sizeof(buf), "%s/.hts", homedir); + if(stat(buf, &st) == 0 || mkdir(buf, 0700) == 0) { + + snprintf(buf, sizeof(buf), "%s/.hts/tvheadend", homedir); + + if(stat(buf, &st) == 0 || mkdir(buf, 0700) == 0) + snprintf(confpath, sizeof(confpath), "%s", buf); + } + } +} + static void handle_sigpipe(int x) @@ -156,6 +178,10 @@ usage(const char *argv0) printf("usage: %s [options]\n", argv0); printf("\n"); printf(" -a Use only DVB adapters specified (csv)\n"); + printf(" -c Alternate configuration path.\n" + " Defaults to [%s]\n", + *confpath ? confpath : ""); + printf(" -f Fork and daemonize\n"); printf(" -u Run as user , only works with -f\n"); printf(" -g Run as group , only works with -f\n"); @@ -235,14 +261,15 @@ main(int argc, char **argv) int logfacility = LOG_DAEMON; int createdefault = 0; sigset_t set; - const char *contentpath = TVHEADEND_CONTENT_PATH; - const char *homedir = NULL; + const char *homedir; const char *rawts_input = NULL; const char *join_transport = NULL; char *p, *endp; uint32_t adapter_mask = 0xffffffff; int crash = 0; + set_confpath(); + while((c = getopt(argc, argv, "Aa:fu:g:c:Chdr:j:s")) != -1) { switch(c) { case 'a': @@ -278,7 +305,7 @@ main(int argc, char **argv) groupnam = optarg; break; case 'c': - contentpath = optarg; + snprintf(confpath, sizeof(confpath), "%s", optarg); break; case 'd': log_debug_to_console = 1; @@ -346,7 +373,7 @@ main(int argc, char **argv) openlog("tvheadend", LOG_PID, logfacility); - hts_settings_init("tvheadend", homedir); + hts_settings_init(*confpath ? confpath : NULL); pthread_mutex_init(&ffmpeg_lock, NULL); pthread_mutex_init(&fork_lock, NULL); @@ -379,7 +406,7 @@ main(int argc, char **argv) http_server_init(); - webui_init(contentpath); + webui_init(TVHEADEND_CONTENT_PATH); serviceprobe_init(); diff --git a/src/settings.c b/src/settings.c index 0ebd7404..b781796b 100644 --- a/src/settings.c +++ b/src/settings.c @@ -43,29 +43,14 @@ hts_settings_get_root(void) return settingspath ?: "No settings dir"; } + /** * */ void -hts_settings_init(const char *programname, const char *homedir) +hts_settings_init(const char *confpath) { - char buf[256]; - struct stat st; - - if(homedir == NULL) - homedir = getenv("HOME"); - - if(homedir == NULL) - return; - - snprintf(buf, sizeof(buf), "%s/.hts", homedir); - if(stat(buf, &st) == 0 || mkdir(buf, 0700) == 0) { - - snprintf(buf, sizeof(buf), "%s/.hts/%s", homedir, programname); - - if(stat(buf, &st) == 0 || mkdir(buf, 0700) == 0) - settingspath = strdup(buf); - } + settingspath = confpath ? strdup(confpath) : NULL; } /** diff --git a/src/settings.h b/src/settings.h index bbc642a9..6be8cffe 100644 --- a/src/settings.h +++ b/src/settings.h @@ -22,7 +22,7 @@ #include "htsmsg.h" #include -void hts_settings_init(const char *programname, const char *path); +void hts_settings_init(const char *confpath); void hts_settings_save(htsmsg_t *record, const char *pathfmt, ...);