Implemented handling the VPS timestamps

This commit is contained in:
Klaus Schmidinger 2004-02-22 13:33:20 +01:00
parent 45eac6d946
commit 8e61663652
7 changed files with 62 additions and 9 deletions

View File

@ -2692,3 +2692,7 @@ Video Disk Recorder Revision History
- Implemented an "EPG linger time", which can be set to have older EPG information
still displayed in the "Schedule" menu (thanks to Jaakko Hyvätti).
- Added PDCDescriptor handling to 'libsi'.
- Implemented handling the VPS timestamps (aka "Programme Identification Label")
in preparation for full VPS support for timers (provided the tv stations
actually broadcast this information). Currently these are just displayed in
the event page if they exist and are different than the event's start time.

17
eit.c
View File

@ -8,7 +8,7 @@
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
* Adapted to 'libsi' for VDR 1.3.0 by Marcel Wiesweg <marcel.wiesweg@gmx.de>.
*
* $Id: eit.c 1.88 2004/02/21 13:26:52 kls Exp $
* $Id: eit.c 1.89 2004/02/22 13:17:52 kls Exp $
*/
#include "eit.h"
@ -124,6 +124,21 @@ cEIT::cEIT(cSchedules *Schedules, int Source, u_char Tid, const u_char *Data)
break;
case SI::ParentalRatingDescriptorTag:
break;
case SI::PDCDescriptorTag: {
SI::PDCDescriptor *pd = (SI::PDCDescriptor *)d;
time_t now = time(NULL);
struct tm tm_r;
struct tm t = *localtime_r(&now, &tm_r); // this initializes the time zone in 't'
t.tm_isdst = -1; // makes sure mktime() will determine the correct DST setting
t.tm_mon = pd->getMonth() - 1;
t.tm_mday = pd->getDay();
t.tm_hour = pd->getHour();
t.tm_min = pd->getMinute();
t.tm_sec = 0;
time_t vps = mktime(&t);
pEvent->SetVps(vps);
}
break;
case SI::TimeShiftedEventDescriptorTag: {
SI::TimeShiftedEventDescriptor *tsed = (SI::TimeShiftedEventDescriptor *)d;
cSchedule *rSchedule = (cSchedule *)Schedules->GetSchedule(tChannelID(Source, 0, 0, tsed->getReferenceServiceId()));

21
epg.c
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
* $Id: epg.c 1.10 2004/02/21 15:15:47 kls Exp $
* $Id: epg.c 1.11 2004/02/22 13:18:01 kls Exp $
*/
#include "epg.h"
@ -29,6 +29,7 @@ cEvent::cEvent(tChannelID ChannelID, u_int16_t EventID)
description = NULL;
startTime = 0;
duration = 0;
vps = 0;
}
cEvent::~cEvent()
@ -89,6 +90,11 @@ void cEvent::SetDuration(int Duration)
duration = Duration;
}
void cEvent::SetVps(time_t Vps)
{
vps = Vps;
}
const char *cEvent::GetDateString(void) const
{
static char buf[25];
@ -114,6 +120,14 @@ const char *cEvent::GetEndTimeString(void) const
return buf;
}
const char *cEvent::GetVpsString(void) const
{
static char buf[25];
struct tm tm_r;
strftime(buf, sizeof(buf), "%d.%m %R", localtime_r(&vps, &tm_r));
return buf;
}
void cEvent::Dump(FILE *f, const char *Prefix) const
{
if (startTime + duration >= time(NULL)) {
@ -124,6 +138,8 @@ void cEvent::Dump(FILE *f, const char *Prefix) const
fprintf(f, "%sS %s\n", Prefix, shortText);
if (!isempty(description))
fprintf(f, "%sD %s\n", Prefix, description);
if (vps)
fprintf(f, "%sV %ld\n", Prefix, vps);
fprintf(f, "%se\n", Prefix);
}
}
@ -163,6 +179,9 @@ bool cEvent::Read(FILE *f, cSchedule *Schedule)
case 'D': if (Event)
Event->SetDescription(t);
break;
case 'V': if (Event)
Event->SetVps(atoi(t));
break;
case 'e': Event = NULL;
break;
case 'c': // to keep things simple we react on 'c' here

6
epg.h
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
* $Id: epg.h 1.7 2004/02/21 13:46:18 kls Exp $
* $Id: epg.h 1.8 2004/02/22 13:18:14 kls Exp $
*/
#ifndef __EPG_H
@ -33,6 +33,7 @@ private:
char *description; // Description of this event
time_t startTime; // Start time of this event
int duration; // Duration of this event in seconds
time_t vps; // Video Programming Service timestamp (VPS, aka "Programme Identification Label", PIL)
public:
cEvent(tChannelID ChannelID, u_int16_t EventID);
~cEvent();
@ -47,9 +48,11 @@ public:
const char *Description(void) const { return description; }
time_t StartTime(void) const { return startTime; }
int Duration(void) const { return duration; }
time_t Vps(void) const { return vps; }
const char *GetDateString(void) const;
const char *GetTimeString(void) const;
const char *GetEndTimeString(void) const;
const char *GetVpsString(void) const;
void SetEventID(u_int16_t EventID);
void SetTableID(uchar TableID);
void SetVersion(uchar Version);
@ -59,6 +62,7 @@ public:
void SetDescription(const char *Description);
void SetStartTime(time_t StartTime);
void SetDuration(int Duration);
void SetVps(time_t Vps);
void Dump(FILE *f, const char *Prefix = "") const;
static bool Read(FILE *f, cSchedule *Schedule);
void FixEpgBugs(void);

