* 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
This commit is contained in:
Andreas Öman 2010-01-25 19:20:14 +00:00
parent a4ca57203d
commit b7486aaca0
4 changed files with 42 additions and 26 deletions

8
debian/changelog vendored
View file

@ -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

View file

@ -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 <adapters> Use only DVB adapters specified (csv)\n");
printf(" -c <directory> Alternate configuration path.\n"
" Defaults to [%s]\n",
*confpath ? confpath : "<unset>");
printf(" -f Fork and daemonize\n");
printf(" -u <username> Run as user <username>, only works with -f\n");
printf(" -g <groupname> Run as group <groupname>, 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();

View file

@ -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;
}
/**

View file

@ -22,7 +22,7 @@
#include "htsmsg.h"
#include <stdarg.h>
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, ...);