Allow instant recording to record only present event
Commit Message
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.
There is still the question what should be done if event is non-existent
or otherwise not obtained? Should the VDR default Instant rec. time be
used or not?
Comments
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
@@ -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));
@@ -1071,6 +1071,9 @@
msgid "Setup.Recording$Instant rec. time (min)"
msgstr "Pikatallennuksen kesto (min)"
+msgid "Setup.Recording$present event"
+msgstr "nykyinen ohjelma"
+
msgid "Setup.Recording$Max. video file size (MB)"
msgstr "Suurin tiedostokoko (Mt)"
@@ -41,8 +41,26 @@
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 tstop = Event->StartTime() + Event->Duration() + Setup.MarginStop * 60;
+ struct tm *time = localtime_r(&tstop, &tm_r);
+ stop = time->tm_hour * 100 + time->tm_min;
+ }
+ }
+ }
+ }
+ if (!stop) {// @todo should we fix the instant record time for non-existent events?
+ stop = now->tm_hour * 60 + now->tm_min + Setup.InstantRecordTime;
+ stop = (stop / 60) * 100 + (stop % 60);
+ }
if (stop >= 2400)
stop -= 2400;
priority = Pause ? Setup.PausePriority : Setup.DefaultPriority;