View File

@ -12,7 +12,7 @@
# See the main source file 'vdr.c' for copyright information and
# how to reach the author.
#
# $Id: epg2html.pl 1.4 2002/05/30 09:46:46 kls Exp $
# $Id: epg2html.pl 1.5 2004/02/22 13:18:27 kls Exp $
@Index = ();
@ -47,13 +47,14 @@ while (<>) {
while (<>) {
if (/^E (.*?) (.*?) ([^ ]*)/) {
(my $Time, $Duration) = ($2, $3);
my $Title = "", $Subtitle = "", $Description = "";
my $Title = "", $Subtitle = "", $Description = "", $Vps = 0;
while (<>) {
if (/^T (.*)/) { $Title = Tags($1); }
elsif (/^S (.*)/) { $Subtitle = Tags($1); }
elsif (/^D (.*)/) { $Description = Tags($1); }
elsif (/^V (.*)/) { $Vps = $1; }
elsif (/^e/) {
$Events{$Time} = [($Duration, $Title, $Subtitle, $Description)];
$Events{$Time} = [($Duration, $Title, $Subtitle, $Description, $Vps)];
last;
}
}
@ -62,7 +63,7 @@ while (<>) {
my @Schedule = ();
my $Day = "";
for $t (sort keys %Events) {
(my $Duration, $Title, $Subtitle, $Description) = @{$Events{$t}};
(my $Duration, $Title, $Subtitle, $Description, $Vps) = @{$Events{$t}};
my $d = GetDay($t);
if ($d ne $Day) {
push(@Schedule, "</table>\n") if ($Day && @Schedule);
@ -73,6 +74,7 @@ while (<>) {
my $Entry = $Title;
$Entry .= "<br><i>$Subtitle</i>" if $Subtitle;
$Entry .= "<br>$Description" if $Description;
$Entry .= "<br>(VPS = " . scalar localtime($Vps) . ")" if $Vps && $Vps != $t;
push(@Schedule, "<tr><td valign=top>" . GetTime($t) . "</td><td>$Entry</td></tr>\n");
}
push(@Schedule, "</table>\n") if (@Schedule);

9
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: menu.c 1.289 2004/02/21 15:40:35 kls Exp $
* $Id: menu.c 1.290 2004/02/22 13:32:07 kls Exp $
*/
#include "menu.h"
@ -1168,6 +1168,13 @@ cMenuEvent::cMenuEvent(const cEvent *Event, bool CanSwitch)
Add(item = new cMenuTextItem(Subtitle, 1, Line, Setup.OSDwidth - 2, -1, clrYellow));
Line += item->Height() + 1;
}
if (Event->Vps() && Event->Vps() != Event->StartTime()) {
char *buffer;
asprintf(&buffer, "VPS: %s", Event->GetVpsString());
Add(item = new cMenuTextItem(buffer, 1, Line, Setup.OSDwidth - 2, -1, clrYellow));
free(buffer);
Line += item->Height() + 1;
}
if (!isempty(ExtendedDescription))
Add(new cMenuTextItem(ExtendedDescription, 1, Line, Setup.OSDwidth - 2, Height() - Line - 2, clrCyan), true);
SetHelp(tr("Record"), NULL, NULL, CanSwitch ? tr("Switch") : NULL);

4
vdr.5
View File

@ -8,7 +8,7 @@
.\" License as specified in the file COPYING that comes with the
.\" vdr distribution.
.\"
.\" $Id: vdr.5 1.24 2004/02/13 14:55:09 kls Exp $
.\" $Id: vdr.5 1.25 2004/02/22 13:18:48 kls Exp $
.\"
.TH vdr 5 "1 Jun 2003" "1.2.0" "Video Disk Recorder Files"
.SH NAME
@ -561,6 +561,7 @@ l l.
\fBT\fR@<title>
\fBS\fR@<short text>
\fBD\fR@<description>
\fBV\fR@<vps time>
\fBe\fR@
\fBc\fR@
.TE
@ -583,6 +584,7 @@ l l.
<title> @is the title of the event
<short text> @is the short text of the event (typically the name of the episode etc.)
<description> @is the description of the event (any '|' characters will be interpreted as newlines)
<vps time> @is the Video Programming Service time of this event
.TE
This file will be read at program startup in order to restore the results of