gui/miscsettings_menu.cpp: add option to cache EPG only for favorite channels,

filter not yet reconfigured after scan or editing favorite bouquets
This commit is contained in:
[CST] Focus
2015-01-22 18:52:42 +03:00
parent 486d3692a6
commit d98d94550f
9 changed files with 64 additions and 9 deletions

View File

@@ -959,6 +959,7 @@ menu.hint_epg_old_events Hours after event end time to consider\nevent old and r
menu.hint_epg_read Read saved EPG data after boot from an external device
menu.hint_epg_save Save cached EPG data to an external device
menu.hint_epg_save_frequently Save cached EPG data in frequently intervals to an external device
menu.hint_epg_save_mode Cache EPG only for channels present in favorite bouquets
menu.hint_epg_save_standby Save EPG on soft standby mode
menu.hint_epg_scan Select bouquets to scan epg, current on zap,\nall or selected favorites
menu.hint_epg_scan_mode Enable background epg scan using free tuner
@@ -1403,6 +1404,7 @@ miscsettings.epg_old_events_hint2 Set in hours
miscsettings.epg_read Restore EPG on boot
miscsettings.epg_save Save EPG on shutdown
miscsettings.epg_save_frequently Save EPG frequently
miscsettings.epg_save_mode Favorites only
miscsettings.epg_save_standby Save EPG on soft standby
miscsettings.epg_scan EPG scan mode
miscsettings.epg_scan_always Always

View File

@@ -43,6 +43,7 @@
extern CBouquetList * bouquetList;
extern CBouquetList * TVfavList;
extern CBouquetList * RADIOfavList;
extern CBouquetList * TVbouquetList;
CEpgScan::CEpgScan()
@@ -66,6 +67,33 @@ CEpgScan * CEpgScan::getInstance()
return inst;
}
void CEpgScan::ConfigureEIT()
{
CEitManager::getInstance()->clearChannelFilters();
if (g_settings.epg_save_mode == 0)
return;
int count = 0;
for (unsigned j = 0; j < TVfavList->Bouquets.size(); ++j) {
CChannelList * clist = TVfavList->Bouquets[j]->channelList;
for (unsigned i = 0; i < clist->Size(); i++) {
CZapitChannel * chan = clist->getChannelFromIndex(i);
CEitManager::getInstance()->addChannelFilter(chan->getOriginalNetworkId(), chan->getTransportStreamId(), chan->getServiceId());
count++;
}
}
for (unsigned j = 0; j < RADIOfavList->Bouquets.size(); ++j) {
CChannelList * clist = RADIOfavList->Bouquets[j]->channelList;
for (unsigned i = 0; i < clist->Size(); i++) {
CZapitChannel * chan = clist->getChannelFromIndex(i);
CEitManager::getInstance()->addChannelFilter(chan->getOriginalNetworkId(), chan->getTransportStreamId(), chan->getServiceId());
count++;
}
}
INFO("added %d channels to EIT white list\n", count);
}
void CEpgScan::Clear()
{
scanmap.clear();

View File

@@ -74,6 +74,7 @@ class CEpgScan
void Start(bool instandby = false);
void Stop();
bool Running();
void ConfigureEIT();
};
#endif

View File

