LinuxTV Patchwork Allow instant recording to record only present event

login
register
mail settings
Submitter Matti Lehtimäki
Date May 20, 2012, 11:09 a.m.
Message ID <4FB8D100.8000608@gmail.com>
Download mbox | patch
Permalink /patch/12950/
State New
Headers show

Comments

Matti Lehtimäki - May 20, 2012, 11:09 a.m.
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.
Klaus Schmidinger - May 20, 2012, 11:15 a.m.
On 20.05.2012 13:09, Matti Lehtimäki wrote:
> 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.

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" ;-)

Klaus
Matti Lehtimäki - May 20, 2012, 11:41 a.m.
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?
Klaus Schmidinger - May 20, 2012, 11:45 a.m.
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.

Klaus

Patch

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;

Privacy Policy