mirror of
https://projects.vdr-developer.org/git/vdr-plugin-tvguide.git
synced 2023-10-05 15:01:48 +02:00
Changes for LOCKING
This commit is contained in:
parent
8f1f2dea33
commit
39dfe767fc
@ -43,8 +43,11 @@ void cChannelColumn::drawHeader() {
|
|||||||
|
|
||||||
bool cChannelColumn::readGrids() {
|
bool cChannelColumn::readGrids() {
|
||||||
#if VDRVERSNUM >= 20301
|
#if VDRVERSNUM >= 20301
|
||||||
|
const cSchedules* schedules;
|
||||||
|
{
|
||||||
LOCK_SCHEDULES_READ;
|
LOCK_SCHEDULES_READ;
|
||||||
const cSchedules* schedules = Schedules;
|
schedules = Schedules;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
schedules = cSchedules::Schedules(*schedulesLock);
|
schedules = cSchedules::Schedules(*schedulesLock);
|
||||||
#endif
|
#endif
|
||||||
@ -201,8 +204,11 @@ void cChannelColumn::AddNewGridsAtStart() {
|
|||||||
}
|
}
|
||||||
//if not, i have to add new ones to the list
|
//if not, i have to add new ones to the list
|
||||||
#if VDRVERSNUM >= 20301
|
#if VDRVERSNUM >= 20301
|
||||||
|
const cSchedules* schedules;
|
||||||
|
{
|
||||||
LOCK_SCHEDULES_READ;
|
LOCK_SCHEDULES_READ;
|
||||||
const cSchedules* schedules = Schedules;
|
schedules = Schedules;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
schedules = cSchedules::Schedules(*schedulesLock);
|
schedules = cSchedules::Schedules(*schedulesLock);
|
||||||
#endif
|
#endif
|
||||||
@ -254,8 +260,11 @@ void cChannelColumn::AddNewGridsAtEnd() {
|
|||||||
}
|
}
|
||||||
//if not, i have to add new ones to the list
|
//if not, i have to add new ones to the list
|
||||||
#if VDRVERSNUM >= 20301
|
#if VDRVERSNUM >= 20301
|
||||||
|
const cSchedules* schedules;
|
||||||
|
{
|
||||||
LOCK_SCHEDULES_READ;
|
LOCK_SCHEDULES_READ;
|
||||||
const cSchedules* schedules = Schedules;
|
schedules = Schedules;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
schedules = cSchedules::Schedules(*schedulesLock);
|
schedules = cSchedules::Schedules(*schedulesLock);
|
||||||
#endif
|
#endif
|
||||||
@ -391,4 +400,4 @@ void cChannelColumn::dumpGrids() {
|
|||||||
esyslog("tvguide: grid %d: start: %s, stop: %s", i, *cMyTime::printTime(grid->StartTime()), *cMyTime::printTime(grid->EndTime()));
|
esyslog("tvguide: grid %d: start: %s, stop: %s", i, *cMyTime::printTime(grid->StartTime()), *cMyTime::printTime(grid->EndTime()));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
40
recmanager.c
40
recmanager.c
@ -43,7 +43,7 @@ bool cRecManager::RefreshRemoteTimers(void) {
|
|||||||
|
|
||||||
bool cRecManager::CheckEventForTimer(const cEvent *event) {
|
bool cRecManager::CheckEventForTimer(const cEvent *event) {
|
||||||
bool hasTimer = false;
|
bool hasTimer = false;
|
||||||
|
|
||||||
if (tvguideConfig.useRemoteTimers && pRemoteTimers) {
|
if (tvguideConfig.useRemoteTimers && pRemoteTimers) {
|
||||||
RemoteTimers_GetMatch_v1_0 rtMatch;
|
RemoteTimers_GetMatch_v1_0 rtMatch;
|
||||||
rtMatch.event = event;
|
rtMatch.event = event;
|
||||||
@ -71,11 +71,11 @@ cTimer *cRecManager::GetTimerForEvent(const cEvent *event) {
|
|||||||
#if VDRVERSNUM >= 20301
|
#if VDRVERSNUM >= 20301
|
||||||
return timer;
|
return timer;
|
||||||
}
|
}
|
||||||
LOCK_TIMERS_READ;
|
LOCK_TIMERS_READ;
|
||||||
timer = Timers->GetMatch(event);
|
timer = Timers->GetMatch(event);
|
||||||
#else
|
#else
|
||||||
} else
|
} else
|
||||||
timer = Timers.GetMatch(event);
|
timer = Timers.GetMatch(event);
|
||||||
#endif
|
#endif
|
||||||
return timer;
|
return timer;
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ void cRecManager::SetTimerPath(cTimer *timer, const cEvent *event, std::string p
|
|||||||
std::string newFileName = epgSearch->handler->Evaluate(recDir, event);
|
std::string newFileName = epgSearch->handler->Evaluate(recDir, event);
|
||||||
if (strchr(newFileName.c_str(), '%') == NULL) // only set directory to new value if all categories could have been replaced
|
if (strchr(newFileName.c_str(), '%') == NULL) // only set directory to new value if all categories could have been replaced
|
||||||
timer->SetFile(newFileName.c_str());
|
timer->SetFile(newFileName.c_str());
|
||||||
else
|
else
|
||||||
esyslog("tvguide: timer path not set because replacing variable was not successfull: %s", newFileName.c_str());
|
esyslog("tvguide: timer path not set because replacing variable was not successfull: %s", newFileName.c_str());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -227,7 +227,7 @@ void cRecManager::DeleteTimer(const cTimer *timer) {
|
|||||||
LOCK_TIMERS_WRITE;
|
LOCK_TIMERS_WRITE;
|
||||||
cTimers* timers = Timers;
|
cTimers* timers = Timers;
|
||||||
cTimer* t = timers->GetTimer((cTimer*)timer); // #TODO dirty cast
|
cTimer* t = timers->GetTimer((cTimer*)timer); // #TODO dirty cast
|
||||||
|
|
||||||
if (t->Recording()) {
|
if (t->Recording()) {
|
||||||
t->Skip();
|
t->Skip();
|
||||||
cRecordControls::Process(timers, time(NULL));
|
cRecordControls::Process(timers, time(NULL));
|
||||||
@ -270,7 +270,7 @@ void cRecManager::SaveTimer(cTimer *timer, cTimer newTimerSettings) {
|
|||||||
#endif
|
#endif
|
||||||
if (!timer)
|
if (!timer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool active = newTimerSettings.HasFlags(tfActive);
|
bool active = newTimerSettings.HasFlags(tfActive);
|
||||||
int prio = newTimerSettings.Priority();
|
int prio = newTimerSettings.Priority();
|
||||||
int lifetime = newTimerSettings.Lifetime();
|
int lifetime = newTimerSettings.Lifetime();
|
||||||
@ -325,7 +325,7 @@ void cRecManager::SaveTimer(cTimer *timer, cTimer newTimerSettings) {
|
|||||||
#else
|
#else
|
||||||
Timers.SetModified();
|
Timers.SetModified();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -455,7 +455,7 @@ const cEvent **cRecManager::PerformSearchTimerSearch(std::string epgSearchString
|
|||||||
Schedule = schedules->GetSchedule(channel);
|
Schedule = schedules->GetSchedule(channel);
|
||||||
event = Schedule->GetEvent(eventID);
|
event = Schedule->GetEvent(eventID);
|
||||||
if (event) {
|
if (event) {
|
||||||
searchResults[index] = event;
|
searchResults[index] = event;
|
||||||
} else
|
} else
|
||||||
return NULL;
|
return NULL;
|
||||||
} else
|
} else
|
||||||
@ -606,7 +606,7 @@ void cRecManager::DeleteSearchTimer(cTVGuideSearchTimer *searchTimer, bool delTi
|
|||||||
} else {
|
} else {
|
||||||
esyslog("tvguide: error deleting search timer \"%s\"", searchTimer->SearchString().c_str());
|
esyslog("tvguide: error deleting search timer \"%s\"", searchTimer->SearchString().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cRecManager::UpdateSearchTimers(void) {
|
void cRecManager::UpdateSearchTimers(void) {
|
||||||
@ -653,12 +653,12 @@ const cRecording **cRecManager::SearchForRecordings(std::string searchString, in
|
|||||||
const cRecording **matchingRecordings = NULL;
|
const cRecording **matchingRecordings = NULL;
|
||||||
#else
|
#else
|
||||||
cRecording **cRecManager::SearchForRecordings(std::string searchString, int &numResults) {
|
cRecording **cRecManager::SearchForRecordings(std::string searchString, int &numResults) {
|
||||||
|
|
||||||
cRecording **matchingRecordings = NULL;
|
cRecording **matchingRecordings = NULL;
|
||||||
#endif
|
#endif
|
||||||
int num = 0;
|
int num = 0;
|
||||||
numResults = 0;
|
numResults = 0;
|
||||||
|
|
||||||
#if VDRVERSNUM >= 20301
|
#if VDRVERSNUM >= 20301
|
||||||
LOCK_RECORDINGS_READ;
|
LOCK_RECORDINGS_READ;
|
||||||
for (const cRecording *recording = Recordings->First(); recording; recording = Recordings->Next(recording)) {
|
for (const cRecording *recording = Recordings->First(); recording; recording = Recordings->Next(recording)) {
|
||||||
@ -668,12 +668,12 @@ cRecording **cRecManager::SearchForRecordings(std::string searchString, int &num
|
|||||||
std::string s1 = recording->Name();
|
std::string s1 = recording->Name();
|
||||||
std::string s2 = searchString;
|
std::string s2 = searchString;
|
||||||
if (s1.empty() || s2.empty()) continue;
|
if (s1.empty() || s2.empty()) continue;
|
||||||
|
|
||||||
// tolerance for fuzzy searching: 90% of the shorter text length, but at least 1
|
// tolerance for fuzzy searching: 90% of the shorter text length, but at least 1
|
||||||
int tolerance = std::max(1, (int)std::min(s1.size(), s2.size()) / 10);
|
int tolerance = std::max(1, (int)std::min(s1.size(), s2.size()) / 10);
|
||||||
|
|
||||||
bool match = FindIgnoreCase(s1, s2) >= 0 || FindIgnoreCase(s2, s1) >= 0;
|
bool match = FindIgnoreCase(s1, s2) >= 0 || FindIgnoreCase(s2, s1) >= 0;
|
||||||
|
|
||||||
if (!match) {
|
if (!match) {
|
||||||
AFUZZY af = { NULL, NULL, NULL, NULL, NULL, NULL, { 0 }, { 0 }, 0, 0, 0, 0, 0, 0 };
|
AFUZZY af = { NULL, NULL, NULL, NULL, NULL, NULL, { 0 }, { 0 }, 0, 0, 0, 0, 0, 0 };
|
||||||
if (s1.size() > 32) s1 = s1.substr(0, 32);
|
if (s1.size() > 32) s1 = s1.substr(0, 32);
|
||||||
@ -683,7 +683,7 @@ cRecording **cRecManager::SearchForRecordings(std::string searchString, int &num
|
|||||||
afuzzy_free(&af);
|
afuzzy_free(&af);
|
||||||
match = (res > 0);
|
match = (res > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!match) {
|
if (!match) {
|
||||||
AFUZZY af = { NULL, NULL, NULL, NULL, NULL, NULL, { 0 }, { 0 }, 0, 0, 0, 0, 0, 0 };
|
AFUZZY af = { NULL, NULL, NULL, NULL, NULL, NULL, { 0 }, { 0 }, 0, 0, 0, 0, 0, 0 };
|
||||||
if (s2.size() > 32) s2 = s2.substr(0, 32);
|
if (s2.size() > 32) s2 = s2.substr(0, 32);
|
||||||
@ -693,7 +693,7 @@ cRecording **cRecManager::SearchForRecordings(std::string searchString, int &num
|
|||||||
afuzzy_free(&af);
|
afuzzy_free(&af);
|
||||||
match = (res > 0);
|
match = (res > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
#if VDRVERSNUM >= 20301
|
#if VDRVERSNUM >= 20301
|
||||||
matchingRecordings = (const cRecording **)realloc(matchingRecordings, (num + 1) * sizeof(cRecording *));
|
matchingRecordings = (const cRecording **)realloc(matchingRecordings, (num + 1) * sizeof(cRecording *));
|
||||||
@ -729,7 +729,7 @@ const cEvent **cRecManager::LoadReruns(const cEvent *event, int &numResults) {
|
|||||||
data.channelNr = 0;
|
data.channelNr = 0;
|
||||||
data.useTitle = true;
|
data.useTitle = true;
|
||||||
data.useDescription = false;
|
data.useDescription = false;
|
||||||
|
|
||||||
if (epgSearchPlugin->Service("Epgsearch-searchresults-v1.0", &data)) {
|
if (epgSearchPlugin->Service("Epgsearch-searchresults-v1.0", &data)) {
|
||||||
cList<Epgsearch_searchresults_v1_0::cServiceSearchResult>* list = data.pResultList;
|
cList<Epgsearch_searchresults_v1_0::cServiceSearchResult>* list = data.pResultList;
|
||||||
if (!list)
|
if (!list)
|
||||||
@ -822,7 +822,7 @@ const cEvent **cRecManager::WhatsOnNow(bool nowOrNext, int &numResults) {
|
|||||||
numResults = tmpResults.size();
|
numResults = tmpResults.size();
|
||||||
const cEvent **results = new const cEvent *[numResults];
|
const cEvent **results = new const cEvent *[numResults];
|
||||||
for (int i=0; i<numResults; i++) {
|
for (int i=0; i<numResults; i++) {
|
||||||
results[i] = tmpResults[i];
|
results[i] = tmpResults[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
@ -899,7 +899,7 @@ const cEvent **cRecManager::UserDefinedTime(int userTime, int &numResults) {
|
|||||||
numResults = tmpResults.size();
|
numResults = tmpResults.size();
|
||||||
const cEvent **results = new const cEvent *[numResults];
|
const cEvent **results = new const cEvent *[numResults];
|
||||||
for (int i=0; i<numResults; i++) {
|
for (int i=0; i<numResults; i++) {
|
||||||
results[i] = tmpResults[i];
|
results[i] = tmpResults[i];
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user