summaryrefslogtreecommitdiff
path: root/coreengine
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2016-05-04 16:21:42 +0200
committerlouis <louis.braun@gmx.de>2016-05-04 16:21:42 +0200
commit7994fc200ae7fd2562c367fdfd325f5a88bee3c8 (patch)
tree8945fcffbdda09b915143cd10080c1b3c0b97a1f /coreengine
parent24cf03d3f87b98d4de214032abd2a8769ad002e1 (diff)
downloadvdr-plugin-skindesigner-7994fc200ae7fd2562c367fdfd325f5a88bee3c8.tar.gz
vdr-plugin-skindesigner-7994fc200ae7fd2562c367fdfd325f5a88bee3c8.tar.bz2
implemented epg2vdr support
Diffstat (limited to 'coreengine')
-rw-r--r--coreengine/definitions.h13
-rw-r--r--coreengine/listelements.c43
-rw-r--r--coreengine/viewdisplaychannel.c6
-rw-r--r--coreengine/viewdisplaychannel.h2
-rw-r--r--coreengine/viewelementsdisplaychannel.c34
-rw-r--r--coreengine/viewelementsdisplaychannel.h5
-rw-r--r--coreengine/viewelementsdisplaymenu.c49
7 files changed, 95 insertions, 57 deletions
diff --git a/coreengine/definitions.h b/coreengine/definitions.h
index 5787615..ccb9acb 100644
--- a/coreengine/definitions.h
+++ b/coreengine/definitions.h
@@ -504,6 +504,7 @@ enum class eDMTimersLT {
channelid,
channellogoexists,
isremotetimer,
+ remotehost,
count
};
@@ -898,6 +899,10 @@ enum class eLeMenuTimersST {
eventtitle,
eventstart,
eventstop,
+ state,
+ stateinfo,
+ action,
+ vdrname,
count
};
@@ -914,6 +919,8 @@ enum class eLeMenuTimersIT {
flagvps,
flagrecording,
flagpending,
+ isvdrrunning,
+ isremote,
count
};
@@ -933,6 +940,10 @@ enum class eCeMenuTimersST {
eventdescription,
posterpath,
bannerpath,
+ state,
+ stateinfo,
+ action,
+ vdrname,
count
};
@@ -957,6 +968,8 @@ enum class eCeMenuTimersIT {
hasbanner,
bannerwidth,
bannerheight,
+ isvdrrunning,
+ isremote,
count
};
diff --git a/coreengine/listelements.c b/coreengine/listelements.c
index 1d9d015..e5dfd93 100644
--- a/coreengine/listelements.c
+++ b/coreengine/listelements.c
@@ -1,5 +1,6 @@
#include "listelements.h"
#include "../config.h"
+#include "../services/epgtimer.h"
#include <sstream>
#include <algorithm>
@@ -1181,6 +1182,10 @@ void cLeMenuTimers::SetTokenContainer(void) {
tokenContainer->DefineStringToken("{eventtitle}", (int)eLeMenuTimersST::eventtitle);
tokenContainer->DefineStringToken("{eventstart}", (int)eLeMenuTimersST::eventstart);
tokenContainer->DefineStringToken("{eventstop}", (int)eLeMenuTimersST::eventstop);
+ tokenContainer->DefineStringToken("{state}", (int)eLeMenuTimersST::state);
+ tokenContainer->DefineStringToken("{stateinfo}", (int)eLeMenuTimersST::stateinfo);
+ tokenContainer->DefineStringToken("{action}", (int)eLeMenuTimersST::action);
+ tokenContainer->DefineStringToken("{vdrname}", (int)eLeMenuTimersST::vdrname);
tokenContainer->DefineIntToken("{nummenuitem}", (int)eLeMenuTimersIT::nummenuitem);
tokenContainer->DefineIntToken("{current}", (int)eLeMenuTimersIT::current);
tokenContainer->DefineIntToken("{separator}", (int)eLeMenuTimersIT::separator);
@@ -1193,6 +1198,8 @@ void cLeMenuTimers::SetTokenContainer(void) {
tokenContainer->DefineIntToken("{flagvps}", (int)eLeMenuTimersIT::flagvps);
tokenContainer->DefineIntToken("{flagrecording}", (int)eLeMenuTimersIT::flagrecording);
tokenContainer->DefineIntToken("{flagpending}", (int)eLeMenuTimersIT::flagpending);
+ tokenContainer->DefineIntToken("{isvdrrunning}", (int)eLeMenuTimersIT::isvdrrunning);
+ tokenContainer->DefineIntToken("{isremote}", (int)eLeMenuTimersIT::isremote);
InheritTokenContainer();
}
@@ -1279,6 +1286,21 @@ bool cLeMenuTimers::Parse(bool forced) {
tokenContainer->AddStringToken((int)eLeMenuTimersST::eventstart, *event->GetTimeString());
tokenContainer->AddStringToken((int)eLeMenuTimersST::eventstop, *event->GetEndTimeString());
}
+
+ cEpgTimer_Interface_V1* epgTimer;
+ if (epgTimer = dynamic_cast<cEpgTimer_Interface_V1*>((cTimer*)timer)) {
+ tokenContainer->AddIntToken((int)eLeMenuTimersIT::isvdrrunning, epgTimer->isVdrRunning());
+ tokenContainer->AddIntToken((int)eLeMenuTimersIT::isremote, epgTimer->isRemote());
+ stringstream state;
+ state << epgTimer->State();
+ tokenContainer->AddStringToken((int)eLeMenuTimersST::state, state.str().c_str());
+ tokenContainer->AddStringToken((int)eLeMenuTimersST::stateinfo, epgTimer->StateInfo());
+ tokenContainer->AddStringToken((int)eLeMenuTimersST::vdrname, epgTimer->VdrName());
+ stringstream action;
+ action << epgTimer->Action();
+ tokenContainer->AddStringToken((int)eLeMenuTimersST::action, action.str().c_str());
+ }
+
return true;
}
@@ -1318,6 +1340,10 @@ void cCeMenuTimers::SetTokenContainer(void) {
tokenContainer->DefineStringToken("{eventdescription}", (int)eCeMenuTimersST::eventdescription);
tokenContainer->DefineStringToken("{posterpath}", (int)eCeMenuTimersST::posterpath);
tokenContainer->DefineStringToken("{bannerpath}", (int)eCeMenuTimersST::bannerpath);
+ tokenContainer->DefineStringToken("{state}", (int)eCeMenuTimersST::state);
+ tokenContainer->DefineStringToken("{stateinfo}", (int)eCeMenuTimersST::stateinfo);
+ tokenContainer->DefineStringToken("{action}", (int)eCeMenuTimersST::action);
+ tokenContainer->DefineStringToken("{vdrname}", (int)eCeMenuTimersST::vdrname);
tokenContainer->DefineIntToken("{menuitemx}", (int)eCeMenuTimersIT::menuitemx);
tokenContainer->DefineIntToken("{menuitemy}", (int)eCeMenuTimersIT::menuitemy);
tokenContainer->DefineIntToken("{menuitemwidth}", (int)eCeMenuTimersIT::menuitemwidth);
@@ -1338,6 +1364,8 @@ void cCeMenuTimers::SetTokenContainer(void) {
tokenContainer->DefineIntToken("{hasbanner}", (int)eCeMenuTimersIT::hasbanner);
tokenContainer->DefineIntToken("{bannerwidth}", (int)eCeMenuTimersIT::bannerwidth);
tokenContainer->DefineIntToken("{bannerheight}", (int)eCeMenuTimersIT::bannerheight);
+ tokenContainer->DefineIntToken("{isvdrrunning}", (int)eCeMenuTimersIT::isvdrrunning);
+ tokenContainer->DefineIntToken("{isremote}", (int)eCeMenuTimersIT::isremote);
InheritTokenContainer();
}
@@ -1423,6 +1451,21 @@ bool cCeMenuTimers::Parse(bool forced) {
if (LoadFullScrapInfo(event, NULL))
SetScraperPosterBannerTimer(tokenContainer);
}
+
+ cEpgTimer_Interface_V1* epgTimer;
+ if (epgTimer = dynamic_cast<cEpgTimer_Interface_V1*>((cTimer*)timer)) {
+ tokenContainer->AddIntToken((int)eCeMenuTimersIT::isvdrrunning, epgTimer->isVdrRunning());
+ tokenContainer->AddIntToken((int)eCeMenuTimersIT::isremote, epgTimer->isRemote());
+ stringstream state;
+ state << epgTimer->State();
+ tokenContainer->AddStringToken((int)eCeMenuTimersST::state, state.str().c_str());
+ tokenContainer->AddStringToken((int)eCeMenuTimersST::stateinfo, epgTimer->StateInfo());
+ tokenContainer->AddStringToken((int)eCeMenuTimersST::vdrname, epgTimer->VdrName());
+ stringstream action;
+ action << epgTimer->Action();
+ tokenContainer->AddStringToken((int)eCeMenuTimersST::action, action.str().c_str());
+ }
+
return true;
}
diff --git a/coreengine/viewdisplaychannel.c b/coreengine/viewdisplaychannel.c
index 38c444f..5a6bb68 100644
--- a/coreengine/viewdisplaychannel.c
+++ b/coreengine/viewdisplaychannel.c
@@ -68,6 +68,7 @@ void cViewChannel::SetViewElementObjects(void) {
else if (dynamic_cast<cVeDcEpgInfo*>(viewElements[i]))
{
veEpgInfo = dynamic_cast<cVeDcEpgInfo*>(viewElements[i]);
+ veEpgInfo->SetGlobalTimers(&globalTimers);
}
else if (dynamic_cast<cVeDcProgressBar*>(viewElements[i]))
{
@@ -76,6 +77,7 @@ void cViewChannel::SetViewElementObjects(void) {
else if (dynamic_cast<cVeDcStatusInfo*>(viewElements[i]))
{
veStatusInfo = dynamic_cast<cVeDcStatusInfo*>(viewElements[i]);
+ veStatusInfo->SetGlobalTimers(&globalTimers);
}
else if (dynamic_cast<cVeDcScraperContent*>(viewElements[i]))
{
@@ -102,6 +104,7 @@ void cViewChannel::ClearVariables(void) {
displayChannelGroups = false;
if (veCustomTokens)
veCustomTokens->Reset();
+ globalTimers.ClearTimers();
}
void cViewChannel::SetChannel(const cChannel *channel, int number) {
@@ -141,6 +144,9 @@ void cViewChannel::SetChannel(const cChannel *channel, int number) {
}
void cViewChannel::SetEvents(const cEvent *present, const cEvent *following) {
+ if (init) {
+ globalTimers.LoadTimers();
+ }
Clear((int)eVeDisplayChannel::epginfo);
Clear((int)eVeDisplayChannel::progressbar);
Clear((int)eVeDisplayChannel::scrapercontent);
diff --git a/coreengine/viewdisplaychannel.h b/coreengine/viewdisplaychannel.h
index 2170e40..e05217e 100644
--- a/coreengine/viewdisplaychannel.h
+++ b/coreengine/viewdisplaychannel.h
@@ -2,6 +2,7 @@
#define __VIEWDISPLAYCHANNEL_H
#include "view.h"
+#include "../extensions/globaltimers.h"
class cViewChannel : public cView {
private:
@@ -16,6 +17,7 @@ private:
cVeDcEcmInfo *veEcmInfo;
bool channelChange;
bool displayChannelGroups;
+ cGlobalTimers globalTimers;
void SetViewElements(void);
void ClearVariables(void);
void SetViewElementObjects(void);
diff --git a/coreengine/viewelementsdisplaychannel.c b/coreengine/viewelementsdisplaychannel.c
index 3384a53..875a588 100644
--- a/coreengine/viewelementsdisplaychannel.c
+++ b/coreengine/viewelementsdisplaychannel.c
@@ -1,7 +1,6 @@
#include "viewelementsdisplaychannel.h"
#include "../config.h"
#include "../extensions/helpers.h"
-#include "../extensions/timers.h"
#include "../services/scraper2vdr.h"
/******************************************************************
@@ -111,6 +110,7 @@ const char *cVeDcChannelGroup::GetChannelSep(const cChannel *c, bool prev) {
* cVeDcEpgInfo
******************************************************************/
cVeDcEpgInfo::cVeDcEpgInfo(void) {
+ globalTimers = NULL;
}
cVeDcEpgInfo::~cVeDcEpgInfo(void) {
@@ -176,24 +176,14 @@ void cVeDcEpgInfo::Close(void) {
bool cVeDcEpgInfo::EventHasTimer(const cEvent *e) {
if (!e) return false;
- int timerCount = 0;
- // BLOCK for LOCK_TIMERS_READ scope !!
- {
-#if defined (APIVERSNUM) && (APIVERSNUM >= 20301)
- LOCK_TIMERS_READ;
- timerCount = Timers->Count();
-#else
- timerCount = Timers.Count();
-#endif
- }
- cGlobalSortedTimers SortedTimers(timerCount); // local and remote timers
bool hasTimer = e->HasTimer();
- for (int i = 0; i < SortedTimers.Size() && !hasTimer; i++)
- if (const cTimer *Timer = SortedTimers[i])
+ for (int i = 0; i < globalTimers->Size() && !hasTimer; i++)
+ if (const cTimer *Timer = globalTimers->At(i))
if (Timer->Channel()->GetChannelID() == e->ChannelID())
if (const cEvent *timerEvent = Timer->Event())
if (e->EventID() == timerEvent->EventID())
hasTimer = true;
+
return hasTimer;
}
@@ -328,19 +318,9 @@ void cVeDcStatusInfo::Set(const cChannel *c) {
bool isDolby = c->Dpid(0);
bool isEncrypted = c->Ca();
bool isRecording = cRecordControls::Active();
- int timerCount = 0;
- // BLOCK for LOCK_TIMERS_READ scope !!
- {
-#if defined (APIVERSNUM) && (APIVERSNUM >= 20301)
- LOCK_TIMERS_READ;
- timerCount = Timers->Count();
-#else
- timerCount = Timers.Count();
-#endif
- }
- cGlobalSortedTimers SortedTimers(timerCount); // local and remote timers
- for (int i = 0; i < SortedTimers.Size() && !isRecording; i++)
- if (const cTimer *Timer = SortedTimers[i])
+
+ for (int i = 0; i < globalTimers->Size() && !isRecording; i++)
+ if (const cTimer *Timer = globalTimers->At(i))
if (Timer->Recording())
isRecording = true;
diff --git a/coreengine/viewelementsdisplaychannel.h b/coreengine/viewelementsdisplaychannel.h
index 3505201..799456d 100644
--- a/coreengine/viewelementsdisplaychannel.h
+++ b/coreengine/viewelementsdisplaychannel.h
@@ -3,6 +3,7 @@
#include "viewelement.h"
#include "../extensions/scrapmanager.h"
+#include "../extensions/globaltimers.h"
#include "../services/dvbapi.h"
/******************************************************************
@@ -33,10 +34,12 @@ public:
******************************************************************/
class cVeDcEpgInfo : public cViewElement {
private:
+ cGlobalTimers *globalTimers;
bool EventHasTimer(const cEvent *e);
public:
cVeDcEpgInfo(void);
virtual ~cVeDcEpgInfo(void);
+ void SetGlobalTimers(cGlobalTimers *globalTimers) { this->globalTimers = globalTimers; };
void SetTokenContainer(void);
void Set(const cEvent *p, const cEvent *f);
void Close(void);
@@ -63,10 +66,12 @@ public:
******************************************************************/
class cVeDcStatusInfo : public cViewElement {
private:
+ cGlobalTimers *globalTimers;
bool CheckMails(void);
public:
cVeDcStatusInfo(void);
virtual ~cVeDcStatusInfo(void);
+ void SetGlobalTimers(cGlobalTimers *globalTimers) { this->globalTimers = globalTimers; };
void SetTokenContainer(void);
void Set(const cChannel *c);
};
diff --git a/coreengine/viewelementsdisplaymenu.c b/coreengine/viewelementsdisplaymenu.c
index cd2b8fc..51349c7 100644
--- a/coreengine/viewelementsdisplaymenu.c
+++ b/coreengine/viewelementsdisplaymenu.c
@@ -1,8 +1,8 @@
#include "viewelementsdisplaymenu.h"
#include "../config.h"
#include <vdr/videodir.h>
-#include "../extensions/timers.h"
#include "../extensions/helpers.h"
+#include "../extensions/globaltimers.h"
#include <sys/sysinfo.h>
#include <fstream>
#include <iostream>
@@ -336,6 +336,7 @@ void cVeDmTimers::SetTokenContainer(void) {
tokenContainer->DefineLoopToken("{timers[channelid]}", (int)eDMTimersLT::channelid);
tokenContainer->DefineLoopToken("{timers[channellogoexists]}", (int)eDMTimersLT::channellogoexists);
tokenContainer->DefineLoopToken("{timers[isremotetimer]}", (int)eDMTimersLT::isremotetimer);
+ tokenContainer->DefineLoopToken("{timers[remotehost]}", (int)eDMTimersLT::remotehost);
tokenContainer->DefineIntToken("{numtimers}", (int)eDMTimersIT::numtimers);
tokenContainer->DefineIntToken("{numtimerconflicts}", (int)eDMTimersIT::numtimerconflicts);
tokenContainer->DefineIntToken("{timer1exists}", (int)eDMTimersIT::timer1exists);
@@ -361,21 +362,15 @@ bool cVeDmTimers::Parse(bool forced) {
if (!cViewElement::Parse(forced))
return false;
tokenContainer->Clear();
+
+ cGlobalTimers globalTimers;
+ globalTimers.LoadTimers();
+ globalTimers.SortTimers();
+ globalTimers.MarkLocalTimers();
- int timerCount = 0;
- // BLOCK for LOCK_TIMERS_READ scope !!
- {
-#if defined (APIVERSNUM) && (APIVERSNUM >= 20301)
- LOCK_TIMERS_READ;
- timerCount = Timers->Count();
-#else
- timerCount = Timers.Count();
-#endif
- }
- cGlobalSortedTimers SortedTimers(timerCount); // local and remote timers
- int numTimers = SortedTimers.Size();
+ int numTimers = globalTimers.Size();
tokenContainer->AddIntToken((int)eDMTimersIT::numtimers, numTimers);
- tokenContainer->AddIntToken((int)eDMTimersIT::numtimerconflicts, SortedTimers.NumTimerConfilicts());
+ tokenContainer->AddIntToken((int)eDMTimersIT::numtimerconflicts, globalTimers.NumTimerConfilicts());
for (int i=0; i<15; i++) {
if (i < numTimers) {
tokenContainer->AddIntToken(i+2, true);
@@ -391,8 +386,9 @@ bool cVeDmTimers::Parse(bool forced) {
for (int i = 0; i < numTimers; i++) {
if (i >=15)
break;
- const cTimer *Timer = SortedTimers[i];
- tokenContainer->AddLoopToken(timerIndex, i, (int)eDMTimersLT::isremotetimer, SortedTimers.IsRemoteTimer(i) ? "1" : "0");
+ const cTimer *Timer = globalTimers[i];
+ tokenContainer->AddLoopToken(timerIndex, i, (int)eDMTimersLT::isremotetimer, globalTimers.IsRemoteTimer(i) ? "1" : "0");
+ tokenContainer->AddLoopToken(timerIndex, i, (int)eDMTimersLT::remotehost, globalTimers.RemoteHost(i));
const cEvent *event = Timer->Event();
if (event) {
tokenContainer->AddLoopToken(timerIndex, i, (int)eDMTimersLT::title, event->Title());
@@ -434,8 +430,8 @@ bool cVeDmTimers::Parse(bool forced) {
timerDate = cString::sprintf("VPS %s", *timerDate);
}
tokenContainer->AddLoopToken(timerIndex, i, (int)eDMTimersLT::datetime, *timerDate);
- tokenContainer->AddLoopToken(timerIndex, i, (int)eDMTimersLT::isremotetimer, SortedTimers.IsRemoteTimer(i) ? "1" : "0");
}
+
SetDirty();
return true;
}
@@ -893,20 +889,12 @@ bool cVeDmLastrecordings::Parse(bool forced) {
return false;
tokenContainer->Clear();
- int numTimers = 0;
- // BLOCK for LOCK_TIMERS_READ scope !!
- {
-#if defined (APIVERSNUM) && (APIVERSNUM >= 20301)
- LOCK_TIMERS_READ;
- numTimers = Timers->Count();
-#else
- numTimers = Timers.Count();
-#endif
- }
-
- cGlobalSortedTimers SortedTimers(numTimers); // local and remote timers
+
+ cGlobalTimers globalTimers;
+ globalTimers.LoadTimers();
+
//set number of timers so that it is possible to adapt this viewelement accordingly
- tokenContainer->AddIntToken((int)eDMLastrecordingsIT::numtimers, SortedTimers.Size());
+ tokenContainer->AddIntToken((int)eDMLastrecordingsIT::numtimers, globalTimers.Size());
list<const cRecording*> orderedRecs;
@@ -980,6 +968,7 @@ bool cVeDmLastrecordings::Parse(bool forced) {
if (i == MAX_RECORDINGS)
break;
}
+
SetDirty();
return true;
}