From patchwork Sat Sep 15 13:57:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Klaus Schmidinger X-Patchwork-Id: 14423 Received: from localhost ([127.0.0.1] helo=www.linuxtv.org) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1TCstB-0000uD-NF; Sat, 15 Sep 2012 15:58:29 +0200 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1TCssk-0000nK-WF for vdr@linuxtv.org; Sat, 15 Sep 2012 15:58:28 +0200 X-tubIT-Incoming-IP: 188.40.50.18 Received: from racoon.tvdr.de ([188.40.50.18]) by mail.tu-berlin.de (exim-4.75/mailfrontend-4) with esmtps [TLSv1:AES256-SHA:256] for id 1TCssk-0005hu-Bt; Sat, 15 Sep 2012 15:58:02 +0200 Received: from dolphin.tvdr.de (dolphin.tvdr.de [192.168.100.2]) by racoon.tvdr.de (8.14.5/8.14.5) with ESMTP id q8FDw1Cn006990 for ; Sat, 15 Sep 2012 15:58:01 +0200 Received: from [192.168.100.10] (hawk.tvdr.de [192.168.100.10]) by dolphin.tvdr.de (8.14.4/8.14.4) with ESMTP id q8FDvs58022844 for ; Sat, 15 Sep 2012 15:57:54 +0200 Message-ID: <50548962.5020509@tvdr.de> Date: Sat, 15 Sep 2012 15:57:54 +0200 From: Klaus Schmidinger User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120825 Thunderbird/15.0 MIME-Version: 1.0 To: vdr@linuxtv.org References: <4FB8B9D0.2040403@gmail.com> <4FB8BB3C.3020303@tvdr.de> <4FB8D100.8000608@gmail.com> <4FB8D25F.1060106@tvdr.de> <4FB8D869.3020104@gmail.com> <4FB8D93F.7050900@tvdr.de> <4FB8DBC3.4000707@gmail.com> In-Reply-To: <4FB8DBC3.4000707@gmail.com> X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.9.15.134817 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, MIME_TEXT_ONLY_MP_MIXED 0.05, BODYTEXTP_SIZE_3000_LESS 0, __ANY_URI 0, __BAT_BOUNDARY 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CT 0, __CTYPE_HAS_BOUNDARY 0, __CTYPE_MULTIPART 0, __CTYPE_MULTIPART_MIXED 0, __FW_1LN_BOT_MSGID 0, __HAS_FROM 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MOZILLA_MSGID 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_MAILTO 0, __URI_NO_PATH 0, __URI_NO_WWW 0, __USER_AGENT 0' X-LSpam-Score: -1.1 (-) X-LSpam-Report: No, score=-1.1 required=5.0 tests=BAYES_00=-1.9, RDNS_NONE=0.793 autolearn=no Subject: Re: [vdr] [PATCH] Allow instant recording to record only present event X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: vdr-bounces@linuxtv.org Errors-To: vdr-bounces@linuxtv.org On 20.05.2012 13:55, Matti Lehtimäki wrote: > On 05/20/2012 02:45 PM, Klaus Schmidinger wrote: >> On 20.05.2012 13:41, Matti Lehtimäki wrote: >>> On 05/20/2012 02:15 PM, Klaus Schmidinger wrote: >>>> One more thing comes to mind: you also need to make sure that >>>> the 'day' is set to the day of the EPG event. Just in case it >>>> is past midnight already and the event started "yesterday" ;-) >>> >>> Indeed that was missing. I think setting the day is relevant only if >>> VPS is used since in otherwise the start time is the current time not >>> the start time of the event. Or should the start time be set to that >>> of the event if VPS is not used? >> >> Well, that's a matter of taste. >> For VPS it is relevant, otherwise it's up to you. > > Attached is a new version of the patch with correct day always set when VPS is used. Could this patch be included in next version of VDR? While adopting this patch I found that we need to set the timer's 'event' pointer to the actual event here, and that the start time should always be set to the event's start time (even if VPS is not used) in order to keep the event from getting reassigned to a different one later on. I have attached a revised version of your patch (against VDR 1.7.30). Please take a look and let me know whether it is still OK for you. Klaus --- ./MANUAL 2012/09/09 12:28:27 2.20 +++ ./MANUAL 2012/09/15 13:50:06 @@ -837,6 +837,11 @@ Default is 180 minutes (3 hours). The stop time of an instant recording can be modified at any time by editing the respective timer in the "Timers" menu. + If this parameter is set to 0 ("present event"), only the + currently running event will be recorded, using the stop + margin and VPS setting as configured. + Note that this parameter is also used when pausing live + video! Max. video file size = 2000 The maximum size of a single recorded video file in MB. --- ./config.c 2012/09/09 12:58:23 2.27 +++ ./config.c 2012/09/15 11:52:03 @@ -383,7 +383,7 @@ MenuKeyCloses = 0; MarkInstantRecord = 1; strcpy(NameInstantRecord, "TITLE EPISODE"); - InstantRecordTime = 180; + InstantRecordTime = DEFINSTRECTIME; LnbSLOF = 11700; LnbFrequLo = 9750; LnbFrequHi = 10600; --- ./config.h 2012/09/13 11:12:07 2.52 +++ ./config.h 2012/09/15 11:51:54 @@ -42,6 +42,7 @@ #define TRANSFERPRIORITY (LIVEPRIORITY - 1) // priority used for actual local Transfer Mode #define IDLEPRIORITY (MINPRIORITY - 1) // priority of an idle device #define MAXLIFETIME 99 +#define DEFINSTRECTIME 180 // default instant recording time (minutes) #define MINOSDWIDTH 480 #define MAXOSDWIDTH 1920 --- ./menu.c 2012/09/09 12:23:00 2.60 +++ ./menu.c 2012/09/15 11:45:28 @@ -3118,7 +3118,7 @@ Add(new cMenuEditIntItem( tr("Setup.Recording$VPS margin (s)"), &data.VpsMargin, 0)); Add(new cMenuEditBoolItem(tr("Setup.Recording$Mark instant recording"), &data.MarkInstantRecord)); Add(new cMenuEditStrItem( tr("Setup.Recording$Name instant recording"), data.NameInstantRecord, sizeof(data.NameInstantRecord))); - Add(new cMenuEditIntItem( tr("Setup.Recording$Instant rec. time (min)"), &data.InstantRecordTime, 1, MAXINSTANTRECTIME)); + Add(new cMenuEditIntItem( tr("Setup.Recording$Instant rec. time (min)"), &data.InstantRecordTime, 0, MAXINSTANTRECTIME, tr("Setup.Recording$present event"))); Add(new cMenuEditIntItem( tr("Setup.Recording$Max. video file size (MB)"), &data.MaxVideoFileSize, MINVIDEOFILESIZE, MAXVIDEOFILESIZETS)); Add(new cMenuEditBoolItem(tr("Setup.Recording$Split edited files"), &data.SplitEditedFiles)); Add(new cMenuEditStraItem(tr("Setup.Recording$Delete timeshift recording"),&data.DelTimeshiftRec, 3, delTimeshiftRecTexts)); --- ./po/de_DE.po 2012/09/13 11:18:53 2.34 +++ ./po/de_DE.po 2012/09/15 12:04:42 @@ -1077,6 +1077,9 @@ msgid "Setup.Recording$Instant rec. time (min)" msgstr "Dauer der Direktaufzeichnung (min)" +msgid "Setup.Recording$present event" +msgstr "laufende Sendung" + msgid "Setup.Recording$Max. video file size (MB)" msgstr "Max. Videodateigröße (MB)" --- ./po/fi_FI.po 2012/09/13 11:18:14 2.40 +++ ./po/fi_FI.po 2012/09/15 12:04:17 @@ -1080,6 +1080,9 @@ msgid "Setup.Recording$Instant rec. time (min)" msgstr "Pikatallennuksen kesto (min)" +msgid "Setup.Recording$present event" +msgstr "nykyinen tapahtuma" + msgid "Setup.Recording$Max. video file size (MB)" msgstr "Suurin tiedostokoko (Mt)" --- ./timers.c 2012/06/09 14:37:24 2.11 +++ ./timers.c 2012/09/15 13:34:03 @@ -32,6 +32,9 @@ deferred = 0; recording = pending = inVpsMargin = false; flags = tfNone; + *file = 0; + aux = NULL; + event = NULL; if (Instant) SetFlags(tfActive | tfInstant); channel = Channel ? Channel : Channels.GetByNumber(cDevice::CurrentChannel()); @@ -41,15 +44,40 @@ day = SetTime(t, 0); weekdays = 0; start = now->tm_hour * 100 + now->tm_min; - stop = now->tm_hour * 60 + now->tm_min + Setup.InstantRecordTime; - stop = (stop / 60) * 100 + (stop % 60); + stop = 0; + if (!Setup.InstantRecordTime && channel) { + cSchedulesLock SchedulesLock; + if (const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock)) { + if (const cSchedule *Schedule = Schedules->GetSchedule(channel)) { + if (const cEvent *Event = Schedule->GetPresentEvent()) { + time_t tstart = Event->StartTime(); + time_t tstop = Event->EndTime(); + if (Event->Vps() && Setup.UseVps) { + SetFlags(tfVps); + tstart = Event->Vps(); + } + else { + tstop += Setup.MarginStop * 60; + tstart -= Setup.MarginStart * 60; + } + day = SetTime(tstart, 0); + struct tm *time = localtime_r(&tstart, &tm_r); + start = time->tm_hour * 100 + time->tm_min; + time = localtime_r(&tstop, &tm_r); + stop = time->tm_hour * 100 + time->tm_min; + SetEvent(Event); + } + } + } + } + if (!stop) { + stop = now->tm_hour * 60 + now->tm_min + (Setup.InstantRecordTime ? Setup.InstantRecordTime : DEFINSTRECTIME); + stop = (stop / 60) * 100 + (stop % 60); + } if (stop >= 2400) stop -= 2400; priority = Pause ? Setup.PausePriority : Setup.DefaultPriority; lifetime = Pause ? Setup.PauseLifetime : Setup.DefaultLifetime; - *file = 0; - aux = NULL; - event = NULL; if (Instant && channel) snprintf(file, sizeof(file), "%s%s", Setup.MarkInstantRecord ? "@" : "", *Setup.NameInstantRecord ? Setup.NameInstantRecord : channel->Name()); if (VfatFileSystem && (Utf8StrLen(file) > VFAT_MAX_FILENAME)) { @@ -66,6 +94,9 @@ deferred = 0; recording = pending = inVpsMargin = false; flags = tfActive; + *file = 0; + aux = NULL; + event = NULL; if (Event->Vps() && Setup.UseVps) SetFlags(tfVps); channel = Channels.GetByChannelID(Event->ChannelID(), true); @@ -86,7 +117,6 @@ stop -= 2400; priority = Setup.DefaultPriority; lifetime = Setup.DefaultLifetime; - *file = 0; const char *Title = Event->Title(); if (!isempty(Title)) Utf8Strn0Cpy(file, Event->Title(), sizeof(file)); @@ -95,8 +125,7 @@ file[Utf8SymChars(file, VFAT_MAX_FILENAME)] = 0; dsyslog("timer file name truncated to '%s'", file); } - aux = NULL; - event = NULL; // let SetEvent() be called to get a log message + SetEvent(Event); } cTimer::cTimer(const cTimer &Timer)