diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2001-08-19 14:45:31 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2001-08-19 14:45:31 +0200 |
commit | a706fb8643fd891af400c4330417b72f7da8c897 (patch) | |
tree | af011e96afc1cf3efff5a0b21bfac945d992e2e5 | |
parent | 73870fc90706ced04a25f19ee72595eb3a9e4d2b (diff) | |
download | vdr-a706fb8643fd891af400c4330417b72f7da8c897.tar.gz vdr-a706fb8643fd891af400c4330417b72f7da8c897.tar.bz2 |
Getting the event info for the current recording
-rw-r--r-- | eit.c | 6 | ||||
-rw-r--r-- | menu.c | 37 | ||||
-rw-r--r-- | menu.h | 4 |
3 files changed, 42 insertions, 5 deletions
@@ -16,7 +16,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * $Id: eit.c 1.21 2001/08/17 13:19:10 kls Exp $ + * $Id: eit.c 1.22 2001/08/19 14:44:32 kls Exp $ ***************************************************************************/ #include "eit.h" @@ -570,7 +570,7 @@ const cEventInfo * cSchedule::GetEvent(time_t tTime) const cEventInfo *pe = Events.First(); while (pe != NULL) { - if (pe->GetTime() == tTime) + if (pe->GetTime() <= tTime && tTime <= pe->GetTime() + pe->GetDuration()) return pe; pe = Events.Next(pe); @@ -615,7 +615,7 @@ void cSchedule::Cleanup(time_t tTime) pEvent = Events.Get(a); if (pEvent == NULL) break; - if (pEvent->GetTime() + pEvent->GetDuration() < tTime) + if (pEvent->GetTime() + pEvent->GetDuration() + 3600 < tTime) // adding one hour for safety { Events.Del(pEvent); a--; @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.c 1.104 2001/08/17 13:02:27 kls Exp $ + * $Id: menu.c 1.105 2001/08/19 14:45:31 kls Exp $ */ #include "menu.h" @@ -17,6 +17,7 @@ #include "i18n.h" #define MENUTIMEOUT 120 // seconds +#define MAXWAIT4EPGINFO 10 // seconds const char *FileNameChars = " aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789-.#^"; @@ -2063,6 +2064,7 @@ eOSState cDisplayChannel::ProcessKey(eKeys Key) cRecordControl::cRecordControl(cDvbApi *DvbApi, cTimer *Timer) { + eventInfo = NULL; instantId = NULL; dvbApi = DvbApi; if (!dvbApi) dvbApi = cDvbApi::PrimaryDvbApi;//XXX @@ -2076,6 +2078,11 @@ cRecordControl::cRecordControl(cDvbApi *DvbApi, cTimer *Timer) timer->SetPending(true); timer->SetRecording(true); if (Channels.SwitchTo(timer->channel, dvbApi)) { + if (GetEventInfo()) { + //XXX this is in preparation for storing recordings in subdirectories and giving them the name of the Subtitle + dsyslog(LOG_INFO, "Title: '%s' Subtitle: '%s'", eventInfo->GetTitle(), eventInfo->GetSubtitle());//XXX + //XXX modify timer's name and summary, mark it as modified (revert later when stopping) + } cRecording Recording(timer); if (dvbApi->StartRecord(Recording.FileName(), Channels.GetByNumber(timer->channel)->ca, timer->priority)) Recording.WriteSummary(); @@ -2091,6 +2098,34 @@ cRecordControl::~cRecordControl() delete instantId; } +bool cRecordControl::GetEventInfo(void) +{ + cChannel *channel = Channels.GetByNumber(timer->channel); + time_t Time = timer->StartTime() + (timer->StopTime() - timer->StartTime()) / 2; + for (int seconds = 0; seconds <= MAXWAIT4EPGINFO; seconds++) { + { + cThreadLock ThreadLock; + const cSchedules *Schedules = dvbApi->Schedules(&ThreadLock); + if (Schedules) { + const cSchedule *Schedule = Schedules->GetSchedule(channel->pnr); + if (Schedule) { + eventInfo = Schedule->GetEvent(Time); + if (eventInfo) { + if (seconds > 0) + dsyslog(LOG_INFO, "got EPG info after %d seconds", seconds); + return true; + } + } + } + } + if (seconds == 0) + dsyslog(LOG_INFO, "waiting for EPG info..."); + sleep(1); + } + dsyslog(LOG_INFO, "no EPG info available"); + return false; +} + void cRecordControl::Stop(bool KeepInstant) { if (timer) { @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: menu.h 1.23 2001/08/11 14:08:50 kls Exp $ + * $Id: menu.h 1.24 2001/08/19 14:44:32 kls Exp $ */ #ifndef _MENU_H @@ -72,7 +72,9 @@ class cRecordControl { private: cDvbApi *dvbApi; cTimer *timer; + const cEventInfo *eventInfo; char *instantId; + bool GetEventInfo(void); public: cRecordControl(cDvbApi *DvbApi, cTimer *Timer = NULL); virtual ~cRecordControl(); |