summaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <kls (at) cadsoft (dot) de>2000-11-01 18:00:00 +0100
committerKlaus Schmidinger <kls (at) cadsoft (dot) de>2000-11-01 18:00:00 +0100
commita69b3211dc4f9b34eef440067d5ba304fbfbad94 (patch)
tree7701ccce8cef832eb5ab56293a7ae99aca40b78e /config.c
parenta379eb714f7f5ef9a12efbe7588bb3509faba056 (diff)
downloadvdr-patch-lnbsharing-a69b3211dc4f9b34eef440067d5ba304fbfbad94.tar.gz
vdr-patch-lnbsharing-a69b3211dc4f9b34eef440067d5ba304fbfbad94.tar.bz2
Version 0.67vdr-0.67
- The EIT information is now gathered in a separate thread. - The sytem time can now be synchronized to the time broadcast in the DVB data stream. This can be enabled in the "Setup" menu by setting "SetSystemTime" to 1. Note that this works only if VDR is running under a user id that has permisson to set the system time. - The new item "Schedule" in the "Main" menu opens VDR's EPG (thanks to Robert Schneider). See the MANUAL file for a detailed description. - The new setup parameters MarginStart and MarginStop define how long (in minutes) before the official start time of a broadcast VDR shall begin recording, and how long after the official end time it shall stop recording. These are used when a recording is programmed from the "Schedules" menu. - The delay value in the dvb.c.071.diff patch to the driver has been increased to '3', because on some systems the OSD was not displayed correctly. If you are running an already patched version 0.71 driver and encounter problems with the OSD, please make sure the parameter in the ddelay call is '3', not '2'. - Fixed initializing the RCU remote control code (didn't work after switching on the system). - Problematic characters in recording names (which can come from timers that are programmed via the "Schedules" menu) are now replaced by suitable substitutes.
Diffstat (limited to 'config.c')
-rw-r--r--config.c100
1 files changed, 84 insertions, 16 deletions
diff --git a/config.c b/config.c
index 1714651..5b485f6 100644
--- a/config.c
+++ b/config.c
@@ -4,18 +4,15 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: config.c 1.26 2000/10/08 16:10:40 kls Exp $
+ * $Id: config.c 1.29 2000/11/01 18:22:43 kls Exp $
*/
#include "config.h"
#include <ctype.h>
#include <stdlib.h>
#include "dvbapi.h"
-#include "eit.h"
#include "interface.h"
-extern cEIT EIT;
-
// -- cKeys ------------------------------------------------------------------
tKey keyTable[] = { // "Up" and "Down" must be the first two keys!
@@ -267,15 +264,14 @@ bool cChannel::Switch(cDvbApi *DvbApi)
isyslog(LOG_INFO, "switching to channel %d", number);
CurrentChannel = number;
for (int i = 3; i--;) {
- if (DvbApi->SetChannel(frequency, polarization, diseqc, srate, vpid, apid, ca, pnr)) {
- EIT.SetProgramNumber(pnr);
+ if (DvbApi->SetChannel(frequency, polarization, diseqc, srate, vpid, apid, ca, pnr))
return true;
- }
esyslog(LOG_ERR, "retrying");
}
return false;
}
- Interface->Info(DvbApi->Recording() ? "Channel locked (recording)!" : name);
+ if (DvbApi->Recording())
+ Interface->Info("Channel locked (recording)!");
return false;
}
@@ -306,6 +302,47 @@ cTimer::cTimer(bool Instant)
snprintf(file, sizeof(file), "%s%s", Setup.MarkInstantRecord ? "@" : "", ch->name);
}
+cTimer::cTimer(const cEventInfo *EventInfo)
+{
+ startTime = stopTime = 0;
+ recording = false;
+ active = true;
+ cChannel *ch = Channels.GetByServiceID(EventInfo->GetServiceID());
+ channel = ch ? ch->number : 0;
+ time_t tstart = EventInfo->GetTime();
+ time_t tstop = tstart + EventInfo->GetDuration() + Setup.MarginStop * 60;
+ tstart -= Setup.MarginStart * 60;
+ struct tm *time = localtime(&tstart);
+ day = time->tm_mday;
+ start = time->tm_hour * 100 + time->tm_min;
+ time = localtime(&tstop);
+ stop = time->tm_hour * 100 + time->tm_min;
+ if (stop >= 2400)
+ stop -= 2400;
+ priority = 99;
+ lifetime = 99;
+ *file = 0;
+ const char *Title = EventInfo->GetTitle();
+ if (!isempty(Title))
+ strn0cpy(file, EventInfo->GetTitle(), sizeof(file));
+ summary = NULL;
+ const char *Subtitle = EventInfo->GetSubtitle();
+ if (isempty(Subtitle))
+ Subtitle = "";
+ const char *Summary = EventInfo->GetExtendedDescription();
+ if (isempty(Summary))
+ Summary = "";
+ if (*Subtitle || *Summary) {
+ asprintf(&summary, "%s%s%s", Subtitle, (*Subtitle && *Summary) ? "\n\n" : "", Summary);
+ char *p = summary;
+ while (*p) {
+ if (*p == '\n')
+ *p = '|';
+ p++;
+ }
+ }
+}
+
cTimer::~cTimer()
{
delete summary;
@@ -388,14 +425,33 @@ bool cTimer::Parse(const char *s)
char *buffer2 = NULL;
delete summary;
summary = NULL;
+ //XXX Apparently sscanf() doesn't work correctly if the last %a argument
+ //XXX results in an empty string (this firt occured when the EIT gathering
+ //XXX was put into a separate thread - don't know why this happens...
+ //XXX As a cure we copy the original string and add a blank.
+ //XXX If anybody can shed some light on why sscanf() failes here, I'd love
+ //XXX to hear about that!
+ char *s2 = NULL;
+ int l2 = strlen(s);
+ if (s[l2 - 2] == ':') { // note that 's' has a trailing '\n'
+ s2 = (char *)malloc(l2 + 2);
+ strcat(strn0cpy(s2, s, l2), " \n");
+ s = s2;
+ }
if (8 <= sscanf(s, "%d:%d:%a[^:]:%d:%d:%d:%d:%a[^:\n]:%a[^\n]", &active, &channel, &buffer1, &start, &stop, &priority, &lifetime, &buffer2, &summary)) {
+ if (summary && !*skipspace(summary)) {
+ delete summary;
+ summary = NULL;
+ }
//TODO add more plausibility checks
day = ParseDay(buffer1);
strn0cpy(file, buffer2, MaxFileName);
delete buffer1;
delete buffer2;
+ delete s2;
return day != 0;
}
+ delete s2;
return false;
}
@@ -550,6 +606,17 @@ cChannel *cChannels::GetByNumber(int Number)
return NULL;
}
+cChannel *cChannels::GetByServiceID(unsigned short ServiceId)
+{
+ cChannel *channel = (cChannel *)First();
+ while (channel) {
+ if (channel->pnr == ServiceId)
+ return channel;
+ channel = (cChannel *)channel->Next();
+ }
+ return NULL;
+}
+
bool cChannels::SwitchTo(int Number, cDvbApi *DvbApi)
{
cChannel *channel = GetByNumber(Number);
@@ -562,14 +629,6 @@ const char *cChannels::GetChannelNameByNumber(int Number)
return channel ? channel->name : NULL;
}
-eKeys cChannels::ShowChannel(int Number, bool Switched, bool Group)
-{
- cChannel *channel = Group ? Get(Number) : GetByNumber(Number);
- if (channel)
- return Interface->DisplayChannel(channel->number, channel->name, !Switched || Setup.ShowInfoOnChSwitch);
- return kNone;
-}
-
// -- cTimers ----------------------------------------------------------------
cTimers Timers;
@@ -599,6 +658,9 @@ cSetup::cSetup(void)
MarkInstantRecord = 1;
LnbFrequLo = 9750;
LnbFrequHi = 10600;
+ SetSystemTime = 0;
+ MarginStart = 2;
+ MarginStop = 10;
}
bool cSetup::Parse(char *s)
@@ -613,6 +675,9 @@ bool cSetup::Parse(char *s)
else if (!strcasecmp(Name, "MarkInstantRecord")) MarkInstantRecord = atoi(Value);
else if (!strcasecmp(Name, "LnbFrequLo")) LnbFrequLo = atoi(Value);
else if (!strcasecmp(Name, "LnbFrequHi")) LnbFrequHi = atoi(Value);
+ else if (!strcasecmp(Name, "SetSystemTime")) SetSystemTime = atoi(Value);
+ else if (!strcasecmp(Name, "MarginStart")) MarginStart = atoi(Value);
+ else if (!strcasecmp(Name, "MarginStop")) MarginStop = atoi(Value);
else
return false;
return true;
@@ -660,6 +725,9 @@ bool cSetup::Save(const char *FileName)
fprintf(f, "MarkInstantRecord = %d\n", MarkInstantRecord);
fprintf(f, "LnbFrequLo = %d\n", LnbFrequLo);
fprintf(f, "LnbFrequHi = %d\n", LnbFrequHi);
+ fprintf(f, "SetSystemTime = %d\n", SetSystemTime);
+ fprintf(f, "MarginStart = %d\n", MarginStart);
+ fprintf(f, "MarginStop = %d\n", MarginStop);
fclose(f);
isyslog(LOG_INFO, "saved setup to %s", FileName);
return true;