summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Neumann <fnu@yavdr.org>2017-05-12 15:21:03 +0200
committerFrank Neumann <fnu@yavdr.org>2017-05-12 15:21:03 +0200
commit5bc9ebbb9a64f9c835528b821d040e6a7c067a4b (patch)
treee8320c367e84518919453184eaa1b1d6990d635b
parent1b9fb08a555d89a3b9ec9739f2b17563afb43572 (diff)
downloadvdr-plugin-epgsearch-5bc9ebbb9a64f9c835528b821d040e6a7c067a4b.tar.gz
vdr-plugin-epgsearch-5bc9ebbb9a64f9c835528b821d040e6a7c067a4b.tar.bz2
0003-more-cleanups.diff (thx TomJoad@vdr-portal.de)
-rw-r--r--HISTORY1
-rw-r--r--HISTORY.DE1
-rw-r--r--epgsearchext.c5
-rw-r--r--epgsearchext.h2
-rw-r--r--menu_blacklistedit.c5
-rw-r--r--menu_commands.c23
-rw-r--r--menu_conflictcheck.c34
-rw-r--r--menu_deftimercheckmethod.c8
-rw-r--r--menu_dirselect.c12
-rw-r--r--menu_event.c15
-rw-r--r--menu_favorites.c3
-rw-r--r--menu_main.c49
-rw-r--r--menu_myedittimer.c32
-rw-r--r--menu_quicksearch.c5
-rw-r--r--menu_searchedit.c5
-rw-r--r--menu_searchresults.c47
-rw-r--r--menu_searchresults.h4
-rw-r--r--menu_switchtimers.c3
-rw-r--r--menu_templateedit.c5
-rw-r--r--menu_timersdone.c3
-rw-r--r--menu_whatson.c4
-rw-r--r--searchtimer_thread.c8
22 files changed, 119 insertions, 155 deletions
diff --git a/HISTORY b/HISTORY
index 655a6a0..4888d4f 100644
--- a/HISTORY
+++ b/HISTORY
@@ -25,6 +25,7 @@ new:
- 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
+- Commit 0003-more-cleanups.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 565989d..0bb6d67 100644
--- a/HISTORY.DE
+++ b/HISTORY.DE
@@ -25,6 +25,7 @@ neu:
- 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
+- Anwenden 0003-more-cleanups.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/epgsearchext.c b/epgsearchext.c
index 3a56a9e..06d7c3d 100644
--- a/epgsearchext.c
+++ b/epgsearchext.c
@@ -1369,12 +1369,13 @@ void cSearchExt::DeleteAllTimers()
};
}
-cTimerObjList* cSearchExt::GetTimerList(const cTimers* vdrtimers, cTimerObjList* timerList)
+cTimerObjList* cSearchExt::GetTimerList(cTimerObjList* timerList)
{
if (!timerList)
timerList = new cTimerObjList;
- for (const cTimer *ti = vdrtimers->First(); ti; ti = vdrtimers->Next(ti))
+ LOCK_TIMERS_READ;
+ for (const cTimer *ti = Timers->First(); ti; ti = Timers->Next(ti))
{
if (TriggeredFromSearchTimerID(ti) == ID)
{
diff --git a/epgsearchext.h b/epgsearchext.h
index 1177817..50758f5 100644
--- a/epgsearchext.h
+++ b/epgsearchext.h
@@ -200,7 +200,7 @@ public:
cSearchResults* GetBlacklistEvents(int MarginStop = 0);
void OnOffTimers(bool);
void DeleteAllTimers();
- cTimerObjList* GetTimerList(const cTimers* vdrtimers, cTimerObjList* timerList);
+ cTimerObjList* GetTimerList(cTimerObjList* timerList);
int GetCountRecordings();
bool IsActiveAt(time_t t);
bool HasContent(int contentID);
diff --git a/menu_blacklistedit.c b/menu_blacklistedit.c
index ad5a449..4db0815 100644
--- a/menu_blacklistedit.c
+++ b/menu_blacklistedit.c
@@ -350,8 +350,7 @@ eOSState cMenuBlacklistEdit::ProcessKey(eKeys Key)
if (data.useChannel==1)
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *ch = vdrchannels->GetByNumber(channelMin);
+ const cChannel *ch = Channels->GetByNumber(channelMin);
if (ch)
data.channelMin = ch;
else
@@ -359,7 +358,7 @@ eOSState cMenuBlacklistEdit::ProcessKey(eKeys Key)
ERROR(tr("*** Invalid Channel ***"));
break;
}
- ch = vdrchannels->GetByNumber(channelMax);
+ ch = Channels->GetByNumber(channelMax);
if (ch)
data.channelMax = ch;
else
diff --git a/menu_commands.c b/menu_commands.c
index 6e97a35..b1ed8db 100644
--- a/menu_commands.c
+++ b/menu_commands.c
@@ -101,8 +101,7 @@ void cMenuSearchCommands::LoadCommands()
eOSState cMenuSearchCommands::Switch(void)
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(event->ChannelID(), true, true);
+ const cChannel *channel = Channels->GetByChannelID(event->ChannelID(), true, true);
if (channel && cDevice::PrimaryDevice()->SwitchChannel(channel, true))
return osEnd;
else
@@ -124,8 +123,7 @@ eOSState cMenuSearchCommands::Record(void)
eTimerMatch timerMatch = tmNone;
LOCK_TIMERS_WRITE;
Timers->SetExplicitModify();
- cTimers *vdrtimers = Timers;
- cTimer* timer = vdrtimers->GetMatch(event, &timerMatch);
+ cTimer* timer = Timers->GetMatch(event, &timerMatch);
if (timerMatch == tmFull)
{
if (EPGSearchConfig.useVDRTimerEditMenu)
@@ -136,7 +134,7 @@ eOSState cMenuSearchCommands::Record(void)
timer = new cTimer(event);
PrepareTimerFile(event, timer);
- cTimer *t = vdrtimers->GetTimer(timer);
+ cTimer *t = Timers->GetTimer(timer);
if (EPGSearchConfig.onePressTimerCreation == 0 || t || (!t && event->StartTime() - (Setup.MarginStart+2) * 60 < time(NULL)))
{
@@ -175,11 +173,12 @@ eOSState cMenuSearchCommands::Record(void)
SetAux(timer, fullaux);
if (*Setup.SVDRPDefaultHost)
timer->SetRemote(Setup.SVDRPDefaultHost);
- vdrtimers->Add(timer);
+ Timers->Add(timer);
timer->Matches();
- vdrtimers->SetModified();
+ Timers->SetModified();
if (!HandleRemoteTimerModifications(timer)) {
- delete timer;
+ ERROR(tr("Epgsearch: RemoteTimerModifications failed"));
+ Timers->Del(timer);
}
else
return osBack;
@@ -240,8 +239,7 @@ eOSState cMenuSearchCommands::CreateSearchTimer(void)
cSearchExt* pNew = new cSearchExt;
strcpy(pNew->search, event->Title());
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- pNew->channelMin = pNew->channelMax = vdrchannels->GetByChannelID(event->ChannelID());
+ pNew->channelMin = pNew->channelMax = Channels->GetByChannelID(event->ChannelID());
return AddSubMenu(new cMenuEditSearchExt(pNew, true, false, true));
}
@@ -289,15 +287,16 @@ eOSState cMenuSearchCommands::Execute(void)
buffer = cString::sprintf("%s...", command->Title());
Skins.Message(mtStatus, buffer);
+ {
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
buffer = cString::sprintf("'%s' %ld %ld %d '%s' '%s'",
EscapeString(event->Title()).c_str(),
event->StartTime(),
event->EndTime(),
ChannelNrFromEvent(event),
- EscapeString(vdrchannels->GetByChannelID(event->ChannelID(), true, true)->Name()).c_str(),
+ EscapeString(Channels->GetByChannelID(event->ChannelID(), true, true)->Name()).c_str(),
EscapeString(event->ShortText()?event->ShortText():"").c_str());
+ }
const char *Result = command->Execute(buffer);
Skins.Message(mtStatus, NULL);
if (Result)
diff --git a/menu_conflictcheck.c b/menu_conflictcheck.c
index 8c8d322..4450f25 100644
--- a/menu_conflictcheck.c
+++ b/menu_conflictcheck.c
@@ -164,8 +164,7 @@ cMenuConflictCheckDetailsItem::cMenuConflictCheckDetailsItem(cConflictCheckTimer
{
timerObj = TimerObj;
LOCK_TIMERS_READ;
- const cTimers *vdrtimers = Timers;
- hasTimer = timerObj->OrigTimer(vdrtimers)?timerObj->OrigTimer(vdrtimers)->HasFlags(tfActive):false;
+ hasTimer = timerObj->OrigTimer(Timers)?timerObj->OrigTimer(Timers)->HasFlags(tfActive):false;
Update(true);
}
@@ -173,8 +172,7 @@ bool cMenuConflictCheckDetailsItem::Update(bool Force)
{
bool oldhasTimer = hasTimer;
LOCK_TIMERS_READ;
- const cTimers *vdrtimers = Timers;
- hasTimer = timerObj->OrigTimer(vdrtimers)?timerObj->OrigTimer(vdrtimers)->HasFlags(tfActive):false;
+ hasTimer = timerObj->OrigTimer(Timers)?timerObj->OrigTimer(Timers)->HasFlags(tfActive):false;
if (Force || hasTimer != oldhasTimer)
{
const cTimer* timer = timerObj->timer;
@@ -266,13 +264,11 @@ eOSState cMenuConflictCheckDetails::Commands(eKeys Key)
eOSState cMenuConflictCheckDetails::ToggleTimer(cConflictCheckTimerObj* TimerObj)
{
- cTimers *vdrtimers;
LOCK_TIMERS_WRITE;
Timers->SetExplicitModify();
- vdrtimers = Timers;
- if (!TimerObj || !TimerObj->OrigTimer(vdrtimers)) return osContinue;
- TimerObj->OrigTimer(vdrtimers)->OnOff(); // Toggles Timer Flag
- vdrtimers->SetModified();
+ if (!TimerObj || !TimerObj->OrigTimer(Timers)) return osContinue;
+ TimerObj->OrigTimer(Timers)->OnOff(); // Toggles Timer Flag
+ Timers->SetModified();
Update();
Display();
return osContinue;
@@ -292,23 +288,22 @@ eOSState cMenuConflictCheckDetails::DeleteTimer(cConflictCheckTimerObj* TimerObj
{
LOCK_TIMERS_WRITE;
Timers->SetExplicitModify();
- cTimers *vdrtimers = Timers;
- cTimer* timer = TimerObj->OrigTimer(vdrtimers);
+ cTimer* timer = TimerObj->OrigTimer(Timers);
// Check if this timer is active:
if (timer) {
if (Interface->Confirm(trVDR("Delete timer?"))) {
if (timer->Recording()) {
if (Interface->Confirm(trVDR("Timer still recording - really delete?"))) {
timer->Skip();
- cRecordControls::Process(vdrtimers, time(NULL));
+ cRecordControls::Process(Timers, time(NULL));
}
else
return osContinue;
}
LogFile.iSysLog("deleting timer %s", *timer->ToDescr());
- vdrtimers->Del(timer);
+ Timers->Del(timer);
cOsdMenu::Del(Current());
- vdrtimers->SetModified();
+ Timers->SetModified();
Display();
return osBack;
}
@@ -326,9 +321,11 @@ eOSState cMenuConflictCheckDetails::ShowSummary()
const cEvent *ei = curTimerObj->Event();
if (ei)
{
+ const cChannel *channel;
+ {
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(ei->ChannelID(), true, true);
+ channel = Channels->GetByChannelID(ei->ChannelID(), true, true);
+ }
if (channel)
return AddSubMenu(new cMenuEventSearchSimple(ei, eventObjects));
}
@@ -418,11 +415,10 @@ eOSState cMenuConflictCheckDetails::ProcessKey(eKeys Key)
{
bool found = false;
LOCK_TIMERS_READ;
- const cTimers *vdrtimers = Timers;
- for(const cTimer* checkT = vdrtimers->First(); checkT; checkT = vdrtimers->Next(checkT))
+ for(const cTimer* checkT = Timers->First(); checkT; checkT = Timers->Next(checkT))
{
checkT->Matches();
- if (checkT == (*it)->OrigTimer(vdrtimers)) // ok -> found, check for changes
+ if (checkT == (*it)->OrigTimer(Timers)) // ok -> found, check for changes
{
if (checkT->IsSingleEvent())
{
diff --git a/menu_deftimercheckmethod.c b/menu_deftimercheckmethod.c
index f529d6e..45c4291 100644
--- a/menu_deftimercheckmethod.c
+++ b/menu_deftimercheckmethod.c
@@ -141,10 +141,9 @@ void cMenuDefTimerCheckMethod::Set()
delete modes;
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- modes = new int[vdrchannels->Count()];
+ modes = new int[Channels->Count()];
int i=0;
- for (const cChannel *channel = vdrchannels->First(); channel; channel = vdrchannels->Next(channel), i++)
+ for (const cChannel *channel = Channels->First(); channel; channel = Channels->Next(channel), i++)
{
if (!channel->GroupSep() && *channel->Name())
{
@@ -165,8 +164,7 @@ eOSState cMenuDefTimerCheckMethod::ProcessKey(eKeys Key)
{
int i=0;
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- for (const cChannel *channel = vdrchannels->First(); channel; channel = vdrchannels->Next(channel), i++)
+ for (const cChannel *channel = Channels->First(); channel; channel = Channels->Next(channel), i++)
if (!channel->GroupSep() && *channel->Name())
DefTimerCheckModes.SetMode(channel, modes[i]);
DefTimerCheckModes.Save();
diff --git a/menu_dirselect.c b/menu_dirselect.c
index 9ba46a7..33f077d 100644
--- a/menu_dirselect.c
+++ b/menu_dirselect.c
@@ -130,11 +130,9 @@ void cMenuDirSelect::CreateDirSet(bool extraDirs)
directorySet.clear();
// add distinct directories from current recordings
- LOCK_TIMERS_READ;
- const cTimers *vdrtimers = Timers;
+ {
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->HierarchyLevels() > 0)
{
@@ -155,8 +153,11 @@ void cMenuDirSelect::CreateDirSet(bool extraDirs)
free(dir);
}
}
+ } // give up Recordings Lock
// add distinct directories from current timers
- for (const cTimer *timer = vdrtimers->First(); timer; timer = vdrtimers->Next(timer))
+ {
+ LOCK_TIMERS_READ;
+ for (const cTimer *timer = Timers->First(); timer; timer = Timers->Next(timer))
{
char* dir = strdup(timer->File());
// strip the trailing name dir
@@ -176,6 +177,7 @@ void cMenuDirSelect::CreateDirSet(bool extraDirs)
}
free(dir);
}
+ }
// add distinct directories from folders.conf
for(cNestedItem* item = Folders.First(); item; item = Folders.Next(item))
diff --git a/menu_event.c b/menu_event.c
index e90d123..2e91b39 100644
--- a/menu_event.c
+++ b/menu_event.c
@@ -82,11 +82,9 @@ void cMenuEventSearch::Set()
if (event)
{
- LOCK_TIMERS_READ;
- const cTimers *vdrtimers = Timers;
+ LOCK_TIMERS_READ;
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(event->ChannelID(), true, true);
+ const cChannel *channel = Channels->GetByChannelID(event->ChannelID(), true, true);
bool canSwitch = false;
if (channel)
{
@@ -98,7 +96,7 @@ void cMenuEventSearch::Set()
cEventObj* eventObjNext = GetNext(event);
eTimerMatch timerMatch = tmNone;
- vdrtimers->GetMatch(event, &timerMatch);
+ Timers->GetMatch(event, &timerMatch);
const char* szRed = trVDR("Button$Record");
if (timerMatch == tmFull)
szRed = trVDR("Button$Timer");
@@ -114,9 +112,9 @@ void cMenuEventSearch::Set()
else if (surfMode == SurfModeChannel)
{
if (eventObjPrev && eventObjPrev->Event())
- szGreen = strdup(CHANNELNAME(vdrchannels->GetByChannelID(eventObjPrev->Event()->ChannelID(), true, true)));
+ szGreen = strdup(CHANNELNAME(Channels->GetByChannelID(eventObjPrev->Event()->ChannelID(), true, true)));
if (eventObjNext && eventObjNext->Event())
- szYellow = strdup(CHANNELNAME(vdrchannels->GetByChannelID(eventObjNext->Event()->ChannelID(), true, true)));
+ szYellow = strdup(CHANNELNAME(Channels->GetByChannelID(eventObjNext->Event()->ChannelID(), true, true)));
SetHelp(szRed, szGreen, szYellow, canSwitch ? trVDR("Button$Switch") : NULL);
}
}
@@ -239,8 +237,7 @@ void cMenuEventSearchSimple::Set()
if (event)
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(event->ChannelID(), true, true);
+ const cChannel *channel = Channels->GetByChannelID(event->ChannelID(), true, true);
if (channel)
{
SetTitle(channel->Name());
diff --git a/menu_favorites.c b/menu_favorites.c
index f74d3d9..a4115c9 100644
--- a/menu_favorites.c
+++ b/menu_favorites.c
@@ -123,8 +123,7 @@ eOSState cMenuFavorites::OnYellow()
if (item && item->event)
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(item->event->ChannelID(), true, true);
+ const cChannel *channel = Channels->GetByChannelID(item->event->ChannelID(), true, true);
cMenuWhatsOnSearch::scheduleChannel = channel;
cMenuWhatsOnSearch::currentShowMode = showNow;
}
diff --git a/menu_main.c b/menu_main.c
index af99afc..5cb5079 100644
--- a/menu_main.c
+++ b/menu_main.c
@@ -57,10 +57,9 @@ cMenuSearchMain::cMenuSearchMain(void)
InWhatsOnMenu = false;
InFavoritesMenu = false;
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByNumber(cDevice::CurrentChannel());
LOCK_SCHEDULES_READ;
schedules = Schedules;
+ const cChannel *channel = Channels->GetByNumber(cDevice::CurrentChannel());
if (channel) {
cMenuWhatsOnSearch::SetCurrentChannel(channel->Number());
if (EPGSearchConfig.StartMenu == 0 || forceMenu != 0)
@@ -177,16 +176,14 @@ bool cMenuSearchMain::Update(void)
eOSState cMenuSearchMain::Record(void)
{
cMenuMyScheduleItem *item = (cMenuMyScheduleItem *)Get(Current());
- cTimers *vdrtimers;
if (item) {
- {
+ cTimer *timer, *t;
+ {
LOCK_TIMERS_READ;
- vdrtimers = (cTimers *)Timers;
- }
if (item->timerMatch == tmFull)
{
eTimerMatch tm = tmNone;
- cTimer *timer = vdrtimers->GetMatch(item->event, &tm);
+ cTimer *timer = (cTimer*)Timers->GetMatch(item->event, &tm);
if (timer)
{
if (EPGSearchConfig.useVDRTimerEditMenu)
@@ -196,13 +193,11 @@ eOSState cMenuSearchMain::Record(void)
}
}
- cTimer *timer = new cTimer(item->event);
+ timer = new cTimer(item->event);
PrepareTimerFile(item->event, timer);
- {
- LOCK_TIMERS_READ;
- vdrtimers = (cTimers *)Timers;
- }
- cTimer *t = vdrtimers->GetTimer(timer);
+
+ t = (cTimer*)Timers->GetTimer(timer);
+ } // release TIMERS_READ
if (EPGSearchConfig.onePressTimerCreation == 0 || t || !item->event || (!t && item->event && item->event->StartTime() - (Setup.MarginStart+2) * 60 < time(NULL)))
{
if (t)
@@ -241,15 +236,13 @@ eOSState cMenuSearchMain::Record(void)
SetAux(timer, fullaux);
if (*Setup.SVDRPDefaultHost)
timer->SetRemote(Setup.SVDRPDefaultHost);
- {
LOCK_TIMERS_WRITE;
- vdrtimers = Timers;
- vdrtimers->Add(timer); // implicit SetModified
- }
+ Timers->Add(timer); // implicit SetModified
gl_timerStatusMonitor->SetConflictCheckAdvised();
timer->Matches();
if (!HandleRemoteTimerModifications(timer)) {
- delete timer;
+ ERROR(tr("Epgsearch: RemoteTimerModifications failed"));
+ Timers->Del(timer);
}
else
LogFile.iSysLog("timer %s added (active)", *timer->ToDescr());
@@ -269,8 +262,7 @@ eOSState cMenuSearchMain::Switch(void)
cMenuMyScheduleItem *item = (cMenuMyScheduleItem *)Get(Current());
if (item) {
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(item->event->ChannelID(), true, true);
+ const cChannel *channel = Channels->GetByChannelID(item->event->ChannelID(), true, true);
if (channel && cDevice::PrimaryDevice()->SwitchChannel(channel, true))
return osEnd;
}
@@ -328,9 +320,8 @@ void cMenuSearchMain::SetHelpKeys(bool Force)
else
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const char* szGreenToggled = CHANNELNAME(vdrchannels->GetByNumber(currentChannel-1,-1));
- const char* szYellowToggled = CHANNELNAME(vdrchannels->GetByNumber(currentChannel+1,1));
+ const char* szGreenToggled = CHANNELNAME(Channels->GetByNumber(currentChannel-1,-1));
+ const char* szYellowToggled = CHANNELNAME(Channels->GetByNumber(currentChannel+1,1));
SetHelp((EPGSearchConfig.redkeymode==1?(hasTimer?trVDR("Button$Timer"):trVDR("Button$Record")):tr("Button$Commands")), (EPGSearchConfig.toggleGreenYellow==0?trVDR("Button$Now"):szGreenToggled), (EPGSearchConfig.toggleGreenYellow==0?trVDR("Button$Next"):szYellowToggled), EPGSearchConfig.bluekeymode==1?trVDR("Button$Switch"):tr("Button$Search"));
@@ -343,8 +334,7 @@ eOSState cMenuSearchMain::Shift(int iMinutes)
{
shiftTime += iMinutes;
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByNumber(currentChannel);
+ const cChannel *channel = Channels->GetByNumber(currentChannel);
PrepareSchedule(channel);
Display();
SetHelpKeys();
@@ -459,8 +449,7 @@ eOSState cMenuSearchMain::ProcessKey(eKeys Key)
if (Item && Item->event)
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(Item->event->ChannelID(), true, true);
+ const cChannel *channel = Channels->GetByChannelID(Item->event->ChannelID(), true, true);
if (channel)
ChannelNr = channel->Number();
}
@@ -479,8 +468,7 @@ eOSState cMenuSearchMain::ProcessKey(eKeys Key)
else
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByNumber(currentChannel-1,-1);
+ const cChannel *channel = Channels->GetByNumber(currentChannel-1,-1);
if (channel) {
PrepareSchedule(channel);
@@ -513,8 +501,7 @@ eOSState cMenuSearchMain::ProcessKey(eKeys Key)
else
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByNumber(currentChannel+1,1);
+ const cChannel *channel = Channels->GetByNumber(currentChannel+1,1);
if (channel) {
PrepareSchedule(channel);
if (channel->Number() != cDevice::CurrentChannel()) {
diff --git a/menu_myedittimer.c b/menu_myedittimer.c
index c3bd0e1..677cce8 100644
--- a/menu_myedittimer.c
+++ b/menu_myedittimer.c
@@ -127,9 +127,8 @@ void cMenuMyEditTimer::Set()
#ifdef USE_PINPLUGIN
if (cOsd::pinValid || !fskProtection) Add(new cMenuEditChanItem(tr("Channel"), &channel));
else {
- LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- cString buf = cString::sprintf("%s\t%s", tr("Channel"), vdrchannels->GetByNumber(channel)->Name());
+ LOCK_CHANNELS_READ;
+ cString buf = cString::sprintf("%s\t%s", tr("Channel"), Channels->GetByNumber(channel)->Name());
Add(new cOsdItem(buf));
}
#else
@@ -161,9 +160,10 @@ void cMenuMyEditTimer::Set()
}
else if (IsSingleEvent() && event)
{
+ {
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- checkmode = DefTimerCheckModes.GetMode(vdrchannels->GetByNumber(channel));
+ checkmode = DefTimerCheckModes.GetMode(Channels->GetByNumber(channel));
+ }
char* checkmodeAux = GetAuxValue(timer, "update");
if (checkmodeAux)
{
@@ -239,22 +239,21 @@ eOSState cMenuMyEditTimer::DeleteTimer()
return osContinue;
}
Timers->SetExplicitModify();
- cTimers *vdrtimers = Timers;
if (timer && !addIfConfirmed) {
if (Interface->Confirm(trVDR("Delete timer?"))) {
if (timer->Recording()) {
if (Interface->Confirm(trVDR("Timer still recording - really delete?"))) {
timer->Skip();
- cRecordControls::Process(vdrtimers, time(NULL));
+ cRecordControls::Process(Timers, time(NULL));
}
else
return osContinue;
}
LogFile.iSysLog("deleting timer %s", *timer->ToDescr());
- vdrtimers->Del(timer);
+ Timers->Del(timer);
gl_timerStatusMonitor->SetConflictCheckAdvised();
- vdrtimers->SetModified();
+ Timers->SetModified();
return osBack;
}
}
@@ -332,9 +331,11 @@ eOSState cMenuMyEditTimer::ProcessKey(eKeys Key)
{
case kOk:
{
+ const cChannel *ch;
+ {
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *ch = vdrchannels->GetByNumber(channel);
+ ch = Channels->GetByNumber(channel);
+ }
if (!ch)
{
ERROR(tr("*** Invalid Channel ***"));
@@ -422,15 +423,14 @@ eOSState cMenuMyEditTimer::ProcessKey(eKeys Key)
return osBack;
}
Timers->SetExplicitModify();
- cTimers* vdrtimers = Timers;
if (*Setup.SVDRPDefaultHost)
timer->SetRemote(Setup.SVDRPDefaultHost);
if (addIfConfirmed) {
- vdrtimers->Add(timer);
- vdrtimers->SetModified();
+ Timers->Add(timer);
+ Timers->SetModified();
if (!HandleRemoteTimerModifications(timer)) {
- delete timer;
- ERROR(tr("Epgsearch: RemoteTimerModifications failed"));
+ Timers->Del(timer);
+ ERROR(tr("Epgsearch: RemoteTimerModifications failed"));
return osBack;
}
}
diff --git a/menu_quicksearch.c b/menu_quicksearch.c
index 6706c6d..cceaefa 100644
--- a/menu_quicksearch.c
+++ b/menu_quicksearch.c
@@ -249,8 +249,7 @@ eOSState cMenuQuickSearch::ProcessKey(eKeys Key)
if (data.useChannel==1)
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *ch = vdrchannels->GetByNumber(channelMin);
+ const cChannel *ch = Channels->GetByNumber(channelMin);
if (ch)
data.channelMin = ch;
else
@@ -258,7 +257,7 @@ eOSState cMenuQuickSearch::ProcessKey(eKeys Key)
ERROR(tr("*** Invalid Channel ***"));
break;
}
- ch = vdrchannels->GetByNumber(channelMax);
+ ch = Channels->GetByNumber(channelMax);
if (ch)
data.channelMax = ch;
else
diff --git a/menu_searchedit.c b/menu_searchedit.c
index 3a0693a..9a2276e 100644
--- a/menu_searchedit.c
+++ b/menu_searchedit.c
@@ -637,8 +637,7 @@ eOSState cMenuEditSearchExt::ProcessKey(eKeys Key)
if (data.useChannel==1)
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *ch = vdrchannels->GetByNumber(channelMin);
+ const cChannel *ch = Channels->GetByNumber(channelMin);
if (ch)
data.channelMin = ch;
else
@@ -646,7 +645,7 @@ eOSState cMenuEditSearchExt::ProcessKey(eKeys Key)
ERROR(tr("*** Invalid Channel ***"));
break;
}
- ch = vdrchannels->GetByNumber(channelMax);
+ ch = Channels->GetByNumber(channelMax);
if (ch)
data.channelMax = ch;
else
diff --git a/menu_searchresults.c b/menu_searchresults.c
index 48b78d9..b3d3e8f 100644
--- a/menu_searchresults.c
+++ b/menu_searchresults.c
@@ -63,12 +63,10 @@ cMenuSearchResultsItem::cMenuSearchResultsItem(const cEvent *EventInfo, bool Epi
menuTemplate = MenuTemplate?MenuTemplate:cTemplFile::GetTemplateByName("MenuSearchResults");
search = Search;
inSwitchList = false;
- LOCK_TIMERS_READ;
- const cTimers *vdrtimers = Timers;
- Update(vdrtimers, true);
+ Update(true);
}
-bool cMenuSearchResultsItem::Update(const cTimers* vdrtimers, bool Force)
+bool cMenuSearchResultsItem::Update(bool Force)
{
if (!menuTemplate)
return false;
@@ -79,7 +77,8 @@ bool cMenuSearchResultsItem::Update(const cTimers* vdrtimers, bool Force)
bool OldInSwitchList = inSwitchList;
bool hasMatch = false;
const cTimer* timer = NULL;
- if (event) timer = vdrtimers->GetMatch(event, &timerMatch);
+ LOCK_TIMERS_READ;
+ if (event) timer = Timers->GetMatch(event, &timerMatch);
if (event) inSwitchList = (SwitchTimers.InSwitchList(event)!=NULL);
if (timer) hasMatch = true;
@@ -185,8 +184,7 @@ cMenuSearchResultsItem::cMenuSearchResultsItem(const cRecording *Recording)
void cMenuSearchResultsItem::SetMenuItem(cSkinDisplayMenu *DisplayMenu, int Index, bool Current, bool Selectable)
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = event?vdrchannels->GetByChannelID(event->ChannelID(), true, true):NULL;
+ const cChannel *channel = event?Channels->GetByChannelID(event->ChannelID(), true, true):NULL;
if (!event)
DisplayMenu->SetItem(Text(), Index, Current, Selectable);
else if (!DisplayMenu->SetItemEvent(event, Index, Current, Selectable, channel, true, timerMatch))
@@ -218,11 +216,12 @@ int cMenuSearchResults::GetTab(int Tab)
return menuTemplate->Tab(Tab-1);
}
-bool cMenuSearchResults::Update(const cTimers* vdrtimers)
+bool cMenuSearchResults::Update(void)
{
bool result = false;
+ LOCK_TIMERS_READ;
for (cOsdItem *item = First(); item; item = Next(item)) {
- if (((cMenuSearchResultsItem *)item)->Update(vdrtimers))
+ if (((cMenuSearchResultsItem *)item)->Update(Timers))
result = true;
}
return result;
@@ -235,11 +234,10 @@ eOSState cMenuSearchResults::Record(void)
if (item) {
LOCK_TIMERS_WRITE;
Timers->SetExplicitModify();
- cTimers *vdrtimers = Timers;
if (item->timerMatch == tmFull)
{
eTimerMatch tm = tmNone;
- cTimer *timer = vdrtimers->GetMatch(item->event, &tm);
+ cTimer *timer = Timers->GetMatch(item->event, &tm);
if (timer)
{
if (EPGSearchConfig.useVDRTimerEditMenu)
@@ -251,7 +249,7 @@ eOSState cMenuSearchResults::Record(void)
cTimer *timer = new cTimer(item->event);
PrepareTimerFile(item->event, timer);
- cTimer *t = vdrtimers->GetTimer(timer);
+ cTimer *t = Timers->GetTimer(timer);
if (EPGSearchConfig.onePressTimerCreation == 0 || t || !item->event || (!t && item->event && item->event->StartTime() - (Setup.MarginStart+2) * 60 < time(NULL)))
{
if (t)
@@ -291,17 +289,18 @@ eOSState cMenuSearchResults::Record(void)
SetAux(timer, fullaux);
if (*Setup.SVDRPDefaultHost)
timer->SetRemote(Setup.SVDRPDefaultHost);
- vdrtimers->Add(timer);
+ Timers->Add(timer);
gl_timerStatusMonitor->SetConflictCheckAdvised();
timer->Matches();
- vdrtimers->SetModified();
+ Timers->SetModified();
if (!HandleRemoteTimerModifications(timer)) {
- delete timer;
+ ERROR(tr("Epgsearch: RemoteTimerModifications failed"));
+ Timers->Del(timer);
}
if (HasSubMenu())
CloseSubMenu();
- if (Update(vdrtimers))
+ if (Update())
Display();
SetHelpKeys();
}
@@ -316,8 +315,7 @@ eOSState cMenuSearchResults::Switch(void)
cMenuSearchResultsItem *item = (cMenuSearchResultsItem *)Get(Current());
if (item) {
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(item->event->ChannelID(), true, true);
+ const cChannel *channel = Channels->GetByChannelID(item->event->ChannelID(), true, true);
if (channel && cDevice::PrimaryDevice()->SwitchChannel(channel, true))
return osEnd;
}
@@ -348,8 +346,7 @@ eOSState cMenuSearchResults::ShowSummary()
if (ei)
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *channel = vdrchannels->GetByChannelID(ei->ChannelID(), true, true);
+ const cChannel *channel = Channels->GetByChannelID(ei->ChannelID(), true, true);
if (channel)
return AddSubMenu(new cMenuEventSearch(ei, eventObjects));
}
@@ -461,9 +458,7 @@ eOSState cMenuSearchResults::ProcessKey(eKeys Key)
}
if (!HasSubMenu())
{
- LOCK_TIMERS_READ;
- const cTimers *vdrtimers = Timers;
- if ((HadSubMenu || gl_TimerProgged) && Update(vdrtimers))
+ if ((HadSubMenu || gl_TimerProgged) && Update())
{
if (gl_TimerProgged) // when using epgsearch's timer edit menu, update is delayed because of SVDRP
{
@@ -781,8 +776,7 @@ bool cMenuSearchResultsForRecs::BuildList()
int current = Current();
Clear();
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)) {
const cRecordingInfo *recInfo = recording->Info();
if (!recInfo) continue;
string s1 = (recInfo && recInfo->Title())?recInfo->Title():"";
@@ -841,8 +835,7 @@ bool cMenuSearchResultsForRecs::BuildList()
const cRecording *cMenuSearchResultsForRecs::GetRecording(cMenuSearchResultsItem *Item)
{
LOCK_RECORDINGS_READ;
- const cRecordings *vdrrecordings = Recordings;
- const cRecording *recording = vdrrecordings->GetByName(Item->FileName());
+ const cRecording *recording = Recordings->GetByName(Item->FileName());
if (!recording)
ERROR(tr("Error while accessing recording!"));
return recording;
diff --git a/menu_searchresults.h b/menu_searchresults.h
index f31d9c0..36b8665 100644
--- a/menu_searchresults.h
+++ b/menu_searchresults.h
@@ -59,7 +59,7 @@ class cMenuSearchResultsItem : public cOsdItem {
bool PreviewTimer = false, cMenuTemplate* MenuTemplate = NULL,
const cSearchExt* Search = NULL);
cMenuSearchResultsItem(const cRecording *Recording);
- bool Update(const cTimers* vdrtimers, bool Force = false);
+ bool Update(bool Force = false);
void SetMenuItem(cSkinDisplayMenu *DisplayMenu, int Index, bool Current, bool Selectable);
};
@@ -83,7 +83,7 @@ class cMenuSearchResults : public cOsdMenu {
eOSState Commands(eKeys Key, cSearchExt* SearchExt = NULL);
int GetTab(int Tab);
virtual void SetHelpKeys(bool Force=false)=0;
- bool Update(const cTimers* vdrtimers);
+ bool Update(void);
void UpdateCurrent();
static const cEvent *scheduleEventInfo;
diff --git a/menu_switchtimers.c b/menu_switchtimers.c
index 59e9217..ab14c1f 100644
--- a/menu_switchtimers.c
+++ b/menu_switchtimers.c
@@ -135,8 +135,7 @@ void cMenuSwitchTimerItem::Set()
strftime(datebuf, sizeof(datebuf), "%d.%m", tm);
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);
msprintf(&buffer, "%s\t%d\t%s\t%s\t%d\'\t%s~%s", switchTimer->mode==1?"":">", channel?channel->Number():-1, datebuf, TIMESTRING(startTime), switchTimer->switchMinsBefore, event->Title()?event->Title():"", event->ShortText()?event->ShortText():"");
SetText(buffer, false);
diff --git a/menu_templateedit.c b/menu_templateedit.c
index 9e2edda..20278b0 100644
--- a/menu_templateedit.c
+++ b/menu_templateedit.c
@@ -188,8 +188,7 @@ eOSState cMenuEditTemplate::ProcessKey(eKeys Key)
if (data.useChannel==1)
{
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel *ch = vdrchannels->GetByNumber(channelMin);
+ const cChannel *ch = Channels->GetByNumber(channelMin);
if (ch)
data.channelMin = ch;
else
@@ -197,7 +196,7 @@ eOSState cMenuEditTemplate::ProcessKey(eKeys Key)
ERROR(tr("*** Invalid Channel ***"));
break;
}
- ch = vdrchannels->GetByNumber(channelMax);
+ ch = Channels->GetByNumber(channelMax);
if (ch)
data.channelMax = ch;
else
diff --git a/menu_timersdone.c b/menu_timersdone.c
index 2c7a871..7b7fe04 100644
--- a/menu_timersdone.c
+++ b/menu_timersdone.c
@@ -45,8 +45,7 @@ void cMenuTimerDoneItem::Set(void)
strftime(buf, sizeof(buf), "%d.%m.%y %H:%M", tm);
LOCK_CHANNELS_READ;
- const cChannels *vdrchannels = Channels;
- const cChannel* ch = vdrchannels->GetByChannelID(timerDone->channelID, true, true);
+ const cChannel* ch = Channels->GetByChannelID(timerDone->channelID, true, true);
msprintf(&buffer, "%d\t%s\t%s~%s", ch?ch->Number():0, buf, timerDone->title.c_str(), timerDone->shorttext.c_str());
SetText(buffer, false);
}
diff --git a/menu_whatson.c b/menu_whatson.c
index 42aa377..6ed49b6 100644
--- a/menu_whatson.c
+++ b/menu_whatson.c
@@ -629,8 +629,8 @@ eOSState cMenuWhatsOnSearch::Record(void)
timer->SetRemote(Setup.SVDRPDefaultHost);
Timers->Add(timer);
if (!HandleRemoteTimerModifications(timer)) {
- delete timer;
- ERROR("Epgsearch: RemoteTimerModifications failed");
+ Timers->Del(timer);
+ ERROR(tr("Epgsearch: RemoteTimerModifications failed"));
}
else {
gl_timerStatusMonitor->SetConflictCheckAdvised();
diff --git a/searchtimer_thread.c b/searchtimer_thread.c
index 76e7509..1d1fcb4 100644
--- a/searchtimer_thread.c
+++ b/searchtimer_thread.c
@@ -253,10 +253,7 @@ void cSearchTimerThread::Action(void)
searchExt = localSearchExts->Next(searchExt);
continue;
}
- {
- LOCK_TIMERS_READ;
- pOutdatedTimers = searchExt->GetTimerList(Timers, pOutdatedTimers);
- } // End of Block should release ReadLock
+ pOutdatedTimers = searchExt->GetTimerList(pOutdatedTimers);
cSearchResults* pSearchResults = searchExt->Run(-1, true);
if (!pSearchResults)
@@ -310,8 +307,7 @@ void cSearchTimerThread::Action(void)
// search for an already existing timer
bool bTimesMatchExactly = false;
- const cTimer *t = NULL;
- t = GetTimer(searchExt, pEvent, bTimesMatchExactly);
+ const cTimer *t = GetTimer(searchExt, pEvent, bTimesMatchExactly);
char* Summary = NULL;
uint timerMod = tmNoChange;