enum eEpgSearchTokens { eEPGtime = 0, eEPGdate, eEPGdatesh, eEPGtime_w, eEPGtime_d, eEPGtimespan, eEPGtitle, eEPGsubtitle, eEPGt_status, eEPGv_status, eEPGr_status, eEPGstatus, eEPGchnr, eEPGchsh, eEPGchlng, eEPGprogr, eEPGprogrT2S}; enum eEPGModes { eMenuSchedule = 0, eMenuWhatsOnNow, eMenuWhatsOnNext, eMenuWhatsOnElse, eMenuSearchResults, eMenuFavorites, eMenuTimerconflict}; #include #include "epgsearchconf.h" cNopacityEPGSearchConfig::cNopacityEPGSearchConfig(void) { ReplaceSchedule = false; ShowChannelNr = false; ShowProgress = false; MaxTabs = 6; for (int i=0; i<4; i++) { UserSet[i] = false; User[i] = ""; } for (int i=0; i 0) { User[i] = line.c_str(); UserSet[i] = true; } } catch (...){} } } } } } } } else { return false; } return true; } bool cNopacityEPGSearchConfig::LoadEpgSearchMenuConf(void) { cString ConfigDir = cPlugin::ConfigDirectory("epgsearch"); cString epgsearchConf = "epgsearchmenu.conf"; cString fileName = AddDirectory(*ConfigDir, *epgsearchConf); if (access(fileName, F_OK) == 0) { dsyslog("nopacity: config file %s found", *fileName); FILE *f = fopen(fileName, "r"); if (f) { char *s; cReadLine ReadLine; while ((s = ReadLine.Read(f)) != NULL) { char *p = strchr(s, '#'); if (p) *p = 0; stripspace(s); try { if (!isempty(s)) { std::string line = s; std::string *values = new std::string[MaxTabs]; if (line.find("MenuWhatsOnNow") == 0) { values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1)); SetTokens(values, eMenuWhatsOnNow); } else if (line.find("MenuWhatsOnNext") == 0) { values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1)); SetTokens(values, eMenuWhatsOnNext); } else if (line.find("MenuWhatsOnElse") == 0) { values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1)); SetTokens(values, eMenuWhatsOnElse); } else if (line.find("MenuSchedule") == 0) { values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1)); SetTokens(values, eMenuSchedule); } else if (line.find("MenuSearchResults") == 0) { values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1)); SetTokens(values, eMenuSearchResults); } else if (line.find("MenuFavorites") == 0) { values = SplitEpgSearchMenuLine(line.substr(line.find_first_of("=") + 1)); SetTokens(values, eMenuFavorites); } delete[] values; } } catch (...){} } } } else { dsyslog("nopacity: %s not available, using epgsearch default settings", *fileName); return false; } return true; } std::string *cNopacityEPGSearchConfig::SplitEpgSearchMenuLine(std::string line) { size_t posSeparator = -1; bool found = false; posSeparator = line.find_first_of("|") + 1; std::string *values = new std::string[MaxTabs]; for (int i=0; i < MaxTabs; i++) values[i] = ""; std::string value; int i=0; while (posSeparator > 0) { found = true; try { value = line.substr(0, posSeparator); value = value.substr(0, value.find_first_of(":")); value = value.substr(value.find_first_not_of(" ")); value = value.substr(0, value.find_last_not_of(" ")+1); values[i] = value; line = line.substr(posSeparator); posSeparator = line.find_first_of("|") + 1; } catch (...) {} i++; } if (found) { try { value = line.substr(0, line.find_first_of(":")); value = value.substr(value.find_first_not_of(" ")); value = value.substr(0, value.find_last_not_of(" ")+1); values[i] = value; } catch (...) {} } return values; } void cNopacityEPGSearchConfig::SetTokens(std::string *values, eEPGModes mode) { for (int i=0; i