mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
New option '-c'; config files in video directory by default
This commit is contained in:
parent
3960085761
commit
7fbf9e6c49
6
HISTORY
6
HISTORY
@ -173,3 +173,9 @@ Video Disk Recorder Revision History
|
|||||||
- Video files now have the 'group read' bit set.
|
- Video files now have the 'group read' bit set.
|
||||||
- Fixed handling errors in 'readstring()'.
|
- Fixed handling errors in 'readstring()'.
|
||||||
- Handling SIGPIPE and re-establishing handler after intercepting a signal.
|
- Handling SIGPIPE and re-establishing handler after intercepting a signal.
|
||||||
|
- The configuration files are now by default read from the video directory.
|
||||||
|
This can be changed by using the new '-c' option. Make sure you copy your
|
||||||
|
current '*.conf' files to your video directory ('/video' by default), or
|
||||||
|
use "-c ." to get the old behaviour of loading the configuration files
|
||||||
|
from the current directory.
|
||||||
|
|
||||||
|
17
INSTALL
17
INSTALL
@ -102,14 +102,15 @@ Configuration files:
|
|||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
There are three configuration files that hold information about
|
There are three configuration files that hold information about
|
||||||
channels, remote control keys and timers. These files are currrently
|
channels, remote control keys and timers. By default these files are
|
||||||
assumed to be located in the directory from which the 'vdr' program
|
assumed to be located in the video directory, but a different directory
|
||||||
was started (this will become configurable later). The configuration
|
can be used with the '-c' option.
|
||||||
files can be edited with any text editor, or will be written by the
|
|
||||||
'vdr' program if any changes are made inside the on-screen menus.
|
The configuration files can be edited with any text editor, or will be written
|
||||||
The meaning of the data entries may still vary in future releases,
|
by the 'vdr' program if any changes are made inside the on-screen menus.
|
||||||
so for the moment please look at the source code (config.c) to see
|
The meaning of the data entries may still vary in future releases, so for the
|
||||||
the meaning of the various fields.
|
moment please look at the source code (config.c) to see the meaning of the
|
||||||
|
various fields.
|
||||||
|
|
||||||
The files that come with this package contain the author's selections,
|
The files that come with this package contain the author's selections,
|
||||||
so please make sure you adapt these to your personal taste. Also make sure
|
so please make sure you adapt these to your personal taste. Also make sure
|
||||||
|
10
tools.c
10
tools.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: tools.c 1.15 2000/09/15 13:30:24 kls Exp $
|
* $Id: tools.c 1.16 2000/09/15 14:45:31 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
@ -153,6 +153,14 @@ bool isnumber(const char *s)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *AddDirectory(const char *DirName, const char *FileName)
|
||||||
|
{
|
||||||
|
static char *buf = NULL;
|
||||||
|
delete buf;
|
||||||
|
asprintf(&buf, "%s/%s", DirName && *DirName ? DirName : ".", FileName);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
#define DFCMD "df -m %s"
|
#define DFCMD "df -m %s"
|
||||||
|
|
||||||
uint FreeDiskSpaceMB(const char *Directory)
|
uint FreeDiskSpaceMB(const char *Directory)
|
||||||
|
3
tools.h
3
tools.h
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: tools.h 1.13 2000/09/09 12:53:10 kls Exp $
|
* $Id: tools.h 1.14 2000/09/15 14:23:29 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __TOOLS_H
|
#ifndef __TOOLS_H
|
||||||
@ -44,6 +44,7 @@ char *skipspace(char *s);
|
|||||||
int time_ms(void);
|
int time_ms(void);
|
||||||
void delay_ms(int ms);
|
void delay_ms(int ms);
|
||||||
bool isnumber(const char *s);
|
bool isnumber(const char *s);
|
||||||
|
const char *AddDirectory(const char *DirName, const char *FileName);
|
||||||
uint FreeDiskSpaceMB(const char *Directory);
|
uint FreeDiskSpaceMB(const char *Directory);
|
||||||
bool DirectoryOk(const char *DirName, bool LogErrors = false);
|
bool DirectoryOk(const char *DirName, bool LogErrors = false);
|
||||||
bool MakeDirs(const char *FileName, bool IsDirectory = false);
|
bool MakeDirs(const char *FileName, bool IsDirectory = false);
|
||||||
|
23
vdr.c
23
vdr.c
@ -22,7 +22,7 @@
|
|||||||
*
|
*
|
||||||
* The project's page is at http://www.cadsoft.de/people/kls/vdr
|
* The project's page is at http://www.cadsoft.de/people/kls/vdr
|
||||||
*
|
*
|
||||||
* $Id: vdr.c 1.31 2000/09/15 13:55:39 kls Exp $
|
* $Id: vdr.c 1.32 2000/09/15 15:01:08 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
@ -60,9 +60,11 @@ int main(int argc, char *argv[])
|
|||||||
#define DEFAULTSVDRPPORT 2001
|
#define DEFAULTSVDRPPORT 2001
|
||||||
|
|
||||||
int SVDRPport = DEFAULTSVDRPPORT;
|
int SVDRPport = DEFAULTSVDRPPORT;
|
||||||
|
const char *ConfigDirectory = NULL;
|
||||||
bool DaemonMode = false;
|
bool DaemonMode = false;
|
||||||
|
|
||||||
static struct option long_options[] = {
|
static struct option long_options[] = {
|
||||||
|
{ "config", required_argument, NULL, 'c' },
|
||||||
{ "daemon", no_argument, NULL, 'd' },
|
{ "daemon", no_argument, NULL, 'd' },
|
||||||
{ "help", no_argument, NULL, 'h' },
|
{ "help", no_argument, NULL, 'h' },
|
||||||
{ "log", required_argument, NULL, 'l' },
|
{ "log", required_argument, NULL, 'l' },
|
||||||
@ -73,10 +75,14 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
int c;
|
int c;
|
||||||
int option_index = 0;
|
int option_index = 0;
|
||||||
while ((c = getopt_long(argc, argv, "dhl:p:v:", long_options, &option_index)) != -1) {
|
while ((c = getopt_long(argc, argv, "c:dhl:p:v:", long_options, &option_index)) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
case 'c': ConfigDirectory = optarg;
|
||||||
|
break;
|
||||||
case 'd': DaemonMode = true; break;
|
case 'd': DaemonMode = true; break;
|
||||||
case 'h': printf("Usage: vdr [OPTION]\n\n"
|
case 'h': printf("Usage: vdr [OPTION]\n\n" // for easier orientation, this is column 80|
|
||||||
|
" -c DIR, --config=DIR read config files from DIR (default is to read them\n"
|
||||||
|
" from the video directory)\n"
|
||||||
" -h, --help display this help and exit\n"
|
" -h, --help display this help and exit\n"
|
||||||
" -d, --daemon run in daemon mode\n"
|
" -d, --daemon run in daemon mode\n"
|
||||||
" -l LEVEL, --log=LEVEL set log level (default: 3)\n"
|
" -l LEVEL, --log=LEVEL set log level (default: 3)\n"
|
||||||
@ -156,13 +162,16 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Configuration data:
|
// Configuration data:
|
||||||
|
|
||||||
Setup.Load("setup.conf");
|
if (!ConfigDirectory)
|
||||||
Channels.Load("channels.conf");
|
ConfigDirectory = VideoDirectory;
|
||||||
Timers.Load("timers.conf");
|
|
||||||
|
Setup.Load(AddDirectory(ConfigDirectory, "setup.conf"));
|
||||||
|
Channels.Load(AddDirectory(ConfigDirectory, "channels.conf"));
|
||||||
|
Timers.Load(AddDirectory(ConfigDirectory, "timers.conf"));
|
||||||
#ifdef REMOTE_LIRC
|
#ifdef REMOTE_LIRC
|
||||||
Keys.SetDummyValues();
|
Keys.SetDummyValues();
|
||||||
#else
|
#else
|
||||||
if (!Keys.Load(KEYS_CONF))
|
if (!Keys.Load(AddDirectory(ConfigDirectory, KEYS_CONF)))
|
||||||
Interface.LearnKeys();
|
Interface.LearnKeys();
|
||||||
#endif
|
#endif
|
||||||
Interface.Init();
|
Interface.Init();
|
||||||
|
Loading…
Reference in New Issue
Block a user