@@ -301,7 +301,6 @@ int CMiscMenue::showMiscSettingsMenu()
delete fanNotifier;
delete sectionsdConfigNotifier;
delete miscEpgScanNotifier;
return res;
}
@@ -457,17 +456,18 @@ void CMiscMenue::showMiscSettingsMenuEpg(CMenuWidget *ms_epg)
CMenuForwarder * mf3 = new CMenuDForwarder(LOCALE_MISCSETTINGS_EPG_MAX_EVENTS, true, epg_max_events, miscSettings_epg_max_events);
mf3->setHint("", LOCALE_MENU_HINT_EPG_MAX_EVENTS);
CMenuOptionChooser * mc2 = new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SCAN_BOUQUETS, &g_settings.epg_scan, EPG_SCAN_OPTIONS, EPG_SCAN_OPTION_COUNT,
g_settings.epg_scan_mode != CEpgScan::MODE_OFF);
mc2->setHint("", LOCALE_MENU_HINT_EPG_SCAN);
miscEpgScanNotifier = new COnOffNotifier();
miscEpgScanNotifier->addItem(mc2);
epg_scan = new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SCAN_BOUQUETS, &g_settings.epg_scan, EPG_SCAN_OPTIONS, EPG_SCAN_OPTION_COUNT,
g_settings.epg_scan_mode != CEpgScan::MODE_OFF && g_settings.epg_save_mode == 0);
epg_scan->setHint("", LOCALE_MENU_HINT_EPG_SCAN);
CMenuOptionChooser * mc3 = new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SCAN, &g_settings.epg_scan_mode, EPG_SCAN_MODE_OPTIONS,
CFEManager::getInstance()->getEnabledCount() > 1 ? EPG_SCAN_MODE_OPTION_COUNT : 2, true, miscEpgScanNotifier);
CFEManager::getInstance()->getEnabledCount() > 1 ? EPG_SCAN_MODE_OPTION_COUNT : 2, true, this);
mc3->setHint("", LOCALE_MENU_HINT_EPG_SCAN_MODE);
CMenuOptionChooser * mc4 = new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SAVE_MODE, &g_settings.epg_save_mode, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT,
true, this);
mc4->setHint("", LOCALE_MENU_HINT_EPG_SAVE_MODE);
ms_epg->addItem(epg_save);
ms_epg->addItem(epg_save_standby);
ms_epg->addItem(epg_save_frequently);
@@ -478,9 +478,10 @@ void CMiscMenue::showMiscSettingsMenuEpg(CMenuWidget *ms_epg)
ms_epg->addItem(mf1);
ms_epg->addItem(mf2);
ms_epg->addItem(mf3);
ms_epg->addItem(mc4);
ms_epg->addItem(GenericMenuSeparatorLine);
ms_epg->addItem(mc3);
ms_epg->addItem(mc2);
ms_epg->addItem(epg_scan);
}
//filebrowser settings
@@ -601,6 +602,16 @@ bool CMiscMenue::changeNotify(const neutrino_locale_t OptionName, void * /*data*
{
epg_dir->setActive(g_settings.epg_save || g_settings.epg_read);
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_EPG_SCAN))
{
epg_scan->setActive(g_settings.epg_scan_mode != CEpgScan::MODE_OFF && g_settings.epg_save_mode == 0);
}
else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_EPG_SAVE_MODE))
{
g_settings.epg_scan = CEpgScan::SCAN_FAV;
epg_scan->setActive(g_settings.epg_scan_mode != CEpgScan::MODE_OFF && g_settings.epg_save_mode == 0);
ret = menu_return::RETURN_REPAINT;
}
return ret;
}

View File

@@ -46,6 +46,7 @@ class CMiscMenue : public CMenuTarget, CChangeObserver
CMenuOptionChooser * epg_save_standby;
CMenuOptionChooser * epg_save_frequently;
CMenuOptionChooser * epg_read;
CMenuOptionChooser * epg_scan;
CMenuForwarder * epg_dir;
int width;
std::string epg_cache;

View File

@@ -533,6 +533,7 @@ int CNeutrinoApp::loadSetup(const char * fname)
g_settings.epg_scan = CEpgScan::SCAN_CURRENT;
g_settings.epg_scan_mode = CEpgScan::MODE_OFF;
}
g_settings.epg_save_mode = configfile.getInt32("epg_save_mode", 0);
//widget settings
g_settings.widget_fade = false;
g_settings.widget_fade = configfile.getBool("widget_fade" , false );
@@ -1044,6 +1045,7 @@ void CNeutrinoApp::saveSetup(const char * fname)
configfile.setBool("epg_read", g_settings.epg_read);
configfile.setInt32("epg_scan", g_settings.epg_scan);
configfile.setInt32("epg_scan_mode", g_settings.epg_scan_mode);
configfile.setInt32("epg_save_mode", g_settings.epg_save_mode);
configfile.setInt32("epg_cache_time" ,g_settings.epg_cache );
configfile.setInt32("epg_extendedcache_time" ,g_settings.epg_extendedcache);
configfile.setInt32("epg_old_events" ,g_settings.epg_old_events );
@@ -1522,6 +1524,7 @@ void CNeutrinoApp::channelsInit(bool bOnly)
TIMER_STOP("[neutrino] took");
SetChannelMode(lastChannelMode);
CEpgScan::getInstance()->ConfigureEIT();
dprintf(DEBUG_DEBUG, "\nAll bouquets-channels received\n");
}
@@ -2241,10 +2244,14 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu)
int old_ttx = g_settings.cacheTXT;
int old_epg = g_settings.epg_scan;
int old_mode = g_settings.epg_scan_mode;
int old_save_mode = g_settings.epg_save_mode;
mainMenu.exec(NULL, "");
InfoClock->enableInfoClock(true);
StartSubtitles();
saveSetup(NEUTRINO_SETTINGS_FILE);
if (old_save_mode != g_settings.epg_save_mode)
CEpgScan::getInstance()->ConfigureEIT();
if (old_epg != g_settings.epg_scan || old_mode != g_settings.epg_scan_mode) {
if (g_settings.epg_scan_mode != CEpgScan::MODE_OFF)
CEpgScan::getInstance()->Start();

View File

@@ -986,6 +986,7 @@ typedef enum
LOCALE_MENU_HINT_EPG_READ,
LOCALE_MENU_HINT_EPG_SAVE,
LOCALE_MENU_HINT_EPG_SAVE_FREQUENTLY,
LOCALE_MENU_HINT_EPG_SAVE_MODE,
LOCALE_MENU_HINT_EPG_SAVE_STANDBY,
LOCALE_MENU_HINT_EPG_SCAN,
LOCALE_MENU_HINT_EPG_SCAN_MODE,
@@ -1430,6 +1431,7 @@ typedef enum
LOCALE_MISCSETTINGS_EPG_READ,
LOCALE_MISCSETTINGS_EPG_SAVE,
LOCALE_MISCSETTINGS_EPG_SAVE_FREQUENTLY,
LOCALE_MISCSETTINGS_EPG_SAVE_MODE,
LOCALE_MISCSETTINGS_EPG_SAVE_STANDBY,
LOCALE_MISCSETTINGS_EPG_SCAN,
LOCALE_MISCSETTINGS_EPG_SCAN_ALWAYS,

View File

@@ -986,6 +986,7 @@ const char * locale_real_names[] =
"menu.hint_epg_read",
"menu.hint_epg_save",
"menu.hint_epg_save_frequently",
"menu.hint_epg_save_mode",
"menu.hint_epg_save_standby",
"menu.hint_epg_scan",
"menu.hint_epg_scan_mode",
@@ -1430,6 +1431,7 @@ const char * locale_real_names[] =
"miscsettings.epg_read",
"miscsettings.epg_save",
"miscsettings.epg_save_frequently",
"miscsettings.epg_save_mode",
"miscsettings.epg_save_standby",
"miscsettings.epg_scan",
"miscsettings.epg_scan_always",

View File

@@ -234,6 +234,7 @@ struct SNeutrinoSettings
std::string epg_dir;
int epg_scan;
int epg_scan_mode;
int epg_save_mode;
int epg_search_history_size;
int epg_search_history_max;