1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

New command line option -E

This commit is contained in:
Klaus Schmidinger 2001-08-11 09:38:12 +02:00
parent cf15f276f9
commit 627916d32a
5 changed files with 46 additions and 11 deletions

View File

@ -635,3 +635,8 @@ Video Disk Recorder Revision History
was too long...).
- Made the font file generation more stable (thanks to Artur Skawina).
- Changed the default value for the "DiSEqC" setup parameter to "off".
- The new command line option '-E' can be used to define where the EPG data
shall be written to. This is especially useful if VDR runs in a system
that turns off the video disk when it is not used, and therefore needs
to write the EPG file to a ramdisk (or turn off writing it alltogether).
See 'vdr --help' for details.

22
eit.c
View File

@ -13,7 +13,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* $Id: eit.c 1.16 2001/05/26 10:58:01 kls Exp $
* $Id: eit.c 1.17 2001/08/11 09:31:54 kls Exp $
***************************************************************************/
#include "eit.h"
@ -1099,10 +1099,12 @@ bool cEIT::WriteExtEventDescriptor(unsigned short service, eit_loop_t *eitloop,
// --- cSIProcessor ----------------------------------------------------------
#define MAX_FILTERS 20
#define EPGDATAFILENAME "epg.data"
int cSIProcessor::numSIProcessors = 0;
cSchedules *cSIProcessor::schedules = NULL;
cMutex cSIProcessor::schedulesMutex;
const char *cSIProcessor::epgDataFileName = EPGDATAFILENAME;
/** */
cSIProcessor::cSIProcessor(const char *FileName)
@ -1129,6 +1131,18 @@ cSIProcessor::~cSIProcessor()
delete fileName;
}
void cSIProcessor::SetEpgDataFileName(const char *FileName)
{
epgDataFileName = NULL;
if (FileName)
epgDataFileName = strdup(DirectoryOk(FileName) ? AddDirectory(FileName, EPGDATAFILENAME) : FileName);
}
const char *cSIProcessor::GetEpgDataFileName(void)
{
return epgDataFileName ? AddDirectory(VideoDirectory, epgDataFileName) : NULL;
}
void cSIProcessor::SetStatus(bool On)
{
LOCK_THREAD;
@ -1174,16 +1188,18 @@ void cSIProcessor::Action()
schedulesMutex.Unlock();
lastCleanup = now;
}
if (now - lastDump > 600)
if (epgDataFileName && now - lastDump > 600)
{
LOCK_THREAD;
schedulesMutex.Lock();
FILE *f = fopen(AddDirectory(VideoDirectory, "epg.data"), "w");
FILE *f = fopen(GetEpgDataFileName(), "w");
if (f) {
schedules->Dump(f);
fclose(f);
}
else
LOG_ERROR;
lastDump = now;
schedulesMutex.Unlock();
}

5
eit.h
View File

@ -13,7 +13,7 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* $Id: eit.h 1.7 2001/05/25 12:56:53 kls Exp $
* $Id: eit.h 1.8 2001/08/11 09:06:17 kls Exp $
***************************************************************************/
#ifndef __EIT_H
@ -126,6 +126,7 @@ private:
static int numSIProcessors;
static cSchedules *schedules;
static cMutex schedulesMutex;
static const char *epgDataFileName;
bool masterSIProcessor;
bool useTStime;
SIP_FILTER *filters;
@ -137,6 +138,8 @@ private:
public:
cSIProcessor(const char *FileName);
~cSIProcessor();
static void SetEpgDataFileName(const char *FileName);
static const char *GetEpgDataFileName(void);
void SetStatus(bool On);
bool SetUseTSTime(bool use);
bool SetCurrentServiceID(unsigned short servid);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: tools.c 1.35 2001/08/05 12:38:06 kls Exp $
* $Id: tools.c 1.36 2001/08/11 08:52:27 kls Exp $
*/
#define _GNU_SOURCE
@ -116,7 +116,10 @@ const char *AddDirectory(const char *DirName, const char *FileName)
{
static char *buf = NULL;
delete buf;
if (*FileName != '/')
asprintf(&buf, "%s/%s", DirName && *DirName ? DirName : ".", FileName);
else
buf = strdup(FileName);
return buf;
}

