summaryrefslogtreecommitdiff
path: root/svdrp.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-02-24 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2002-02-24 18:00:00 +0100
commitfb8e7fa302ef8a73feb6958b0cb32cc54f76e677 (patch)
tree74cf9dd5cd1892aaf1c05db32796eb356d7bc860 /svdrp.c
parenta1da0e5c5de55009716e2c327dda16c61c1dae83 (diff)
downloadvdr-patch-lnbsharing-fb8e7fa302ef8a73feb6958b0cb32cc54f76e677.tar.gz
vdr-patch-lnbsharing-fb8e7fa302ef8a73feb6958b0cb32cc54f76e677.tar.bz2
Version 1.0.0pre1vdr-1.0.0pre1
- Added scanning for EPG data for another 4 days on channels that support this (thanks to Oleg Assovski). - Removed '#define VFAT 1' from recording.c (was a leftover from testing). - Fixed the "Low disk space!" message (thanks to Sergei Haller). - Added the TPID to Hessen-3 in 'channels.conf' (thanks to Sergei Haller). - Fixed a crash when replaying with DEBUG_OSD=1 (thanks to Stefan Huelswitt). - Implemented the "First day" parameter for repeating timers. See FORMATS for information about the enhanced 'timers.conf' file format, and MANUAL for a description of the new item in the "Edit Timer" menu and the enhanced functionality of the "Blue" button in the "Timers" menu. - When deleting a recording that is currently still being recorded, the related timer will now automatically be terminated. If this is a repeating timer, it will receive a "First day" setting that skips the timer for this day. - Fixed closing all unused file descriptors when opening a pipe (thanks to Werner Fink). - Instant recordings now take the EPG data from the point in time at 5 minutes from the start time of the recording. In order for this to work the 'active' parameter of a timer now uses the second bit to indicate that this is an "instant" recording (see FORMATS for details). - Fixed the SVDRP GRAB command in case the video device can't be opened (thanks to Adrian Stabiszewski). - At startup the data written into 'epg.data' is now read into the EPG data structures. In order for this to work, the 'E' record has been extended to (optionally) contain the 'table ID' (see FORMATS for details). - The new SVDRP command PUTE can be used to put EPG data into the EPG list. See FORMATS for details about the required data format. - Taking the German umlauts 'as is' when compiled with VFAT. - The new Setup parameter RecordDolbyDigital can be used to generally turn off recording the Dolby Digital audio channels in case you want to save disk space or don't have the equipment to replay Dolby Digital audio. - Reading the 'setup.conf' file no longer terminates in case of an error, but rather attempts to read the rest of the file. - Removed DVD support from the core VDR source, since the current version from Andreas Schultz is already much further developed (DVD menu navigation) and the concept of "additional players" in VDR is going to change in version 1.1.0, where a new "plugin" interface shall allow the easy implementation of new players without having to patch the core VDR source. Until then, Andreas has agreed to provide his DVD support as a completely external patch. - The contents of the distribution archive now contains the directory name with the current version number, as in 'vdr-1.0.0pre1/...' in order to avoid inadvertently overwriting an existing VDR directory with a new version. - Added a missing error message in SVDRP command LSTC in case the given channel can't be found.
Diffstat (limited to 'svdrp.c')
-rw-r--r--svdrp.c80
1 files changed, 77 insertions, 3 deletions
diff --git a/svdrp.c b/svdrp.c
index 4cdf2fb..228003e 100644
--- a/svdrp.c
+++ b/svdrp.c
@@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection.
*
- * $Id: svdrp.c 1.30 2002/02/02 15:39:46 kls Exp $
+ * $Id: svdrp.c 1.33 2002/02/24 14:16:03 kls Exp $
*/
#include "svdrp.h"
@@ -118,6 +118,52 @@ int cSocket::Accept(void)
return -1;
}
+// --- cPUTEhandler ----------------------------------------------------------
+
+cPUTEhandler::cPUTEhandler(void)
+{
+ if ((f = tmpfile()) != NULL) {
+ status = 354;
+ message = "Enter EPG data, end with \".\" on a line by itself";
+ }
+ else {
+ LOG_ERROR;
+ status = 554;
+ message = "Error while opening temporary file";
+ }
+}
+
+cPUTEhandler::~cPUTEhandler()
+{
+ if (f)
+ fclose(f);
+}
+
+bool cPUTEhandler::Process(const char *s)
+{
+ if (f) {
+ if (strcmp(s, ".") != 0) {
+ fputs(s, f);
+ fputc('\n', f);
+ return true;
+ }
+ else {
+ rewind(f);
+ if (cSchedules::Read(f)) {
+ status = 250;
+ message = "EPG data processed";
+ }
+ else {
+ status = 451;
+ message = "Error while processing EPG data";
+ }
+ fclose(f);
+ f = NULL;
+ }
+ }
+ return false;
+}
+
// --- cSVDRP ----------------------------------------------------------------
#define MAXHELPTOPIC 10
@@ -192,6 +238,11 @@ const char *HelpPages[] = {
" zero, this means that the timer is currently recording and has started\n"
" at the given time. The first value in the resulting line is the number\n"
" of the timer.",
+ "PUTE\n"
+ " Put data into the EPG list. The data entered has to strictly follow the\n"
+ " format defined in VDR/FORMATS for the 'epg.data' file. A '.' on a line\n"
+ " by itself terminates the input and starts processing of the data (all\n"
+ " entered data is buffered until the terminating '.' is seen).",
"UPDT <settings>\n"
" Updates a timer. Settings must be in the same format as returned\n"
" by the LSTT command. If a timer with the same channel, day, start\n"
@@ -209,6 +260,7 @@ const char *HelpPages[] = {
220 VDR service ready
221 VDR service closing transmission channel
250 Requested VDR action okay, completed
+ 354 Start sending EPG data
451 Requested action aborted: local error in processing
500 Syntax error, command unrecognized
501 Syntax error in parameters or arguments
@@ -252,6 +304,7 @@ const char *GetHelpPage(const char *Cmd)
cSVDRP::cSVDRP(int Port)
:socket(Port)
{
+ PUTEhandler = NULL;
numChars = 0;
message = NULL;
lastActivity = 0;
@@ -273,6 +326,7 @@ void cSVDRP::Close(bool Timeout)
Reply(221, "%s closing connection%s", buffer, Timeout ? " (timeout)" : "");
isyslog(LOG_INFO, "closing SVDRP connection"); //TODO store IP#???
file.Close();
+ DELETENULL(PUTEhandler);
}
}
@@ -583,6 +637,8 @@ void cSVDRP::CmdLSTC(const char *Option)
}
if (next)
Reply(250, "%d %s", next->number, next->ToText());
+ else
+ Reply(501, "Channel \"%s\" not defined", Option);
}
}
else if (Channels.MaxNumber() >= 1) {
@@ -600,8 +656,8 @@ void cSVDRP::CmdLSTC(const char *Option)
void cSVDRP::CmdLSTE(const char *Option)
{
- cThreadLock ThreadLock;
- const cSchedules *Schedules = cDvbApi::PrimaryDvbApi->Schedules(&ThreadLock);
+ cMutexLock MutexLock;
+ const cSchedules *Schedules = cSIProcessor::Schedules(MutexLock);
if (Schedules) {
FILE *f = fdopen(file, "w");
if (f) {
@@ -827,6 +883,15 @@ void cSVDRP::CmdNEXT(const char *Option)
Reply(550, "No active timers");
}
+void cSVDRP::CmdPUTE(const char *Option)
+{
+ delete PUTEhandler;
+ PUTEhandler = new cPUTEhandler;
+ Reply(PUTEhandler->Status(), PUTEhandler->Message());
+ if (PUTEhandler->Status() != 354)
+ DELETENULL(PUTEhandler);
+}
+
void cSVDRP::CmdUPDT(const char *Option)
{
if (*Option) {
@@ -859,6 +924,14 @@ void cSVDRP::CmdUPDT(const char *Option)
void cSVDRP::Execute(char *Cmd)
{
+ // handle PUTE data:
+ if (PUTEhandler) {
+ if (!PUTEhandler->Process(Cmd)) {
+ Reply(PUTEhandler->Status(), PUTEhandler->Message());
+ DELETENULL(PUTEhandler);
+ }
+ return;
+ }
// skip leading whitespace:
Cmd = skipspace(Cmd);
// find the end of the command word:
@@ -888,6 +961,7 @@ void cSVDRP::Execute(char *Cmd)
else if (CMD("NEWT")) CmdNEWT(s);
else if (CMD("NEXT")) CmdNEXT(s);
else if (CMD("UPDT")) CmdUPDT(s);
+ else if (CMD("PUTE")) CmdPUTE(s);
else if (CMD("QUIT")) Close();
else Reply(500, "Command unrecognized: \"%s\"", Cmd);
}