CNeutrinoEventList::findEvents - add search all epg option

This commit is contained in:
Jacek Jendrzej
2013-05-17 21:08:09 +02:00
parent 999c659b3c
commit 35bac1ff40
8 changed files with 63 additions and 58 deletions

View File

@@ -316,6 +316,7 @@ epgviewer.nodetailed Keine ausführlichen Informationen verfügbar
epgviewer.notfound Keine Programminformationen (EPG) gefunden
eventfinder.head EPG-Suche
eventfinder.keyword Suche nach Textpassage
eventfinder.search_all_epg Ganze
eventfinder.search Suche
eventfinder.search_within_epg Suche innerhalb EPG-Daten
eventfinder.search_within_list Suche innerhalb Text

View File

@@ -317,6 +317,7 @@ epgviewer.notfound No EPG found
eventfinder.head Search in EPG
eventfinder.keyword Keyword
eventfinder.search Search
eventfinder.search_all_epg whole
eventfinder.search_within_epg Search within
eventfinder.search_within_list Search within
eventfinder.searching Search for keyword in EPG...

View File

@@ -2233,50 +2233,52 @@ printf("SIevent size: %d\n", (int)sizeof(SIevent));
}
/* was: commandAllEventsChannelID sendAllEvents */
void CEitManager::getEventsServiceKey(t_channel_id serviceUniqueKey, CChannelEventList &eList, char search, std::string search_text)
void CEitManager::getEventsServiceKey(t_channel_id serviceUniqueKey, CChannelEventList &eList, char search, std::string search_text,bool all_chann)
{
dprintf("sendAllEvents for " PRINTF_CHANNEL_ID_TYPE "\n", serviceUniqueKey);
if(!eList.empty() && search == 0)//skip on search mode
eList.clear();
t_channel_id serviceUniqueKey64 = serviceUniqueKey& 0xFFFFFFFFFFFFULL; //0xFFFFFFFFFFFFULL for CREATE_CHANNEL_ID64
if(serviceUniqueKey64 == 0)
if(serviceUniqueKey64 == 0 && !all_chann)
return;
// service Found
readLockEvents();
int serviceIDfound = 0;
if (search_text.length())
std::transform(search_text.begin(), search_text.end(), search_text.begin(), tolower);
for (MySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey::iterator e = mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.begin(); e != mySIeventsOrderServiceUniqueKeyFirstStartTimeEventUniqueKey.end(); ++e)
{
if ((*e)->get_channel_id() == serviceUniqueKey64 || (serviceUniqueKey64 == 1)) {
if ((*e)->get_channel_id() == serviceUniqueKey64 || (all_chann)) {
serviceIDfound = 1;
bool copy = true;
if(search == 0); // nothing to do here
else if(search == 1) {
std::string eName = (*e)->getName();
std::transform(eName.begin(), eName.end(), eName.begin(), tolower);
if(eName.find(search_text) == std::string::npos)
copy = false;
if(search){
if((search == 1) || (search == 5)) {//SEARCH_EPG_TITLE == 1 SEARCH_EPG_ALL == 5 defined in eventlist.h
std::string eName = (*e)->getName();
std::transform(eName.begin(), eName.end(), eName.begin(), tolower);
if(eName.find(search_text) == std::string::npos)
copy = false;
}
if((search == 2) || (!copy && search == 5)) {//SEARCH_EPG_INFO1 == 2
std::string eText = (*e)->getText();
std::transform(eText.begin(), eText.end(), eText.begin(), tolower);
if(eText.find(search_text) == std::string::npos)
copy = false;
else if(search == 5)
copy = true;
}
if((search == 3) || (!copy && search == 5)) {//SEARCH_EPG_INFO2 == 3
std::string eExtendedText = (*e)->getExtendedText();
std::transform(eExtendedText.begin(), eExtendedText.end(), eExtendedText.begin(), tolower);
if(eExtendedText.find(search_text) == std::string::npos)
copy = false;
else if(search == 5)
copy = true;
}
}
else if(search == 2) {
std::string eText = (*e)->getText();
std::transform(eText.begin(), eText.end(), eText.begin(), tolower);
if(eText.find(search_text) == std::string::npos)
copy = false;
}
else if(search == 3) {
std::string eExtendedText = (*e)->getExtendedText();
std::transform(eExtendedText.begin(), eExtendedText.end(), eExtendedText.begin(), tolower);
if(eExtendedText.find(search_text) == std::string::npos)
copy = false;
}
if(copy) {
for (SItimes::iterator t = (*e)->times.begin(); t != (*e)->times.end(); ++t)
{
@@ -2289,7 +2291,7 @@ void CEitManager::getEventsServiceKey(t_channel_id serviceUniqueKey, CChannelEve
aEvent.text = (*e)->getExtendedText().substr(0, 120);
else
aEvent.text = (*e)->getText();
if(serviceUniqueKey64 == 1)//hack for all channel search
if(all_chann)//hack for all channel search
aEvent.channelID = (*e)->get_channel_id();
else
aEvent.channelID = serviceUniqueKey;

View File

@@ -55,7 +55,7 @@ class CEitManager : public OpenThreads::Thread, public OpenThreads::Mutex
bool Stop();
void SetConfig(CSectionsdClient::epg_config &cfg) { config = cfg; };
void getEventsServiceKey(t_channel_id serviceUniqueKey, CChannelEventList &eList, char search = 0, std::string search_text = "");
void getEventsServiceKey(t_channel_id serviceUniqueKey, CChannelEventList &eList, char search = 0, std::string search_text = "", bool all_chann=false);
void getCurrentNextServiceKey(t_channel_id uniqueServiceKey, CSectionsdClient::responseGetCurrentNextInfoChannelID& current_next );
bool getEPGidShort(event_id_t epgID, CShortEPGData * epgdata);
bool getEPGid(const event_id_t epgID, const time_t startzeit, CEPGData * epgdata);

View File

@@ -92,7 +92,6 @@ CNeutrinoEventList::CNeutrinoEventList()
sort_mode = 0;
m_search_list = SEARCH_LIST_NONE;
m_search_epg_item = SEARCH_LIST_NONE;
m_search_epg_item = SEARCH_EPG_TITLE;
m_search_channel_id = 1;
m_search_bouquet_id= 1;
@@ -1034,7 +1033,6 @@ bool CNeutrinoEventList::findEvents(void)
hide();
menu.exec(NULL,"");
search_head_name = g_Locale->getText(LOCALE_EVENTFINDER_SEARCH);
if(event == 1)
{
res = true;
@@ -1071,7 +1069,7 @@ bool CNeutrinoEventList::findEvents(void)
for (it = v.begin(); it != v.end(); ++it){
ch_id_map[*it & 0xFFFFFFFFFFFFULL] = *it;
}
CEitManager::getInstance()->getEventsServiceKey(1/*hack*/,evtlist, m_search_epg_item,m_search_keyword);
CEitManager::getInstance()->getEventsServiceKey(0,evtlist, m_search_epg_item,m_search_keyword, true);//all_chann
std::map<t_channel_id, t_channel_id>::iterator map_it;
CChannelEventList::iterator e;
@@ -1167,14 +1165,15 @@ const CMenuOptionChooser::keyval SEARCH_LIST_OPTIONS[SEARCH_LIST_OPTION_COUNT] =
};
#define SEARCH_EPG_OPTION_COUNT 3
#define SEARCH_EPG_OPTION_COUNT 4
const CMenuOptionChooser::keyval SEARCH_EPG_OPTIONS[SEARCH_EPG_OPTION_COUNT] =
{
// { CNeutrinoEventList::SEARCH_EPG_NONE, LOCALE_PICTUREVIEWER_RESIZE_NONE },
{ CNeutrinoEventList::SEARCH_EPG_TITLE, LOCALE_FONTSIZE_EPG_TITLE },
{ CNeutrinoEventList::SEARCH_EPG_INFO1, LOCALE_FONTSIZE_EPG_INFO1 },
{ CNeutrinoEventList::SEARCH_EPG_INFO2, LOCALE_FONTSIZE_EPG_INFO2 }
// ,{ CNeutrinoEventList::SEARCH_EPG_GENRE, LOCALE_MOVIEBROWSER_INFO_GENRE_MAJOR }
{ CNeutrinoEventList::SEARCH_EPG_INFO2, LOCALE_FONTSIZE_EPG_INFO2 },
// { CNeutrinoEventList::SEARCH_EPG_GENRE, LOCALE_MOVIEBROWSER_INFO_GENRE_MAJOR },
{ CNeutrinoEventList::SEARCH_EPG_ALL, LOCALE_EVENTFINDER_SEARCH_ALL_EPG }
};
@@ -1203,7 +1202,6 @@ int CEventFinderMenu::exec(CMenuTarget* parent, const std::string &actionkey)
{
int res = menu_return::RETURN_REPAINT;
if(actionkey =="")
{
if(parent != NULL)
@@ -1335,6 +1333,7 @@ int CEventFinderMenu::showMenu(void)
bool CEventFinderMenu::changeNotify(const neutrino_locale_t OptionName, void *)
/************************************************************************************************/
{
if (ARE_LOCALES_EQUAL(OptionName, LOCALE_EVENTFINDER_SEARCH_WITHIN_LIST))
{
if (*m_search_list == CNeutrinoEventList::SEARCH_LIST_CHANNEL)

View File

@@ -46,32 +46,32 @@
class CNeutrinoEventList
{
// Eventfinder start
public:
typedef enum
{
SEARCH_EPG_NONE,
SEARCH_EPG_TITLE,
SEARCH_EPG_INFO1,
SEARCH_EPG_INFO2,
SEARCH_EPG_GENRE,
SEARCH_EPG_ALL
}SEARCH_EPG;
typedef enum
{
SEARCH_LIST_NONE,
SEARCH_LIST_CHANNEL,
SEARCH_LIST_BOUQUET,
SEARCH_LIST_ALL
}SEARCH_LIST;
private:
int m_search_epg_item;
std::string m_search_keyword;
// Eventfinder start
public:
typedef enum
{
SEARCH_EPG_NONE,
SEARCH_EPG_TITLE,
SEARCH_EPG_INFO1,
SEARCH_EPG_INFO2,
SEARCH_EPG_GENRE,
SEARCH_EPG_ALL
}SEARCH_EPG;
typedef enum
{
SEARCH_LIST_NONE,
SEARCH_LIST_CHANNEL,
SEARCH_LIST_BOUQUET,
SEARCH_LIST_ALL
}SEARCH_LIST;
private:
int m_search_epg_item;
std::string m_search_keyword;
std::string m_search_autokeyword;
int m_search_list;
t_channel_id m_search_channel_id;
t_bouquet_id m_search_bouquet_id;
bool m_showChannel;
int m_search_list;
t_channel_id m_search_channel_id;
t_bouquet_id m_search_bouquet_id;
bool m_showChannel;
int FunctionBarHeight;
int oldIndex;
event_id_t oldEventID;

View File

@@ -344,6 +344,7 @@ typedef enum
LOCALE_EVENTFINDER_HEAD,
LOCALE_EVENTFINDER_KEYWORD,
LOCALE_EVENTFINDER_SEARCH,
LOCALE_EVENTFINDER_SEARCH_ALL_EPG,
LOCALE_EVENTFINDER_SEARCH_WITHIN_EPG,
LOCALE_EVENTFINDER_SEARCH_WITHIN_LIST,
LOCALE_EVENTFINDER_SEARCHING,

View File

@@ -344,6 +344,7 @@ const char * locale_real_names[] =
"eventfinder.head",
"eventfinder.keyword",
"eventfinder.search",
"eventfinder.search_all_epg",
"eventfinder.search_within_epg",
"eventfinder.search_within_list",
"eventfinder.searching",