From patchwork Sun May 20 11:09:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Matti_Lehtim=C3=A4ki?= X-Patchwork-Id: 12950 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1SW40f-00007o-RE for vdr@linuxtv.org; Sun, 20 May 2012 13:09:14 +0200 X-tubIT-Incoming-IP: 209.85.215.54 Received: from mail-lpp01m010-f54.google.com ([209.85.215.54]) by mail.tu-berlin.de (exim-4.75/mailfrontend-4) with esmtps [TLSv1:RC4-SHA:128] for id 1SW40f-0005SJ-As; Sun, 20 May 2012 13:09:13 +0200 Received: by laai10 with SMTP id i10so3619328laa.41 for ; Sun, 20 May 2012 04:09:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=46h3cdx6sUX/EynpswRWeclvR99MXt1FYlY+TV7Cu0o=; b=qJn10aG9l997RyDqjpgKDbG0kcGPZOjZwdlGiGshfsVf80aUfEBdisg/pVqVm0fDea bprjdKe5Hhibudj7OP5MjLMwAoz5uBosljWSLvNvxdAmXFXMuClloN6qQ+N+a+EB420X D//eMavdBcwgIVZ3gs62r7m6fxSo9wTqNbaLFswj7vDpFm50SxSmSbPMX9RF8VM0pJMr rgMex1x38czo+Wh0MK1/6lbEtSLCKo0Z3QjFnJYDSaoNZHIoOhBENvtqxFo8MyNffUdr Qr4Yx0c6sb6HVbnF7HTffGUxLsAZ9TNB+lskFR4gqZhbijSVJId+ctkeuKNHE4U73Xnt ipUA== Received: by 10.152.145.41 with SMTP id sr9mr10149120lab.25.1337512152735; Sun, 20 May 2012 04:09:12 -0700 (PDT) Received: from [192.168.1.102] (dsl-hkibrasgw2-fe2bde00-176.dhcp.inet.fi. [80.222.43.176]) by mx.google.com with ESMTPS id fv16sm559708lab.9.2012.05.20.04.09.11 (version=SSLv3 cipher=OTHER); Sun, 20 May 2012 04:09:11 -0700 (PDT) Message-ID: <4FB8D100.8000608@gmail.com> Date: Sun, 20 May 2012 14:09:52 +0300 From: =?ISO-8859-1?Q?Matti_Lehtim=E4ki?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111120 Icedove/3.1.16 MIME-Version: 1.0 To: vdr@linuxtv.org References: <4FB8B9D0.2040403@gmail.com> <4FB8BB3C.3020303@tvdr.de> In-Reply-To: <4FB8BB3C.3020303@tvdr.de> X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.5.20.105717 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, BODY_SIZE_4000_4999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, NO_URI_FOUND 0, WEBMAIL_SOURCE 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, __DATE_TZ_RU 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __FROM_GMAIL 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MOZILLA_MSGID 0, __PHISH_SPEAR_STRUCTURE_1 0, __RDNS_GMAIL 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __USER_AGENT 0' X-LSpam-Score: -1.8 (-) X-LSpam-Report: No, score=-1.8 required=5.0 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RDNS_NONE=0.793, T_DKIM_INVALID=0.01 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: , X-List-Received-Date: Sun, 20 May 2012 11:09:14 -0000 Status: O X-Status: X-Keywords: X-UID: 26274 On 05/20/2012 12:37 PM, Klaus Schmidinger wrote: > Nice idea. > However, please also take VPS into account. > If Setup.UseVps is set, and the event has a VPS time, the timer's > start time should be set to the VPS time, and the timer's ttVps > flag should be set. Hi Attached is a new version of the patch with support for VPS. I also changed the behavior of the patch in case no event is found so that recording will succeed even in that situation. In previous version of patch the recording length would have been zero but now it becomes VDR default Instant rec. time (180 min) if no event is obtained. diff -Naur vdr-1.7.27-orig/menu.c vdr-1.7.27-inst-rec/menu.c --- vdr-1.7.27-orig/menu.c 2012-03-13 15:14:38.000000000 +0200 +++ vdr-1.7.27-inst-rec/menu.c 2012-04-27 00:50:35.000000000 +0300 @@ -3114,7 +3114,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)); diff -Naur vdr-1.7.27-orig/po/fi_FI.po vdr-1.7.27-inst-rec/po/fi_FI.po --- vdr-1.7.27-orig/po/fi_FI.po 2012-03-11 12:44:43.000000000 +0200 +++ vdr-1.7.27-inst-rec/po/fi_FI.po 2012-04-27 00:52:40.000000000 +0300 @@ -1071,6 +1071,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)" diff -Naur vdr-1.7.27-orig/timers.c vdr-1.7.27-inst-rec/timers.c --- vdr-1.7.27-orig/timers.c 2012-02-27 11:38:41.000000000 +0200 +++ vdr-1.7.27-inst-rec/timers.c 2012-05-20 14:01:01.000000000 +0300 @@ -41,8 +41,33 @@ 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) { + cSchedulesLock SchedulesLock; + const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock); + if (Schedules && channel) { + const cSchedule *Schedule = Schedules->GetSchedule(channel); + if (Schedule) { + const cEvent *Event = Schedule->GetPresentEvent(); + if (Event) { + time_t tstart = Event->StartTime(); + if (Event->Vps() && Setup.UseVps) { + SetFlags(tfVps); + tstart = Event->Vps(); + struct tm *time = localtime_r(&tstart, &tm_r); + start = time->tm_hour * 100 + time->tm_min; + } + time_t tstop = tstart + Event->Duration() + Setup.MarginStop * 60; + struct tm *time = localtime_r(&tstop, &tm_r); + stop = time->tm_hour * 100 + time->tm_min; + } + } + } + } + if (!stop) { + stop = now->tm_hour * 60 + now->tm_min + (Setup.InstantRecordTime ? Setup.InstantRecordTime : 180); + stop = (stop / 60) * 100 + (stop % 60); + } if (stop >= 2400) stop -= 2400; priority = Pause ? Setup.PausePriority : Setup.DefaultPriority;