From 396d0ad36712d8c07d91b36283a14838900ca5a2 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 9 Apr 2006 18:00:00 +0200 Subject: =?UTF-8?q?Version=201.3.46=20-=20Fixed=20handling=20broken=20PMT?= =?UTF-8?q?=20records=20(thanks=20to=20Marcel=20Wiesweg=20for=20pointing?= =?UTF-8?q?=20out=20how=20=20=20to=20detect=20these).=20-=20Added=20a=20mi?= =?UTF-8?q?ssing=20"Button$"=20for=20the=20Timer=20button=20and=20"Key$"?= =?UTF-8?q?=20in=20skinclassic.c=20=20=20(thanks=20to=20Rolf=20Ahrenberg).?= =?UTF-8?q?=20-=20Fixed=20broken=20entry=20'A111.1W'=20in=20sources.conf?= =?UTF-8?q?=20(reported=20by=20Luca=20Olivetti).=20-=20Replaced=20the=20ob?= =?UTF-8?q?solete=20entry=20'S21.5E'=20in=20the=20default=20'diseqc.conf'?= =?UTF-8?q?=20with=20'S13.0E'=20=20=20(reported=20by=20Ville=20Skytt=C3=A4?= =?UTF-8?q?).=20-=20Fixed=20learning=20keys=20when=20VDR=20is=20already=20?= =?UTF-8?q?running=20(thanks=20to=20Jurij=20Retzlaff).=20-=20Fixed=20handl?= =?UTF-8?q?ing=20the=20system=20time=20transponder=20setting=20in=20the=20?= =?UTF-8?q?Setup/EPG=20menu,=20which=20=20=20was=20broken=20by=20the=20min?= =?UTF-8?q?/max=20fix=20in=20cMenuEditIntItem.=20-=20VPS=20timers=20now=20?= =?UTF-8?q?record=20only=20events=20that=20have=20exactly=20the=20given=20?= =?UTF-8?q?start=20time.=20=20=20This=20fix=20also=20implements=20recordin?= =?UTF-8?q?g=20several=20subsequent=20events=20that=20have=20the=20=20=20s?= =?UTF-8?q?ame=20VPS=20time=20(like=20a=20sports=20event=20with=20intermit?= =?UTF-8?q?tent=20news=20breaks).=20-=20When=20checking=20for=20timers=20t?= =?UTF-8?q?hat=20have=20entered=20the=20"VPS=20margin",=20any=20free=20dev?= =?UTF-8?q?ices=20are=20=20=20now=20used=20to=20switch=20to=20the=20needed?= =?UTF-8?q?=20transponder.=20This=20improves=20cases=20where=20more=20than?= =?UTF-8?q?=20=20=20one=20VPS=20timer=20is=20about=20to=20start.=20-=20Fix?= =?UTF-8?q?ed=20handling=20the=20VPS=20margin=20in=20case=20the=20event's?= =?UTF-8?q?=20duration=20is=20shorter=20than=20the=20=20=20margin.=20-=20F?= =?UTF-8?q?ixed=20handling=20VPS=20timers=20in=20case=20the=20primary=20de?= =?UTF-8?q?vice=20needs=20to=20switch=20to=20the=20=20=20timer's=20transpo?= =?UTF-8?q?nder.=20-=20Now=20avoiding=20the=20'actual'=20device=20when=20s?= =?UTF-8?q?tarting=20a=20recording,=20so=20that=20a=20Transfer=20=20=20Mod?= =?UTF-8?q?e=20for=20live=20tv=20isn't=20interrupted.=20-=20Fixed=20a=20ty?= =?UTF-8?q?po=20in=20skins.h=20(thanks=20to=20Alexander=20Rieger).=20-=20c?= =?UTF-8?q?Skins::QueueMessage()=20called=20from=20a=20background=20thread?= =?UTF-8?q?=20with=20an=20empty=20message=20=20=20now=20clears=20all=20mes?= =?UTF-8?q?sages=20that=20have=20been=20previously=20queued=20by=20that=20?= =?UTF-8?q?thread=20and=20have=20=20=20not=20yet=20beed=20displayed=20(tha?= =?UTF-8?q?nks=20to=20Alexander=20Rieger).=20-=20Fixed=20handling=20the=20?= =?UTF-8?q?color=20button=20texts=20when=20switching=20from=20the=20'Sched?= =?UTF-8?q?ule'=20menu=20of=20=20=20a=20channel=20without=20EPG=20info=20t?= =?UTF-8?q?o=20the=20'What's=20on=20now'=20menu=20(reported=20by=20Rolf=20?= =?UTF-8?q?=20=20Ahrenberg).=20-=20cMenuEditIntItem=20and=20cMenuEditChanI?= =?UTF-8?q?tem=20can=20now=20be=20given=20strings=20to=20label=20the=20=20?= =?UTF-8?q?=20minimum=20and=20maximum=20values,=20and=20the=20case=20that?= =?UTF-8?q?=20no=20channel=20has=20been=20selected,=20=20=20respectively.?= =?UTF-8?q?=20-=20The=20initial=20channel=20and=20volume=20can=20now=20be?= =?UTF-8?q?=20defined=20in=20the=20"Setup/Miscellaneous"=20=20=20menu=20(b?= =?UTF-8?q?ased=20on=20a=20patch=20from=20Thomas=20Keil).=20-=20When=20hit?= =?UTF-8?q?ting=20the=20end=20of=20a=20recording=20in=20fast=20forward=20m?= =?UTF-8?q?ode,=20VDR=20no=20longer=20switches=20=20=20back=20to=20normal?= =?UTF-8?q?=20speed=20if=20the=20recording=20is=20already=20finished=20(th?= =?UTF-8?q?anks=20to=20Reinhard=20=20=20Nissl).=20-=20No=20longer=20callin?= =?UTF-8?q?g=20cPlugin::ProcessArgs()=20if=20VDR=20is=20run=20with=20the?= =?UTF-8?q?=20--help=20or=20=20=20--version=20option,=20to=20avoid=20error?= =?UTF-8?q?=20messages=20from=20plugins=20(reported=20by=20Udo=20Richter).?= =?UTF-8?q?=20-=20Now=20checking=20whether=20there=20is=20any=20text=20bef?= =?UTF-8?q?ore=20calling=20cStatus::MsgOsdTextItem()=20=20=20(reported=20b?= =?UTF-8?q?y=20Joachim=20Wilke).?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- timers.c | 80 ++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 40 insertions(+), 40 deletions(-) (limited to 'timers.c') diff --git a/timers.c b/timers.c index 0e764d3..f620735 100644 --- a/timers.c +++ b/timers.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: timers.c 1.55 2006/03/26 14:08:57 kls Exp $ + * $Id: timers.c 1.57 2006/04/09 09:10:08 kls Exp $ */ #include "timers.h" @@ -330,7 +330,7 @@ char *cTimer::SetFile(const char *File) return file; } -bool cTimer::Matches(time_t t, bool Directly) const +bool cTimer::Matches(time_t t, bool Directly, int Margin) const { startTime = stopTime = 0; if (t == 0) @@ -370,7 +370,7 @@ bool cTimer::Matches(time_t t, bool Directly) const stopTime = event->EndTime(); return event->IsRunning(true); } - return startTime <= t && t < stopTime; // must stop *before* stopTime to allow adjacent timers + return startTime <= t + Margin && t < stopTime; // must stop *before* stopTime to allow adjacent timers } return false; } @@ -401,7 +401,9 @@ int cTimer::Matches(const cEvent *Event, int *Overlap) const startTime = stopTime = 0; if (Overlap) *Overlap = overlap; - return overlap >= 1000 ? tmFull : overlap > 0 ? tmPartial : tmNone; + if (UseVps) + return overlap > FULLMATCH ? tmFull : tmNone; + return overlap >= FULLMATCH ? tmFull : overlap > 0 ? tmPartial : tmNone; } return tmNone; } @@ -435,8 +437,6 @@ time_t cTimer::StopTime(void) const #define EPGLIMITBEFORE (1 * 3600) // Time in seconds before a timer's start time and #define EPGLIMITAFTER (1 * 3600) // after its stop time within which EPG events will be taken into consideration. -#define VPSLIMITBEFORE (2 * 3600) // Same for VPS timers, which need to -#define VPSLIMITAFTER (24 * 3600) // look further into the future to catch shifted broadcasts. void cTimer::SetEventFromSchedule(const cSchedules *Schedules) { @@ -447,51 +447,51 @@ void cTimer::SetEventFromSchedule(const cSchedules *Schedules) return; } const cSchedule *Schedule = Schedules->GetSchedule(Channel()); - if (Schedule) { + if (Schedule && Schedule->Events()->First()) { time_t now = time(NULL); if (!lastSetEvent || Schedule->Modified() >= lastSetEvent) { + lastSetEvent = now; const cEvent *Event = NULL; - int Overlap = 0; - int Distance = INT_MIN; - bool UseVps = HasFlags(tfVps); - const cEvent *PresentEvent = UseVps ? Schedule->GetPresentEvent() : NULL; - const cEvent *FollowingEvent = UseVps ? Schedule->GetFollowingEvent() : NULL; - // Set up the time frame within which to check events: - Matches(0, true); - time_t TimeFrameBegin = StartTime() - (UseVps ? VPSLIMITBEFORE : EPGLIMITBEFORE); - time_t TimeFrameEnd = StopTime() + (UseVps ? VPSLIMITAFTER : EPGLIMITAFTER); - for (const cEvent *e = Schedule->Events()->First(); e; e = Schedule->Events()->Next(e)) { - if (!UseVps || e != event && e != PresentEvent && e != FollowingEvent) { // always check these if this is a VPS timer + if (HasFlags(tfVps) && Schedule->Events()->First()->Vps()) { + if (event && Recording()) + return; // let the recording end first + // VPS timers only match if their start time exactly matches the event's VPS time: + for (const cEvent *e = Schedule->Events()->First(); e; e = Schedule->Events()->Next(e)) { + if (e->StartTime() && e->RunningStatus() != SI::RunningStatusNotRunning) { // skip outdated events + int overlap = 0; + Matches(e, &overlap); + if (overlap > FULLMATCH) { + Event = e; + break; // take the first matching event + } + } + } + if (!Event && event && (now <= event->EndTime() || Matches(0, true))) + return; // stay with the old event until the timer has completely expired + } + else { + // Normal timers match the event they have the most overlap with: + int Overlap = 0; + // Set up the time frame within which to check events: + Matches(0, true); + time_t TimeFrameBegin = StartTime() - EPGLIMITBEFORE; + time_t TimeFrameEnd = StopTime() + EPGLIMITAFTER; + for (const cEvent *e = Schedule->Events()->First(); e; e = Schedule->Events()->Next(e)) { if (e->EndTime() < TimeFrameBegin) continue; // skip events way before the timer starts if (e->StartTime() > TimeFrameEnd) break; // the rest is way after the timer ends - } - int overlap = 0; - Matches(e, &overlap); - if (overlap && overlap >= Overlap) { - int distance = 0; - if (now < e->StartTime()) - distance = e->StartTime() - now; - else if (now > e->EndTime()) - distance = e->EndTime() - now; - if (Event && overlap == Overlap) { - if (Overlap > FULLMATCH) { // this means VPS - if (abs(Distance) < abs(distance)) - break; // we've already found the closest VPS event - } - else if (e->Duration() <= Event->Duration()) + int overlap = 0; + Matches(e, &overlap); + if (overlap && overlap >= Overlap) { + if (Event && overlap == Overlap && e->Duration() <= Event->Duration()) continue; // if overlap is the same, we take the longer event + Overlap = overlap; + Event = e; } - Overlap = overlap; - Distance = distance; - Event = e; } - } - if (Event && Event->EndTime() < now - EXPIRELATENCY && Overlap > FULLMATCH && !Event->IsRunning()) - Event = NULL; + } SetEvent(Event); - lastSetEvent = now; } } } -- cgit v1.2.3