Re: [vdr] [PATCH] Allow instant recording to record only present event
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 DEFINSTRECTIME180 // 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 =
Re: [vdr] [PATCH] Allow instant recording to record only present event
On 09/15/2012 04:57 PM, Klaus Schmidinger wrote: 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. The revised version of the patch works the way I want so it's OK for me. Thanks. -- Matti Lehtimäki ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] [PATCH] Allow instant recording to record only present event
On 20.05.2012 11:30, Matti Lehtimäki wrote: Hi I made a patch to allow special case for instant recordings to only record the present event. This is done by defining Instant rec. time to 0. 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. Klaus ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] [PATCH] Allow instant recording to record only present event
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. -- Matti 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.0 +0200 +++ vdr-1.7.27-inst-rec/menu.c 2012-04-27 00:50:35.0 +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.0 +0200 +++ vdr-1.7.27-inst-rec/po/fi_FI.po 2012-04-27 00:52:40.0 +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.0 +0200 +++ vdr-1.7.27-inst-rec/timers.c 2012-05-20 14:01:01.0 +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; ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] [PATCH] Allow instant recording to record only present event
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 ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] [PATCH] Allow instant recording to record only present event
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? -- Matti ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] [PATCH] Allow instant recording to record only present event
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 ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] [PATCH] Allow instant recording to record only present event
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? -- Matti 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.0 +0200 +++ vdr-1.7.27-inst-rec/menu.c 2012-04-27 00:50:35.0 +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.0 +0200 +++ vdr-1.7.27-inst-rec/po/fi_FI.po 2012-04-27 00:52:40.0 +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.0 +0200 +++ vdr-1.7.27-inst-rec/timers.c 2012-05-20 14:32:35.0 +0300 @@ -41,8 +41,34 @@ 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(); + day = SetTime(tstart, 0); + 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; ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr
Re: [vdr] [PATCH] Allow instant recording to record only present event
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? I guess so... Klaus ___ vdr mailing list vdr@linuxtv.org http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr