summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2001-08-19 14:45:31 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2001-08-19 14:45:31 +0200
commita706fb8643fd891af400c4330417b72f7da8c897 (patch)
treeaf011e96afc1cf3efff5a0b21bfac945d992e2e5
parent73870fc90706ced04a25f19ee72595eb3a9e4d2b (diff)
downloadvdr-a706fb8643fd891af400c4330417b72f7da8c897.tar.gz
vdr-a706fb8643fd891af400c4330417b72f7da8c897.tar.bz2
Getting the event info for the current recording
-rw-r--r--eit.c6
-rw-r--r--menu.c37
-rw-r--r--menu.h4
3 files changed, 42 insertions, 5 deletions
diff --git a/eit.c b/eit.c
index 8e5087d8..d2927ccc 100644
--- a/eit.c
+++ b/eit.c
@@ -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--;
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) {
diff --git a/menu.h b/menu.h
index f75ca867..58cc8469 100644
--- a/menu.h
+++ b/menu.h
@@ -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();