summaryrefslogtreecommitdiff
path: root/menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/menu.c b/menu.c
index 439258f5..4cc43f09 100644
--- a/menu.c
+++ b/menu.c
@@ -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) {