summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Neumann <fnu@yavdr.org>2017-05-12 15:18:58 +0200
committerFrank Neumann <fnu@yavdr.org>2017-05-12 15:18:58 +0200
commit1b9fb08a555d89a3b9ec9739f2b17563afb43572 (patch)
treed01be17d0bd17336f74c92fdef94212ed33a6121
parent8ede45905dde9f4109f3d4f0d2e8cedc7beee01c (diff)
downloadvdr-plugin-epgsearch-1b9fb08a555d89a3b9ec9739f2b17563afb43572.tar.gz
vdr-plugin-epgsearch-1b9fb08a555d89a3b9ec9739f2b17563afb43572.tar.bz2
0002-removed-variableduplications.diff (thx TomJoad@vdr-portal.de)
-rw-r--r--HISTORY1
-rw-r--r--HISTORY.DE1
-rw-r--r--blacklist.c44
-rw-r--r--changrp.c33
-rw-r--r--conflictcheck.c16
-rw-r--r--epgsearch.c20
-rw-r--r--epgsearchext.c52
-rw-r--r--epgsearchsvdrp.c16
-rw-r--r--epgsearchtools.c8
-rw-r--r--epgsearchtools.h2
-rw-r--r--mail.c18
-rw-r--r--pending_notifications.c3
-rw-r--r--recdone.c6
-rw-r--r--recstatus.c14
-rw-r--r--services.c6
-rw-r--r--switchtimer.c8
-rw-r--r--switchtimer_thread.c3
-rw-r--r--templatefile.c5
-rw-r--r--timerdone.c8
-rw-r--r--uservars.h17
20 files changed, 118 insertions, 163 deletions
diff --git a/HISTORY b/HISTORY
index 82f793f..655a6a0 100644
--- a/HISTORY
+++ b/HISTORY
@@ -24,6 +24,7 @@ new:
http://www.vdr-portal.de/board17-developer/board21-vdr-plugins/p1291452-epgsearch-f%C3%BCr-vdr-2-3-x/#post1291452
- Drop legacy code prior VDR 2.3.x
- Commit 0001-fixed-unresponsive-vdr.diff by TomJoad@vdr-portal.de
+- Commit 0002-removed-variableduplications.diff by TomJoad@vdr-portal.de
http://www.vdr-portal.de/board17-developer/board21-vdr-plugins/p1291771-epgsearch-f%C3%BCr-vdr-2-3-x/#post1291771
2013-03-xx; Version 1.0.1 - maintenance release
diff --git a/HISTORY.DE b/HISTORY.DE
index 40653ec..565989d 100644
--- a/HISTORY.DE
+++ b/HISTORY.DE
@@ -24,6 +24,7 @@ neu:
http://www.vdr-portal.de/board17-developer/board21-vdr-plugins/p1291452-epgsearch-f%C3%BCr-vdr-2-3-x/#post1291452
- Löschen Alt-Code vor VDR 2.3.x
- Anwenden 0001-fixed-unresponsive-vdr.diff von TomJoad@vdr-portal.de
+- Anwenden 0002-removed-variableduplications.diff von TomJoad@vdr-portal.de
http://www.vdr-portal.de/board17-developer/board21-vdr-plugins/p1291771-epgsearch-f%C3%BCr-vdr-2-3-x/#post1291771
2013-03-xx: Version 1.0.1 - Maintenance Release
diff --git a/blacklist.c b/blacklist.c
index f1d6f7e..9d18199 100644
--- a/blacklist.c
+++ b/blacklist.c
@@ -47,10 +47,11 @@ cBlacklist::cBlacklist(void)
startTime = 0000;
stopTime = 2359;
useChannel = false;
+ {
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- channelMin = vdrchannels->GetByNumber(cDevice::CurrentChannel());
- channelMax = vdrchannels->GetByNumber(cDevice::CurrentChannel());
+ channelMin = Channels->GetByNumber(cDevice::CurrentChannel());
+ channelMax = Channels->GetByNumber(cDevice::CurrentChannel());
+ }
channelGroup = NULL;
useCase = false;
mode = 0;
@@ -334,8 +335,7 @@ bool cBlacklist::Parse(const char *s)
int channels = sscanf(value, "%m[^|]|%m[^|]", &channelMinbuffer, &channelMaxbuffer);
#endif
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- channelMin = vdrchannels->GetByChannelID(tChannelID::FromString(channelMinbuffer), true, true);
+ channelMin = Channels->GetByChannelID(tChannelID::FromString(channelMinbuffer), true, true);
if (!channelMin)
{
LogFile.eSysLog("ERROR: channel %s not defined", channelMinbuffer);
@@ -346,7 +346,7 @@ bool cBlacklist::Parse(const char *s)
channelMax = channelMin;
else
{
- channelMax = vdrchannels->GetByChannelID(tChannelID::FromString(channelMaxbuffer), true, true);
+ channelMax = Channels->GetByChannelID(tChannelID::FromString(channelMaxbuffer), true, true);
if (!channelMax)
{
LogFile.eSysLog("ERROR: channel %s not defined", channelMaxbuffer);
@@ -516,15 +516,15 @@ bool cBlacklist::Save(FILE *f)
return fprintf(f, "%s\n", ToText()) > 0;
}
-const cEvent * cBlacklist::GetEventByBlacklist(const cSchedule *schedules, const cEvent *Start, int MarginStop)
+const cEvent * cBlacklist::GetEventByBlacklist(const cSchedule *schedule, const cEvent *Start, int MarginStop)
{
const cEvent *pe = NULL;
const cEvent *p1 = NULL;
if (Start)
- p1 = schedules->Events()->Next(Start);
+ p1 = schedule->Events()->Next(Start);
else
- p1 = schedules->Events()->First();
+ p1 = schedule->Events()->First();
time_t tNow=time(NULL);
char* szTest = NULL;
@@ -549,7 +549,7 @@ const cEvent * cBlacklist::GetEventByBlacklist(const cSchedule *schedules, const
maxSearchDuration = maxDuration/100*60 + maxDuration%100;
}
- for (const cEvent *p = p1; p; p = schedules->Events()->Next(p))
+ for (const cEvent *p = p1; p; p = schedule->Events()->Next(p))
{
if(!p)
{
@@ -637,23 +637,20 @@ cSearchResults* cBlacklist::Run(cSearchResults* pSearchResults, int MarginStop)
{
LogFile.Log(3,"start search for blacklist '%s'", search);
- const cSchedules *schedules;
- LOCK_SCHEDULES_READ;
- schedules = Schedules;
- if(!schedules) {
+ LOCK_SCHEDULES_WRITE;
+ if(!Schedules) {
LogFile.Log(1,"schedules are currently locked! try again later.");
return NULL;
}
- const cSchedule *Schedule = schedules->First();
+ const cSchedule *Schedule = Schedules->First();
while (Schedule) {
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel* channel = vdrchannels->GetByChannelID(Schedule->ChannelID(),true,true);
+ const cChannel* channel = Channels->GetByChannelID(Schedule->ChannelID(),true,true);
if (!channel)
{
- Schedule = (const cSchedule *)schedules->Next(Schedule);
+ Schedule = (const cSchedule *)Schedules->Next(Schedule);
continue;
}
@@ -661,7 +658,7 @@ cSearchResults* cBlacklist::Run(cSearchResults* pSearchResults, int MarginStop)
{
if (channelMin->Number() > channel->Number() || channelMax->Number() < channel->Number())
{
- Schedule = (const cSchedule *)schedules->Next(Schedule);
+ Schedule = (const cSchedule *)Schedules->Next(Schedule);
continue;
}
}
@@ -670,7 +667,7 @@ cSearchResults* cBlacklist::Run(cSearchResults* pSearchResults, int MarginStop)
cChannelGroup* group = ChannelGroups.GetGroupByName(channelGroup);
if (!group || !group->ChannelInGroup(channel))
{
- Schedule = (const cSchedule *)schedules->Next(Schedule);
+ Schedule = (const cSchedule *)Schedules->Next(Schedule);
continue;
}
}
@@ -679,7 +676,7 @@ cSearchResults* cBlacklist::Run(cSearchResults* pSearchResults, int MarginStop)
{
if (channel->Ca() >= CA_ENCRYPTED_MIN)
{
- Schedule = (const cSchedule *)schedules->Next(Schedule);
+ Schedule = (const cSchedule *)Schedules->Next(Schedule);
continue;
}
}
@@ -689,14 +686,13 @@ cSearchResults* cBlacklist::Run(cSearchResults* pSearchResults, int MarginStop)
const cEvent* event = GetEventByBlacklist(Schedule, pPrevEvent, MarginStop);
pPrevEvent = event;
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- if (event && vdrchannels->GetByChannelID(event->ChannelID(),true,true))
+ if (event && Channels->GetByChannelID(event->ChannelID(),true,true))
{
if (!pSearchResults) pSearchResults = new cSearchResults;
pSearchResults->Add(new cSearchResult(event, this));
}
} while(pPrevEvent);
- Schedule = (const cSchedule *)schedules->Next(Schedule);
+ Schedule = (const cSchedule *)Schedules->Next(Schedule);
}
LogFile.Log(3,"found %d event(s) for blacklist '%s'", pSearchResults?pSearchResults->Count():0, search);
diff --git a/changrp.c b/changrp.c
index 0699b15..7d74a8b 100644
--- a/changrp.c
+++ b/changrp.c
@@ -83,8 +83,7 @@ bool cChannelGroup::Parse(const char *s)
if (numChannels == 1)
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel* channel = vdrchannels->GetByChannelID(tChannelID::FromString(channelbuffer), true, true);
+ const cChannel* channel = Channels->GetByChannelID(tChannelID::FromString(channelbuffer), true, true);
if (channel)
{
cChannelGroupItem* channelitem = new cChannelGroupItem(channel);
@@ -132,15 +131,14 @@ const char *cChannelGroup::ToText(void)
int* cChannelGroup::CreateChannelSel()
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- int* channelSel = (int*) malloc(vdrchannels->Count() * sizeof(int));
- const cChannel* channel = vdrchannels->First();
+ int* channelSel = (int*) malloc(Channels->Count() * sizeof(int));
+ const cChannel* channel = Channels->First();
int index = 0;
while (channel)
{
if (channel->GroupSep())
{
- channel = vdrchannels->Next(channel);
+ channel = Channels->Next(channel);
continue;
}
channelSel[index] = 0;
@@ -155,7 +153,7 @@ int* cChannelGroup::CreateChannelSel()
channelInGroup = channels.Next(channelInGroup);
}
index++;
- channel = vdrchannels->Next(channel);
+ channel = Channels->Next(channel);
}
return channelSel;
}
@@ -164,8 +162,7 @@ void cChannelGroup::CreateChannelList(int* channelSel)
{
channels.Clear();
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel* channel = vdrchannels->First();
+ const cChannel* channel = Channels->First();
int index = 0;
while (channel)
{
@@ -175,7 +172,7 @@ void cChannelGroup::CreateChannelList(int* channelSel)
channels.Add(new cChannelGroupItem(channel));
index++;
}
- channel = vdrchannels->Next(channel);
+ channel = Channels->Next(channel);
}
}
@@ -434,19 +431,18 @@ void cMenuEditChannelGroup::Set()
Clear();
Add(new cMenuEditStrItem( tr("Group name"), name, sizeof(group->name), trVDR(FileNameChars)));
- LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel* channel = vdrchannels->First();
+ LOCK_CHANNELS_READ; // TODO THIS MAY LOCK Channels A LONG TIME!
+ const cChannel* channel = Channels->First();
int index = 0;
while (channel)
{
if (channel->GroupSep())
{
- channel = vdrchannels->Next(channel);
+ channel = Channels->Next(channel);
continue;
}
Add(new cMenuEditBoolItem( CHANNELNAME(channel), &channelSel[index++], trVDR("no"), trVDR("yes")));
- channel = vdrchannels->Next(channel);
+ channel = Channels->Next(channel);
}
SetCurrent(Get(current));
@@ -512,20 +508,19 @@ eOSState cMenuEditChannelGroup::ProcessKey(eKeys Key)
case kYellow:
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel* channel = vdrchannels->First();
+ const cChannel* channel = Channels->First();
int index = 0;
while (channel)
{
if (channel->GroupSep())
{
- channel = vdrchannels->Next(channel);
+ channel = Channels->Next(channel);
continue;
}
channelSel[index] = (Key == kGreen?1:(Key == kRed?1-channelSel[index]:0));
index++;
- channel = vdrchannels->Next(channel);
+ channel = Channels->Next(channel);
}
Set();
Display();
diff --git a/conflictcheck.c b/conflictcheck.c
index 71ca586..ab88ecc 100644
--- a/conflictcheck.c
+++ b/conflictcheck.c
@@ -74,11 +74,10 @@ const cEvent* cConflictCheckTimerObj::Event()
const cEvent* cConflictCheckTimerObj::SetEventFromSchedule()
{
LOCK_SCHEDULES_READ;
- const cSchedules *schedules = Schedules;
- if (!schedules)
+ if (!Schedules)
return NULL;
- const cSchedule *Schedule = schedules->GetSchedule(timer->Channel());
+ const cSchedule *Schedule = Schedules->GetSchedule(timer->Channel());
if (Schedule && Schedule->Events()->First())
{
const cEvent *Event = NULL;
@@ -258,9 +257,8 @@ cList<cConflictCheckTimerObj>* cConflictCheck::CreateCurrentTimerList()
// collect single event timers
time_t tMax = 0;
LOCK_TIMERS_READ;
- const cTimers *vdrtimers = Timers;
const cTimer* ti = NULL;
- for (ti = vdrtimers->First(); ti; ti = vdrtimers->Next(ti))
+ for (ti = Timers->First(); ti; ti = Timers->Next(ti))
{
tMax = max(tMax, ti->StartTime());
if (ti->Remote()) continue; // TO BE DONE: remote service request CC
@@ -289,7 +287,7 @@ cList<cConflictCheckTimerObj>* cConflictCheck::CreateCurrentTimerList()
// collect repeating timers from now until the date of the timer with tMax
time_t maxCheck = time(NULL) + min(14,EPGSearchConfig.checkMaxDays) * SECSINDAY;
tMax = max(tMax, maxCheck);
- for (ti = vdrtimers->First(); ti; ti = vdrtimers->Next(ti))
+ for (ti = Timers->First(); ti; ti = Timers->Next(ti))
{
if (ti->IsSingleEvent()) continue;
time_t day = time(NULL);
@@ -680,10 +678,9 @@ bool cConflictCheck::TimerInConflict(const cTimer* timer)
if ((*it)->concurrentTimers)
{
LOCK_TIMERS_READ;
- const cTimers *vdrtimers = Timers;
for (it2 = (*it)->concurrentTimers->begin(); it2 != (*it)->concurrentTimers->end(); ++it2)
{
- if ((*it2)->OrigTimer(vdrtimers) == timer)
+ if ((*it2)->OrigTimer(Timers) == timer)
return true;
}
}
@@ -707,8 +704,7 @@ void cConflictCheck::EvaluateConflCheckCmd()
{
string result = EPGSearchConfig.conflCheckCmd;
LOCK_TIMERS_READ;
- const cTimers *vdrtimers = Timers;
- if (!(*it)->OrigTimer(vdrtimers))
+ if (!(*it)->OrigTimer(Timers))
{
LogFile.Log(3,"timer has disappeared meanwhile");
continue;
diff --git a/epgsearch.c b/epgsearch.c
index 4681fa3..5ca425d 100644
--- a/epgsearch.c
+++ b/epgsearch.c
@@ -161,10 +161,9 @@ bool cPluginEpgsearch::ProcessArgs(int argc, char *argv[])
if (atoi(argv[3]) > 0)
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
SearchExt->useChannel = true;
- SearchExt->channelMin = vdrchannels->GetByNumber(atoi(argv[3]));
- SearchExt->channelMax = vdrchannels->GetByNumber(atoi(argv[3]));
+ SearchExt->channelMin = Channels->GetByNumber(atoi(argv[3]));
+ SearchExt->channelMax = Channels->GetByNumber(atoi(argv[3]));
}
SearchExt->mode = atoi(argv[4]);
SearchExt->useTitle = atoi(argv[5]);
@@ -244,10 +243,9 @@ bool cPluginEpgsearch::Service(const char *Id, void *Data)
if (searchData->channelNr > 0)
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
SearchExt->useChannel = true;
- SearchExt->channelMin = vdrchannels->GetByNumber(searchData->channelNr);
- SearchExt->channelMax = vdrchannels->GetByNumber(searchData->channelNr);
+ SearchExt->channelMin = Channels->GetByNumber(searchData->channelNr);
+ SearchExt->channelMax = Channels->GetByNumber(searchData->channelNr);
}
SearchExt->mode = searchData->mode;
SearchExt->useTitle = searchData->useTitle;
@@ -341,10 +339,9 @@ bool cPluginEpgsearch::Service(const char *Id, void *Data)
if (searchData->channelNr > 0)
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
SearchExt->useChannel = true;
- SearchExt->channelMin = vdrchannels->GetByNumber(searchData->channelNr);
- SearchExt->channelMax = vdrchannels->GetByNumber(searchData->channelNr);
+ SearchExt->channelMin = Channels->GetByNumber(searchData->channelNr);
+ SearchExt->channelMax = Channels->GetByNumber(searchData->channelNr);
}
SearchExt->mode = searchData->mode;
SearchExt->useTitle = searchData->useTitle;
@@ -521,10 +518,9 @@ cOsdObject *cPluginEpgsearch::DoInitialSearch(char* rcFilename)
if (rcFile.ChannelNr != -1)
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
SearchExt->useChannel = true;
- SearchExt->channelMin = vdrchannels->GetByNumber(rcFile.ChannelNr);
- SearchExt->channelMax = vdrchannels->GetByNumber(rcFile.ChannelNr);
+ SearchExt->channelMin = Channels->GetByNumber(rcFile.ChannelNr);
+ SearchExt->channelMax = Channels->GetByNumber(rcFile.ChannelNr);
}
SearchExt->mode = rcFile.SearchMode;
SearchExt->useTitle = rcFile.UseTitle;
diff --git a/epgsearchext.c b/epgsearchext.c
index 98afd94..3a56a9e 100644
--- a/epgsearchext.c
+++ b/epgsearchext.c
@@ -58,10 +58,11 @@ cSearchExt::cSearchExt(void)
startTime = 0000;
stopTime = 2359;
useChannel = false;
+ {
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- channelMin = vdrchannels->GetByNumber(cDevice::CurrentChannel());
- channelMax = vdrchannels->GetByNumber(cDevice::CurrentChannel());
+ channelMin = Channels->GetByNumber(cDevice::CurrentChannel());
+ channelMax = Channels->GetByNumber(cDevice::CurrentChannel());
+ }
channelGroup = NULL;
useCase = false;
mode = 0;
@@ -483,8 +484,7 @@ bool cSearchExt::Parse(const char *s)
int channels = sscanf(value, "%m[^|]|%m[^|]", &channelMinbuffer, &channelMaxbuffer);
#endif
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- channelMin = vdrchannels->GetByChannelID(tChannelID::FromString(channelMinbuffer), true, true);
+ channelMin = Channels->GetByChannelID(tChannelID::FromString(channelMinbuffer), true, true);
if (!channelMin)
{
LogFile.eSysLog("ERROR: channel '%s' not defined", channelMinbuffer);
@@ -496,7 +496,7 @@ bool cSearchExt::Parse(const char *s)
channelMax = channelMin;
else
{
- channelMax = vdrchannels->GetByChannelID(tChannelID::FromString(channelMaxbuffer), true, true);
+ channelMax = Channels->GetByChannelID(tChannelID::FromString(channelMaxbuffer), true, true);
if (!channelMax)
{
LogFile.eSysLog("ERROR: channel '%s' not defined", channelMaxbuffer);
@@ -1015,12 +1015,9 @@ cSearchResults* cSearchExt::Run(int PayTVMode, bool inspectTimerMargin, int eval
{
LogFile.Log(3,"start search for search timer '%s'", search);
- const cSchedules *schedules;
LOCK_CHANNELS_READ; // Channels must be locked first
- const cChannels *vdrchannels = Channels;
LOCK_SCHEDULES_READ;
- schedules = Schedules;
- if(!schedules) {
+ if(!Schedules) {
LogFile.Log(1,"schedules are currently locked! try again later.");
return NULL;
}
@@ -1032,16 +1029,16 @@ cSearchResults* cSearchExt::Run(int PayTVMode, bool inspectTimerMargin, int eval
noPayTV = (PayTVMode == 1);
time_t tNow=time(NULL);
- const cSchedule *Schedule = schedules->First();
+ const cSchedule *Schedule = Schedules->First();
cSearchResults* pSearchResults = pPrevResults;
cSearchResults* pBlacklistResults = GetBlacklistEvents(inspectTimerMargin?MarginStop:0);
int counter = 0;
while (Schedule) {
- const cChannel* channel = vdrchannels->GetByChannelID(Schedule->ChannelID(),true,true);
+ const cChannel* channel = Channels->GetByChannelID(Schedule->ChannelID(),true,true);
if (!channel)
{
- Schedule = (const cSchedule *)schedules->Next(Schedule);
+ Schedule = (const cSchedule *)Schedules->Next(Schedule);
continue;
}
@@ -1049,7 +1046,7 @@ cSearchResults* cSearchExt::Run(int PayTVMode, bool inspectTimerMargin, int eval
{
if (channelMin->Number() > channel->Number() || channelMax->Number() < channel->Number())
{
- Schedule = (const cSchedule *)schedules->Next(Schedule);
+ Schedule = (const cSchedule *)Schedules->Next(Schedule);
continue;
}
}
@@ -1058,7 +1055,7 @@ cSearchResults* cSearchExt::Run(int PayTVMode, bool inspectTimerMargin, int eval
cChannelGroup* group = ChannelGroups.GetGroupByName(channelGroup);
if (!group || !group->ChannelInGroup(channel))
{
- Schedule = (const cSchedule *)schedules->Next(Schedule);
+ Schedule = (const cSchedule *)Schedules->Next(Schedule);
continue;
}
}
@@ -1067,7 +1064,7 @@ cSearchResults* cSearchExt::Run(int PayTVMode, bool inspectTimerMargin, int eval
{
if (channel->Ca() >= CA_ENCRYPTED_MIN)
{
- Schedule = (const cSchedule *)schedules->Next(Schedule);
+ Schedule = (const cSchedule *)Schedules->Next(Schedule);
continue;
}
}
@@ -1076,7 +1073,7 @@ cSearchResults* cSearchExt::Run(int PayTVMode, bool inspectTimerMargin, int eval
{
if (channel->Ca() >= CA_ENCRYPTED_MIN)
{
- Schedule = (const cSchedule *)schedules->Next(Schedule);
+ Schedule = (const cSchedule *)Schedules->Next(Schedule);
continue;
}
}
@@ -1090,7 +1087,7 @@ cSearchResults* cSearchExt::Run(int PayTVMode, bool inspectTimerMargin, int eval
if (tNow + evalLimitMins*60 <= event->EndTime())
break;
}
- if (event && vdrchannels->GetByChannelID(event->ChannelID(),true,true))
+ if (event && Channels->GetByChannelID(event->ChannelID(),true,true))
{
if (pBlacklistResults && pBlacklistResults->Lookup(event))
{
@@ -1102,7 +1099,7 @@ cSearchResults* cSearchExt::Run(int PayTVMode, bool inspectTimerMargin, int eval
counter++;
}
} while(pPrevEvent);
- Schedule = (const cSchedule *)schedules->Next(Schedule);
+ Schedule = (const cSchedule *)Schedules->Next(Schedule);
}
LogFile.Log(3,"found %d event(s) for search timer '%s'", counter, search);
@@ -1344,8 +1341,7 @@ bool cSearchExt::MatchesExtEPGInfo(const cEvent* e)
void cSearchExt::OnOffTimers(bool bOn)
{
LOCK_TIMERS_WRITE;
- cTimers *vdrtimers = Timers;
- for (cTimer *ti = vdrtimers->First(); ti; ti = vdrtimers->Next(ti))
+ for (cTimer *ti = Timers->First(); ti; ti = Timers->Next(ti))
{
if (((!bOn && ti->HasFlags(tfActive)) || (bOn && !ti->HasFlags(tfActive))) && TriggeredFromSearchTimerID(ti) == ID)
ti->OnOff();
@@ -1357,20 +1353,19 @@ void cSearchExt::DeleteAllTimers()
cList<cTimerObj> DelTimers;
LOCK_TIMERS_WRITE;
Timers->SetExplicitModify();
- cTimers *vdrtimers = Timers;
- cTimer *ti = vdrtimers->First();
+ cTimer *ti = Timers->First();
while(ti)
{
if (!ti->Recording() && TriggeredFromSearchTimerID(ti) == ID)
{
- cTimer* tiNext = vdrtimers->Next(ti);
+ cTimer* tiNext = Timers->Next(ti);
LogFile.iSysLog("deleting timer %s", *ti->ToDescr());
- vdrtimers->Del(ti);
- vdrtimers->SetModified();
+ Timers->Del(ti);
+ Timers->SetModified();
ti = tiNext;
}
else
- ti = vdrtimers->Next(ti);
+ ti = Timers->Next(ti);
};
}
@@ -1406,8 +1401,7 @@ int cSearchExt::GetCountRecordings()
int countRecs = 0;
LOCK_RECORDINGS_READ;
- const cRecordings *vdrrecordings = Recordings;
- for (const cRecording *recording = vdrrecordings->First(); recording; recording = vdrrecordings->Next(recording))
+ for (const cRecording *recording = Recordings->First(); recording; recording = Recordings->Next(recording))
{
if (recording->IsEdited()) continue; // ignore recordings edited
if (!recording->Info()) continue;
diff --git a/epgsearchsvdrp.c b/epgsearchsvdrp.c
index 7398b9c..2f5720e 100644
--- a/epgsearchsvdrp.c
+++ b/epgsearchsvdrp.c
@@ -563,16 +563,14 @@ cString cPluginEpgsearch::SVDRPCommand(const char *Command, const char *Option,
eTimerMatch timerMatch;
bool hasTimer = false;
LOCK_TIMERS_READ;
- const cTimers *vdrtimers = Timers;
- if (vdrtimers->GetMatch(pEvent, &timerMatch))
+ if (Timers->GetMatch(pEvent, &timerMatch))
hasTimer = (timerMatch == tmFull);
if (!result->search->useAsSearchTimer)
result->needsTimer = false;
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(pEvent->ChannelID(), true,true);
+ const cChannel *channel = Channels->GetByChannelID(pEvent->ChannelID(), true,true);
int timerMode = hasTimer?1:(result->needsTimer?2:0);
string title = pEvent->Title()?ReplaceAll(pEvent->Title(), "|", "!^pipe!^"):"";
@@ -1048,8 +1046,7 @@ cString cPluginEpgsearch::SVDRPCommand(const char *Command, const char *Option,
return cString::sprintf("invalid channel id");
}
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *ch = vdrchannels->GetByChannelID(chID,true,true);
+ const cChannel *ch = Channels->GetByChannelID(chID,true,true);
if (!ch)
{
ReplyCode = 901;
@@ -1060,13 +1057,12 @@ cString cPluginEpgsearch::SVDRPCommand(const char *Command, const char *Option,
else
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
string sBuffer;
- for (int i = 0; i < vdrchannels->Count(); i++)
+ for (int i = 0; i < Channels->Count(); i++)
{
- const cChannel* ch = vdrchannels->Get(i);
+ const cChannel* ch = Channels->Get(i);
if (ch && !ch->GroupSep())
- sBuffer += string(*ch->GetChannelID().ToString()) + string(": ") + NumToString(DefTimerCheckModes.GetMode(ch)) + string((i<vdrchannels->Count()-1)?"\n":"");
+ sBuffer += string(*ch->GetChannelID().ToString()) + string(": ") + NumToString(DefTimerCheckModes.GetMode(ch)) + string((i<Channels->Count()-1)?"\n":"");
}
return sBuffer.c_str();
}
diff --git a/epgsearchtools.c b/epgsearchtools.c
index f3c9ae3..50a6e32 100644
--- a/epgsearchtools.c
+++ b/epgsearchtools.c
@@ -528,9 +528,8 @@ const cEvent* GetEvent(const cTimer* timer)
{
{
LOCK_SCHEDULES_READ;
- const cSchedules *schedules = Schedules;
- if (schedules) {
- const cSchedule *Schedule = schedules->GetSchedule(channel->GetChannelID());
+ if (Schedules) {
+ const cSchedule *Schedule = Schedules->GetSchedule(channel->GetChannelID());
if (Schedule) {
event = Schedule->GetEventAround(Time);
if (event) return event;
@@ -710,8 +709,7 @@ int ChannelNrFromEvent(const cEvent* pEvent)
if (!pEvent)
return -1;
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel* channel = vdrchannels->GetByChannelID(pEvent->ChannelID(), true, true);
+ const cChannel* channel = Channels->GetByChannelID(pEvent->ChannelID(), true, true);
if (!channel)
return -1;
else
diff --git a/epgsearchtools.h b/epgsearchtools.h
index ab63b75..9b80473 100644
--- a/epgsearchtools.h
+++ b/epgsearchtools.h
@@ -66,7 +66,7 @@ using std::string;
#undef CONFIGDIR
#define CONFIGDIR (!ConfigDir?cPlugin::ConfigDirectory():ConfigDir)
-#define CHNUMWIDTH (numdigits(vdrchannels->MaxNumber()) + 2)
+#define CHNUMWIDTH (numdigits(Channels->MaxNumber()) + 2)
#define SHORTTEXT(EVENT) \
(EVENT && EPGSearchConfig.showShortText && !isempty((EVENT)->ShortText()))?" ~ ":"", \
diff --git a/mail.c b/mail.c
index 37308f7..a5f815c 100644
--- a/mail.c
+++ b/mail.c
@@ -51,8 +51,7 @@ string cMailTimerNotification::Format(const string& templ) const
eTimerMatch TimerMatch = tmNone;
LOCK_TIMERS_READ;
- const cTimers *vdrtimers = Timers;
- const cTimer* pTimer = vdrtimers->GetMatch(pEvent, &TimerMatch);
+ const cTimer* pTimer = Timers->GetMatch(pEvent, &TimerMatch);
if (!pTimer) return "";
string result = templ;
@@ -73,9 +72,8 @@ string cMailTimerNotification::Format(const string& templ) const
const cEvent* cMailTimerNotification::GetEvent() const
{
LOCK_SCHEDULES_READ;
- const cSchedules *schedules = Schedules;
- if (!schedules) return NULL;
- const cSchedule *schedule = schedules->GetSchedule(channelID);
+ if (!Schedules) return NULL;
+ const cSchedule *schedule = Schedules->GetSchedule(channelID);
if (!schedule) return NULL;
return schedule->GetEvent(eventID);
}
@@ -83,9 +81,8 @@ const cEvent* cMailTimerNotification::GetEvent() const
bool cMailTimerNotification::operator< (const cMailTimerNotification &N) const
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel* channel = vdrchannels->GetByChannelID(channelID,true,true);
- const cChannel* channelOther = vdrchannels->GetByChannelID(N.channelID,true,true);
+ const cChannel* channel = Channels->GetByChannelID(channelID,true,true);
+ const cChannel* channelOther = Channels->GetByChannelID(N.channelID,true,true);
if (!channel || !channelOther)
return false;
const cEvent* event = GetEvent();
@@ -126,9 +123,8 @@ cMailDelTimerNotification::cMailDelTimerNotification(const string& Formatted, tC
bool cMailDelTimerNotification::operator< (const cMailDelTimerNotification &N) const
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel* channel = vdrchannels->GetByChannelID(channelID,true,true);
- const cChannel* channelOther = vdrchannels->GetByChannelID(N.channelID,true,true);
+ const cChannel* channel = Channels->GetByChannelID(channelID,true,true);
+ const cChannel* channelOther = Channels->GetByChannelID(N.channelID,true,true);
if (!channel || !channelOther)
return false;
if (channel != channelOther)
diff --git a/pending_notifications.c b/pending_notifications.c
index 4f6955d..2702d1f 100644
--- a/pending_notifications.c
+++ b/pending_notifications.c
@@ -122,8 +122,7 @@ const char *cPendingNotification::ToText(void) const
buffer = NULL;
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(channelID, true, true);
+ const cChannel *channel = Channels->GetByChannelID(channelID, true, true);
if (!channel)
LogFile.Log(3,"invalid channel in pending notifications!");
diff --git a/recdone.c b/recdone.c
index 1b57926..f40922d 100644
--- a/recdone.c
+++ b/recdone.c
@@ -201,8 +201,7 @@ const char *cRecDone::ToText(void)
buffer = NULL;
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(channelID, true, true);
+ const cChannel *channel = Channels->GetByChannelID(channelID, true, true);
if (!channel)
LogFile.Log(3,"invalid channel in recs done!");
@@ -229,8 +228,7 @@ bool cRecDone::Save(FILE *f)
int cRecDone::ChannelNr()
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel* channel = vdrchannels->GetByChannelID(channelID, true, true);
+ const cChannel* channel = Channels->GetByChannelID(channelID, true, true);
if (!channel)
return -1;
else
diff --git a/recstatus.c b/recstatus.c
index c53888f..794ba27 100644
--- a/recstatus.c
+++ b/recstatus.c
@@ -49,8 +49,7 @@ void cRecStatusMonitor::Recording(const cDevice *Device, const char *Name, const
cConflictCheckThread::Init((cPluginEpgsearch*)cPluginManager::GetPlugin("epgsearch"), true);
LOCK_TIMERS_READ;
- const cTimers *vdrtimers = Timers;
- for (const cTimer *ti = vdrtimers->First(); ti; ti = vdrtimers->Next(ti))
+ for (const cTimer *ti = Timers->First(); ti; ti = Timers->Next(ti))
if (ti->Recording())
{
// check if this is a new entry
@@ -116,8 +115,7 @@ void cRecStatusMonitor::Recording(const cDevice *Device, const char *Name, const
bool found = false;
LOCK_TIMERS_READ;
- const cTimers *vdrtimers = Timers;
- for (const cTimer *ti = vdrtimers->First(); ti; ti = vdrtimers->Next(ti))
+ for (const cTimer *ti = Timers->First(); ti; ti = Timers->Next(ti))
if (ti == tiR->timer)
{
found = true;
@@ -134,9 +132,11 @@ void cRecStatusMonitor::Recording(const cDevice *Device, const char *Name, const
// check if recording has ended before timer end
bool complete = true;
- LOCK_RECORDINGS_READ;
- const cRecordings *vdrrecordings = Recordings;
- const cRecording *pRecording = vdrrecordings->GetByName(Filename);
+ const cRecording *pRecording;
+ {
+ LOCK_RECORDINGS_READ;
+ pRecording = Recordings->GetByName(Filename);
+ }
long timerLengthSecs = tiR->timer->StopTime()-tiR->timer->StartTime();
int recFraction = 100;
if (pRecording && timerLengthSecs)
diff --git a/services.c b/services.c
index 02b9934..6e5f9c4 100644
--- a/services.c
+++ b/services.c
@@ -146,16 +146,14 @@ std::list<std::string> cEpgsearchServiceHandler::TranslateResults(cSearchResults
eTimerMatch timerMatch;
bool hasTimer = false;
LOCK_TIMERS_READ;
- const cTimers *vdrtimers = Timers;
- if (vdrtimers->GetMatch(pEvent, &timerMatch))
+ if (Timers->GetMatch(pEvent, &timerMatch))
hasTimer = (timerMatch == tmFull);
if (!result->search->useAsSearchTimer)
result->needsTimer = false;
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(pEvent->ChannelID(), true, true);
+ const cChannel *channel = Channels->GetByChannelID(pEvent->ChannelID(), true, true);
int timerMode = hasTimer?1:(result->needsTimer?2:0);
std::string title = pEvent->Title()?ReplaceAll(pEvent->Title(), "|", "!^pipe!^"):"";
diff --git a/switchtimer.c b/switchtimer.c
index 7df4352..af0c721 100644
--- a/switchtimer.c
+++ b/switchtimer.c
@@ -115,9 +115,8 @@ const cEvent* cSwitchTimer::Event()
if (startTime > now)
{
LOCK_SCHEDULES_READ;
- const cSchedules *schedules = Schedules;
- if (!schedules) return NULL;
- const cSchedule *Schedule = schedules->GetSchedule(channelID);
+ if (!Schedules) return NULL;
+ const cSchedule *Schedule = Schedules->GetSchedule(channelID);
if (Schedule)
{
event = Schedule->GetEvent(eventID, startTime);
@@ -137,8 +136,7 @@ cString cSwitchTimer::ToText(bool& ignore)
return NULL;
}
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(channelID, true, true);
+ const cChannel *channel = Channels->GetByChannelID(channelID, true, true);
if (!channel) return NULL;
cString buffer = cString::sprintf("%s:%u:%ld:%d:%d:%d",
CHANNELSTRING(channel), eventID,
diff --git a/switchtimer_thread.c b/switchtimer_thread.c
index 9da5421..be1c12a 100644
--- a/switchtimer_thread.c
+++ b/switchtimer_thread.c
@@ -89,8 +89,7 @@ void cSwitchTimerThread::Action(void)
if (switchTimer->startTime - now < switchTimer->switchMinsBefore*60 + MSG_DELAY + 1)
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(switchTimer->channelID, true, true);
+ const cChannel *channel = Channels->GetByChannelID(switchTimer->channelID, true, true);
bool doSwitch = (switchTimer->mode == 0);
bool doAsk = (switchTimer->mode == 2);
bool doUnmute = switchTimer->unmute;
diff --git a/templatefile.c b/templatefile.c
index 830548b..a2536f5 100644
--- a/templatefile.c
+++ b/templatefile.c
@@ -210,9 +210,10 @@ bool cTemplFile::Parse(const char *Name, const char *Value)
void cTemplFile::PrepareDefaultTemplates()
{
char channelnr[20] = "";
- LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
+ {
+ LOCK_CHANNELS_READ; // Channels used in CHNUMWIDTH
sprintf(channelnr, "%%chnr%%:%d|", CHNUMWIDTH);
+ }
bool text2skin = !(strcmp(Setup.OSDSkin, "soppalusikka") == 0 ||
strcmp(Setup.OSDSkin, "classic") == 0 ||
diff --git a/timerdone.c b/timerdone.c
index 34d3b97..0940225 100644
--- a/timerdone.c
+++ b/timerdone.c
@@ -127,8 +127,7 @@ bool cTimerDone::Parse(const char *s)
cString cTimerDone::ToText(void) const
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(channelID, true, true);
+ const cChannel *channel = Channels->GetByChannelID(channelID, true, true);
string info = string(DAYDATETIME(start)) + " - " + string(channel?channel->Name():"");
cString buffer = cString::sprintf("%s:%ld:%ld:%d:%s:%s:%s",
@@ -150,9 +149,8 @@ bool cTimerDone::Save(FILE *f)
const cEvent* cTimerDone::GetEvent() const
{
LOCK_SCHEDULES_READ;
- const cSchedules *schedules = Schedules;
- if (!schedules) return NULL;
- const cSchedule *Schedule = schedules->GetSchedule(channelID);
+ if (!Schedules) return NULL;
+ const cSchedule *Schedule = Schedules->GetSchedule(channelID);
if (!Schedule) return NULL;
const cEvent* Event = Schedule->GetEventAround(start + (stop - start)/2);
return Event;
diff --git a/uservars.h b/uservars.h
index f19ea06..546a816 100644
--- a/uservars.h
+++ b/uservars.h
@@ -177,8 +177,7 @@ public:
{
if (!e) return "";
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(e->ChannelID(), true);
+ const cChannel *channel = Channels->GetByChannelID(e->ChannelID(), true);
if (!channel) return "";
string res(channel->GetChannelID().ToString());
@@ -418,8 +417,7 @@ public:
{
if (!e) return "";
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(e->ChannelID(), true);
+ const cChannel *channel = Channels->GetByChannelID(e->ChannelID(), true);
string res = channel?channel->ShortName(true):"";
if (escapeStrings) return "'" + EscapeString(res) + "'"; else return res;
}
@@ -432,8 +430,7 @@ public:
{
if (!e) return "";
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(e->ChannelID(), true);
+ const cChannel *channel = Channels->GetByChannelID(e->ChannelID(), true);
string res = channel?channel->Name():"";
if (escapeStrings) return "'" + EscapeString(res) + "'"; else return res;
}
@@ -446,8 +443,7 @@ class cChannelDataVar : public cInternalVar {
{
if (!e) return "";
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(e->ChannelID(), true);
+ const cChannel *channel = Channels->GetByChannelID(e->ChannelID(), true);
return channel?CHANNELSTRING(channel):"";
}
};
@@ -460,10 +456,9 @@ public:
if (!e) return "";
ostringstream os;
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(e->ChannelID(), true);
+ const cChannel *channel = Channels->GetByChannelID(e->ChannelID(), true);
while(channel && !channel->GroupSep())
- channel = vdrchannels->Prev(channel);
+ channel = Channels->Prev(channel);
if (!channel || !channel->Name()) return "";
string grpName = channel->Name();
if (escapeStrings) return "'" + EscapeString(grpName) + "'"; else return grpName;