From patchwork Fri Jan 20 16:43:02 2006 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Schmidinger X-Patchwork-Id: 12170 Received: from tiger.cadsoft.de ([217.7.101.210]) by www.linuxtv.org with esmtp (Exim 4.50) id 1EzzLw-0006Ox-4e for vdr@linuxtv.org; Fri, 20 Jan 2006 17:43:09 +0100 Received: from raven.cadsoft.de (raven.cadsoft.de [217.7.101.211]) by tiger.cadsoft.de (8.13.4/8.13.4) with ESMTP id k0KGh6WT000963 for ; Fri, 20 Jan 2006 17:43:06 +0100 Received: from [192.168.100.10] (hawk.cadsoft.de [192.168.100.10]) by raven.cadsoft.de (8.13.3/8.13.3) with ESMTP id k0KGh5lo017992 for ; Fri, 20 Jan 2006 17:43:05 +0100 Message-ID: <43D11316.1010806@cadsoft.de> Date: Fri, 20 Jan 2006 17:43:02 +0100 From: Klaus Schmidinger Organization: CadSoft Computer GmbH User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050716) X-Accept-Language: en MIME-Version: 1.0 To: vdr@linuxtv.org Subject: Re: [vdr] how to stop timer? References: <200601191746.59826.mhahn@reel-multimedia.com> <43CFC69C.4090707@cadsoft.de> <43D11084.4000401@cadsoft.de> In-Reply-To: <43D11084.4000401@cadsoft.de> X-Greylist: Sender DNS name whitelisted, not delayed by milter-greylist-2.0.2 (tiger.cadsoft.de [217.7.101.210]); Fri, 20 Jan 2006 17:43:06 +0100 (CET) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (raven.cadsoft.de [192.168.1.1]); Fri, 20 Jan 2006 17:43:06 +0100 (CET) X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jan 2006 16:43:10 -0000 Status: O X-Status: X-Keywords: X-UID: 7332 Klaus Schmidinger wrote: > Klaus Schmidinger wrote: > >> Markus Hahn wrote: >> >>> Hi there >>> A full or not available disk causes a endless lopp of TimerStart and >>> EmergencyExit if a timer is active. >>> >>> To avoid this, I added this code to cRecordControls::Start() : >>> menu.c:3518 >>> bool cRecordControls::Start(cTimer *Timer, bool Pause) >>> { >>> ChangeState(); >>> if (!VideoFileSpaceAvailable(300)) >>> { >>> Skins.Message(mtInfo, tr("No disk space!")); >>> if (Timer) >>> Timer->Delete(); >>> >>> return false; >>> } >>> >>> Now the message pops up endlessly, because the timer is still >>> aktive??? Any suggestions? >> >> >> >> Maybe a better place for this would be in the main VDR loop: >> >> // Start new recordings: >> if (VideoFileSpaceAvailable(300)) { >> cTimer *Timer = Timers.GetMatch(Now); >> if (Timer) { >> if (!cRecordControls::Start(Timer)) >> Timer->SetPending(true); >> else >> LastTimerChannel = Timer->Channel()->Number(); >> } >> } >> else if (/*TimeSinceLastNoDiskSpaceMessageGreaterLimit*/) { >> Skins.Message(mtWarning, tr("No disk space!")); >> // reset timeout limit >> } > > > After some more thinking I believe cRecordControls::Start() actually > is the better place for this check, since it is called several times. > > Please try the attached patch. Sorry, forgot the attachment... Klaus --- menu.c 2006/01/15 15:02:36 1.396 +++ menu.c 2006/01/20 16:28:18 @@ -36,6 +36,8 @@ #define MAXRECORDCONTROLS (MAXDEVICES * MAXRECEIVERS) #define MAXINSTANTRECTIME (24 * 60 - 1) // 23:59 hours #define MAXWAITFORCAMMENU 4 // seconds to wait for the CAM menu to open +#define MINFREEDISK 300 // minimum free disk space required to start recording +#define NODISKSPACEDELTA 300 // seconds between "Not enough disk space to start recording!" messages #define CHNUMWIDTH (numdigits(Channels.MaxNumber()) + 1) @@ -3520,6 +3522,19 @@ bool cRecordControls::Start(cTimer *Timer, bool Pause) { + static time_t LastNoDiskSpaceMessage = 0; + int FreeMB = 0; + VideoDiskSpace(&FreeMB); + if (FreeMB < MINFREEDISK) { + if (!Timer || time(NULL) - LastNoDiskSpaceMessage > NODISKSPACEDELTA) { + isyslog("not enough disk space to start recording%s%s", Timer ? " timer " : "", Timer ? *Timer->ToDescr() : ""); + Skins.Message(mtWarning, tr("Not enough disk space to start recording!")); + LastNoDiskSpaceMessage = time(NULL); + } + return false; + } + LastNoDiskSpaceMessage = 0; + ChangeState(); int ch = Timer ? Timer->Channel()->Number() : cDevice::CurrentChannel(); cChannel *channel = Channels.GetByNumber(ch); @@ -3548,8 +3563,10 @@ } } } - else if (!Timer || (Timer->Priority() >= Setup.PrimaryLimit && !Timer->Pending())) + else if (!Timer || (Timer->Priority() >= Setup.PrimaryLimit && !Timer->Pending())) { isyslog("no free DVB device to record channel %d!", ch); + Skins.Message(mtError, tr("No free DVB device to record!")); + } } else esyslog("ERROR: channel %d not defined!", ch); --- vdr.c 2006/01/16 17:05:49 1.241 +++ vdr.c 2006/01/20 16:12:39 @@ -902,8 +902,6 @@ if (!cControl::Control()) { if (cRecordControls::Start()) Skins.Message(mtInfo, tr("Recording started")); - else - Skins.Message(mtError, tr("No free DVB device to record!")); key = kNone; // nobody else needs to see this key } break; @@ -947,8 +945,6 @@ case osRecord: DELETE_MENU; if (cRecordControls::Start()) Skins.Message(mtInfo, tr("Recording started")); - else - Skins.Message(mtError, tr("No free DVB device to record!")); break; case osRecordings: DELETE_MENU;