18
vdr.c
View File

@ -22,7 +22,7 @@
*
* The project's page is at http://www.cadsoft.de/people/kls/vdr
*
* $Id: vdr.c 1.61 2001/08/05 16:15:51 kls Exp $
* $Id: vdr.c 1.62 2001/08/11 09:38:12 kls Exp $
*/
#include <getopt.h>
@ -84,6 +84,7 @@ int main(int argc, char *argv[])
{ "config", required_argument, NULL, 'c' },
{ "daemon", no_argument, NULL, 'd' },
{ "device", required_argument, NULL, 'D' },
{ "epgfile", required_argument, NULL, 'E' },
{ "help", no_argument, NULL, 'h' },
{ "log", required_argument, NULL, 'l' },
{ "port", required_argument, NULL, 'p' },
@ -91,12 +92,12 @@ int main(int argc, char *argv[])
{ "dvd", required_argument, NULL, 'V' },
{ "watchdog", required_argument, NULL, 'w' },
{ "terminal", required_argument, NULL, 't' },
{ 0 }
{ NULL }
};
int c;
int option_index = 0;
while ((c = getopt_long(argc, argv, "a:c:dD:hl:p:v:V:w:t:", long_options, &option_index)) != -1) {
while ((c = getopt_long(argc, argv, "a:c:dD:E:hl:p:t:v:V:w:", long_options, &option_index)) != -1) {
switch (c) {
case 'a': cDvbApi::SetAudioCommand(optarg);
break;
@ -113,27 +114,34 @@ int main(int argc, char *argv[])
fprintf(stderr, "vdr: invalid DVB device number: %s\n", optarg);
return 2;
break;
case 'E': cSIProcessor::SetEpgDataFileName(*optarg != '-' ? optarg : NULL);
break;
case 'h': printf("Usage: vdr [OPTION]\n\n" // for easier orientation, this is column 80|
" -a CMD, --audio=CMD send Dolby Digital audio to stdin of command CMD\n"
" -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"
" -d, --daemon run in daemon mode\n"
" -D NUM, --device=NUM use only the given DVB device (NUM = 0, 1, 2...)\n"
" there may be several -D options (default: all DVB\n"
" devices will be used)\n"
" -E FILE --epgfile=FILE write the EPG data into the given FILE (default is\n"
" %s); use '-E-' to disable this\n"
" if FILE is a directory, the default EPG file will be\n"
" created in that directory\n"
" -h, --help display this help and exit\n"
" -l LEVEL, --log=LEVEL set log level (default: 3)\n"
" 0 = no logging, 1 = errors only,\n"
" 2 = errors and info, 3 = errors, info and debug\n"
" -p PORT, --port=PORT use PORT for SVDRP (default: %d)\n"
" 0 turns off SVDRP\n"
" -t TTY, --terminal=TTY controlling tty\n"
" -v DIR, --video=DIR use DIR as video directory (default: %s)\n"
" -V DEV, --dvd=DEV use DEV as the DVD device (default: %s)\n"
" -w SEC, --watchdog=SEC activate the watchdog timer with a timeout of SEC\n"
" seconds (default: %d); '0' disables the watchdog\n"
" -t TTY, --terminal=TTY controlling tty\n"
"\n"
"Report bugs to <vdr-bugs@cadsoft.de>\n",
cSIProcessor::GetEpgDataFileName() ? cSIProcessor::GetEpgDataFileName() : "'-'",
DEFAULTSVDRPPORT,
VideoDirectory,
#ifdef DVDSUPPORT