From 9384e56566f56e77d577319a42929e708936e7c7 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 14 Mar 2004 18:00:00 +0100 Subject: =?UTF-8?q?Version=201.3.6=20-=20Completed=20the=20Finnish=20OSD?= =?UTF-8?q?=20texts=20(thanks=20to=20Rolf=20Ahrenberg).=20-=20Fixed=20some?= =?UTF-8?q?=20descriptor=20handling=20in=20'libsi'=20(thanks=20to=20St?= =?UTF-8?q?=C3=A9phane=20Est=C3=A9-Gracias).=20-=20Fixed=20handling=20the?= =?UTF-8?q?=20current=20menu=20item=20(thanks=20to=20Marc=20Hoppe).=20-=20?= =?UTF-8?q?Fixed=20assigning=20events=20to=20timers=20(they=20no=20longer?= =?UTF-8?q?=20get=20"stuck").=20-=20Added=20log=20entries=20whenever=20the?= =?UTF-8?q?=20running=20status=20of=20an=20event=20changes=20(currently=20?= =?UTF-8?q?=20=20only=20logging=20the=20first=2030=20channels).=20-=20Fixe?= =?UTF-8?q?d=20handling=20timers=20in=20VPS=20margin=20if=20the=20EPG=20sc?= =?UTF-8?q?an=20is=20turned=20on=20(the=20EPG=20scan=20=20=20switched=20th?= =?UTF-8?q?e=20device=20away=20from=20the=20channel,=20so=20it=20wouldn't?= =?UTF-8?q?=20see=20the=20change=20of=20=20=20the=20running=20status).=20-?= =?UTF-8?q?=20Fixed=20handling=20"itemized"=20texts=20in=20EPG=20data=20(t?= =?UTF-8?q?hanks=20to=20St=C3=A9phane=20Est=C3=A9-Gracias=20=20=20for=20po?= =?UTF-8?q?inting=20out=20this=20problem,=20and=20Marcel=20Wiesweg=20for?= =?UTF-8?q?=20improving=20'libsi').=20-=20Fixed=20handling=20VPS=20times?= =?UTF-8?q?=20at=20year=20boundaries.=20-=20Avoiding=20too=20many=20consec?= =?UTF-8?q?utive=20"ring=20buffer=20overflow"=20messages=20(which=20only?= =?UTF-8?q?=20=20=20slowed=20down=20performance=20even=20more).=20-=20Taki?= =?UTF-8?q?ng=20the=20Sid=20into=20account=20when=20detecting=20version=20?= =?UTF-8?q?changes=20in=20processing=20the=20=20=20PMT=20(thanks=20to=20St?= =?UTF-8?q?=C3=A9phane=20Est=C3=A9-Gracias=20for=20pointing=20out=20this?= =?UTF-8?q?=20problem).=20-=20Completed=20the=20Russian=20OSD=20texts=20(t?= =?UTF-8?q?hanks=20to=20Vyacheslav=20Dikonov).=20-=20Any=20newline=20chara?= =?UTF-8?q?cters=20in=20the=20'description'=20of=20EPG=20events=20are=20no?= =?UTF-8?q?w=20preserved=20=20=20to=20allow=20texts=20to=20be=20displayed?= =?UTF-8?q?=20the=20way=20the=20tv=20stations=20have=20formatted=20them.?= =?UTF-8?q?=20=20=20This=20was=20also=20necessary=20to=20better=20display?= =?UTF-8?q?=20itemized=20texts.=20-=20Fixed=20detecting=20the=20running=20?= =?UTF-8?q?status=20in=20case=20an=20empty=20EPG=20event=20is=20broadcast?= =?UTF-8?q?=20(thanks=20=20=20to=20Michael=20Pennewi=C3=9F=20for=20pointin?= =?UTF-8?q?g=20this=20out).=20-=20Improved=20performance=20when=20paging?= =?UTF-8?q?=20through=20very=20long=20menu=20lists.=20-=20Removed=20cSched?= =?UTF-8?q?ule::GetEventNumber()=20and=20cSchedule::NumEvents().=20There?= =?UTF-8?q?=20is=20now=20=20=20cSchedule::Events()=20that=20returns=20the?= =?UTF-8?q?=20list=20of=20events=20directly.=20-=20Avoiding=20occasional?= =?UTF-8?q?=20bad=20responsiveness=20to=20user=20interaction=20caused=20by?= =?UTF-8?q?=20assigning=20=20=20events=20to=20timers.=20-=20Now=20explicit?= =?UTF-8?q?ly=20turning=20on=20the=20LNB=20power=20at=20startup,=20because?= =?UTF-8?q?=20newer=20drivers=20don't=20=20=20do=20this=20any=20more=20(th?= =?UTF-8?q?anks=20to=20Oliver=20Endriss=20for=20pointing=20this=20out).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epg.c | 52 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 12 deletions(-) (limited to 'epg.c') diff --git a/epg.c b/epg.c index 88d9ee3..28d8c1d 100644 --- a/epg.c +++ b/epg.c @@ -7,7 +7,7 @@ * Original version (as used in VDR before 1.3.0) written by * Robert Schneider and Rolf Hakenes . * - * $Id: epg.c 1.13 2004/02/22 14:41:37 kls Exp kls $ + * $Id: epg.c 1.18 2004/03/13 15:01:05 kls Exp $ */ #include "epg.h" @@ -61,8 +61,11 @@ void cEvent::SetVersion(uchar Version) version = Version; } -void cEvent::SetRunningStatus(int RunningStatus) +void cEvent::SetRunningStatus(int RunningStatus, cChannel *Channel) { + if (Channel && runningStatus != RunningStatus && (RunningStatus > SI::RunningStatusNotRunning || runningStatus > SI::RunningStatusUndefined)) + if (Channel->Number() <= 30)//XXX maybe log only those that have timers??? + isyslog("channel %d (%s) event %s '%s' status %d", Channel->Number(), Channel->Name(), GetTimeString(), Title(), RunningStatus); runningStatus = RunningStatus; } @@ -105,6 +108,11 @@ bool cEvent::HasTimer(void) const return false; } +bool cEvent::IsRunning(bool OrAboutToStart) const +{ + return runningStatus >= (OrAboutToStart ? SI::RunningStatusStartsInAFewSeconds : SI::RunningStatusPausing); +} + const char *cEvent::GetDateString(void) const { static char buf[25]; @@ -146,8 +154,11 @@ void cEvent::Dump(FILE *f, const char *Prefix) const fprintf(f, "%sT %s\n", Prefix, title); if (!isempty(shortText)) fprintf(f, "%sS %s\n", Prefix, shortText); - if (!isempty(description)) + if (!isempty(description)) { + strreplace(description, '\n', '|'); fprintf(f, "%sD %s\n", Prefix, description); + strreplace(description, '|', '\n'); + } if (vps) fprintf(f, "%sV %ld\n", Prefix, vps); fprintf(f, "%se\n", Prefix); @@ -186,8 +197,10 @@ bool cEvent::Read(FILE *f, cSchedule *Schedule) case 'S': if (Event) Event->SetShortText(t); break; - case 'D': if (Event) + case 'D': if (Event) { + strreplace(t, '|', '\n'); Event->SetDescription(t); + } break; case 'V': if (Event) Event->SetVps(atoi(t)); @@ -282,11 +295,10 @@ void ReportEpgBugFixStats(bool Reset) void cEvent::FixEpgBugs(void) { - // VDR can't usefully handle newline characters in the EPG data, so let's - // always convert them to blanks (independent of the setting of EPGBugfixLevel): + // VDR can't usefully handle newline characters in the title and shortText of EPG + // data, so let's always convert them to blanks (independent of the setting of EPGBugfixLevel): strreplace(title, '\n', ' '); strreplace(shortText, '\n', ' '); - strreplace(description, '\n', ' '); // Same for control characters: strreplace(title, '\x86', ' '); strreplace(title, '\x87', ' '); @@ -462,6 +474,7 @@ void cEvent::FixEpgBugs(void) cSchedule::cSchedule(tChannelID ChannelID) { channelID = ChannelID; + hasRunning = false;; } cEvent *cSchedule::AddEvent(cEvent *Event) @@ -475,7 +488,7 @@ const cEvent *cSchedule::GetPresentEvent(bool CheckRunningStatus) const const cEvent *pe = NULL; time_t now = time(NULL); for (cEvent *p = events.First(); p; p = events.Next(p)) { - if (p->StartTime() <= now && now < p->StartTime() + p->Duration()) { + if (p->StartTime() <= now && now < p->EndTime()) { pe = p; if (!CheckRunningStatus) break; @@ -514,7 +527,7 @@ const cEvent *cSchedule::GetEventAround(time_t Time) const time_t delta = INT_MAX; for (cEvent *p = events.First(); p; p = events.Next(p)) { time_t dt = Time - p->StartTime(); - if (dt >= 0 && dt < delta && p->StartTime() + p->Duration() >= Time) { + if (dt >= 0 && dt < delta && p->EndTime() >= Time) { delta = dt; pe = p; } @@ -522,14 +535,29 @@ const cEvent *cSchedule::GetEventAround(time_t Time) const return pe; } -void cSchedule::SetRunningStatus(cEvent *Event, int RunningStatus) +void cSchedule::SetRunningStatus(cEvent *Event, int RunningStatus, cChannel *Channel) { for (cEvent *p = events.First(); p; p = events.Next(p)) { if (p == Event) - p->SetRunningStatus(RunningStatus); + p->SetRunningStatus(RunningStatus, Channel); else if (RunningStatus >= SI::RunningStatusPausing && p->RunningStatus() > SI::RunningStatusNotRunning) p->SetRunningStatus(SI::RunningStatusNotRunning); } + if (RunningStatus >= SI::RunningStatusPausing) + hasRunning = true; +} + +void cSchedule::ClrRunningStatus(cChannel *Channel) +{ + if (hasRunning) { + for (cEvent *p = events.First(); p; p = events.Next(p)) { + if (p->RunningStatus() >= SI::RunningStatusPausing) { + p->SetRunningStatus(SI::RunningStatusNotRunning, Channel); + hasRunning = false; + break; + } + } + } } void cSchedule::ResetVersions(void) @@ -555,7 +583,7 @@ void cSchedule::Cleanup(time_t Time) Event = events.Get(a); if (!Event) break; - if (!Event->HasTimer() && Event->StartTime() + Event->Duration() + Setup.EPGLinger * 60 + 3600 < Time) { // adding one hour for safety + if (!Event->HasTimer() && Event->EndTime() + Setup.EPGLinger * 60 + 3600 < Time) { // adding one hour for safety events.Del(Event); a--; } -- cgit v1.2.3