void cConflictCheck::EvaluateConflCheckCmd() { if (strlen(EPGSearchConfig.conflCheckCmd) > 0) { LogFile.Log(2,"evaluating conflict check command '%s'", EPGSearchConfig.conflCheckCmd); for(cConflictCheckTime* ct = failedList->First(); ct; ct = failedList->Next(ct)) { if (ct->ignore) continue; std::set<cConflictCheckTimerObj*,TimerObjSort>::iterator it; for (it = ct->failedTimers.begin(); it != ct->failedTimers.end(); ++it) if ((*it) && !(*it)->ignore) { string result = EPGSearchConfig.conflCheckCmd; if (!(*it)->OrigTimer()) { LogFile.Log(3,"timer has disappeared meanwhile"); continue; } else LogFile.Log(3,"evaluating conflict check command for timer '%s' (%s, channel %s)", (*it)->timer->File(), DAYDATETIME((*it)->start), CHANNELNAME((*it)->timer->Channel())); if ((*it)->Event()) { cVarExpr varExprEvent(result); result = varExprEvent.Evaluate((*it)->Event()); } cVarExpr varExprTimer(result); result = varExprTimer.Evaluate((*it)->timer); cVarExpr varExpr(result); varExpr.Evaluate(); } } } }
bool MatchesInExpression(const string& expression, const cRecDone* recDone, const cEvent* event) { cVarExpr varExpr(expression); cEvent recDoneEvent(0); recDoneEvent.SetTitle(recDone->title); recDoneEvent.SetShortText(recDone->shortText); recDoneEvent.SetDescription(recDone->description); recDoneEvent.SetStartTime(recDone->startTime); recDoneEvent.SetDuration(recDone->duration); string resRecDone = varExpr.Evaluate(&recDoneEvent); string resEvent = varExpr.Evaluate(event); return resRecDone == resEvent; }
std::string cEpgsearchServiceHandler::Evaluate(const std::string& expr, const cEvent* event) { if (!event) return expr; cVarExpr varExpr(expr); return varExpr.Evaluate(event); }
bool cMenuSearchResultsItem::Update(bool Force) { if (!menuTemplate) return false; bool result = false; eTimerMatch OldTimerMatch = timerMatch; bool OldInSwitchList = inSwitchList; bool hasMatch = false; cTimer* timer = NULL; if (event) timer = Timers.GetMatch(event, &timerMatch); if (event) inSwitchList = (SwitchTimers.InSwitchList(event)!=NULL); if (timer) hasMatch = true; if (Force || timerMatch != OldTimerMatch || inSwitchList != OldInSwitchList) { char t[Utf8BufSize(2)]="",v[Utf8BufSize(2)]="",r[Utf8BufSize(2)]=""; char szStatus[Utf8BufSize(4)] = ""; if (EPGSearchConfig.WarEagle) { if (!isUTF8) { t[0] = event && hasMatch ? (timerMatch == tmFull) ? ((timer && timer->Recording())?ICON_REC:ICON_CLOCK) : ICON_CLOCK_HALF : ' '; t[1] = '\0'; v[0] = event && event->Vps() && (event->Vps() - event->StartTime()) ? ICON_VPS : ' '; v[1] = '\0'; r[0] = event && event->IsRunning() ? ICON_RUNNING : ' '; r[1] = '\0'; } else { #if defined(__GNUC__) && __GNUC__ < 3 && __GNUC_MINOR__ < 96 #else sprintf(t, "%s", (event && hasMatch ? (timerMatch == tmFull) ? ((timer && timer->Recording())?ICON_REC_UTF8:ICON_CLOCK_UTF8) : ICON_CLOCK_HALF_UTF8 : " ")); sprintf(v, "%s", event && event->Vps() && (event->Vps() - event->StartTime()) ? ICON_VPS_UTF8 : " "); sprintf(r, "%s", (event && event->IsRunning() ? ICON_RUNNING_UTF8 : " ")); #endif } } else { t[0] = event && hasMatch ? (timerMatch == tmFull) ? ((timer && timer->Recording())?'R':'T') : 't' : ' '; t[1] = '\0'; v[0] = event && event->Vps() && (event->Vps() - event->StartTime()) ? 'V' : ' '; v[1] = '\0'; r[0] = event && event->IsRunning() ? '*' : ' '; r[1] = '\0'; } if (event && inSwitchList) { cSwitchTimer* s = SwitchTimers.InSwitchList(event); t[0] = (s && s->mode==1)?'s':'S'; } if (t[0] != 'T' && previewTimer) t[0] = 'P'; strcpy(szStatus, t); strcat(szStatus, v); strcat(szStatus, r); char* buffer = strdup(menuTemplate->MenuTemplate()); strreplace(buffer, '|', '\t'); if (!strcasestr(buffer, "%subtitle%") && cTemplFile::GetTemplateByName("MenuFavorites") != menuTemplate) // make sure, there is a subtitle buffer = strreplacei(buffer, "%title%", "%title% ~ %subtitle%"); if (episodeOnly) buffer = strreplacei(buffer, "%title%", ""); // parse the epxression and evaluate it cVarExpr varExpr(buffer); char* tmp = strdup(varExpr.Evaluate(event).c_str()); free(buffer); buffer = tmp; buffer = strreplacei(buffer, "$status$", szStatus); buffer = strreplacei(buffer, "$t_status$", t); buffer = strreplacei(buffer, "$v_status$", v); buffer = strreplacei(buffer, "$r_status$", r); buffer = FixSeparators(buffer, '~'); buffer = FixSeparators(buffer, ':'); buffer = FixSeparators(buffer, '-'); SetText(buffer, false); if (EPGSearchConfig.checkTimerConflAfterTimerProg && !Force && timer && timerMatch && timerMatch != OldTimerMatch) { cConflictCheck C; C.Check(); if (C.TimerInConflict(timer)) gl_InfoConflict = 1; } return true; } return result; }