diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index c84063a86..71f8d8023 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1514,6 +1514,7 @@ miscsettings.epg_old_events EPG verwerfen nach (Std.) miscsettings.epg_old_events_hint1 Wie lange abgelaufene EPG-Daten aufheben? miscsettings.epg_old_events_hint2 Angabe in Stunden miscsettings.epg_read Gespeicherte EPG-Daten einlesen +miscsettings.epg_read_frequently EPG regelmäßig einlesen miscsettings.epg_save EPG zwischenspeichern miscsettings.epg_save_frequently EPG regelmäßig speichern miscsettings.epg_save_mode Nur Favoriten diff --git a/data/locale/english.locale b/data/locale/english.locale index b6b6e62f1..4b1e7e87b 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1514,6 +1514,7 @@ miscsettings.epg_old_events EPG remove after (std.) miscsettings.epg_old_events_hint1 How long will EPG-Data be stored after they timed out? miscsettings.epg_old_events_hint2 Set in hours miscsettings.epg_read Restore EPG on boot +miscsettings.epg_read_frequently Restore EPG frequently miscsettings.epg_save Save EPG on shutdown miscsettings.epg_save_frequently Save EPG frequently miscsettings.epg_save_mode Favorites only diff --git a/lib/sectionsdclient/sectionsdMsg.h b/lib/sectionsdclient/sectionsdMsg.h index 9b6b666a4..440feabae 100644 --- a/lib/sectionsdclient/sectionsdMsg.h +++ b/lib/sectionsdclient/sectionsdMsg.h @@ -102,6 +102,7 @@ struct sectionsd // std::string network_ntpserver; // std::string epg_dir; int epg_save_frequently; + int epg_read_frequently; }; }; diff --git a/lib/sectionsdclient/sectionsdclient.cpp b/lib/sectionsdclient/sectionsdclient.cpp index e4dcee4e5..c6be1fac2 100644 --- a/lib/sectionsdclient/sectionsdclient.cpp +++ b/lib/sectionsdclient/sectionsdclient.cpp @@ -207,6 +207,7 @@ void CSectionsdClient::setConfig(const epg_config config) msg->network_ntpenable = config.network_ntpenable; msg->epg_extendedcache = config.epg_extendedcache; msg->epg_save_frequently= config.epg_save_frequently; + msg->epg_read_frequently= config.epg_read_frequently; // config.network_ntpserver: strcpy(&pData[sizeof(sectionsd::commandSetConfig)], config.network_ntpserver.c_str()); // config.epg_dir: diff --git a/lib/sectionsdclient/sectionsdclient.h b/lib/sectionsdclient/sectionsdclient.h index 1f70b01f2..c827d83b5 100644 --- a/lib/sectionsdclient/sectionsdclient.h +++ b/lib/sectionsdclient/sectionsdclient.h @@ -163,6 +163,7 @@ class CSectionsdClient : private CBasicClient int epg_extendedcache; std::string network_ntpserver; int epg_save_frequently; + int epg_read_frequently; std::string epg_dir; } epg_config; diff --git a/src/eitd/sectionsd.cpp b/src/eitd/sectionsd.cpp index 91e6b0dfa..e131b423d 100644 --- a/src/eitd/sectionsd.cpp +++ b/src/eitd/sectionsd.cpp @@ -72,7 +72,7 @@ static bool notify_complete = false; /* period to clean cached sections and force restart sections read */ #define META_HOUSEKEEPING_COUNT (24 * 60 * 60) / HOUSEKEEPING_SLEEP // meta housekeeping after XX housekeepings - every 24h - #define STANDBY_HOUSEKEEPING_COUNT (60 * 60) / HOUSEKEEPING_SLEEP -#define EPG_SAVE_FREQUENTLY_COUNT (60 * 60) / HOUSEKEEPING_SLEEP +#define EPG_SERVICE_FREQUENTLY_COUNT (60 * 60) / HOUSEKEEPING_SLEEP // Timeout bei tcp/ip connections in ms #define READ_TIMEOUT_IN_SECONDS 2 @@ -85,6 +85,7 @@ static bool notify_complete = false; #define TIMEOUTS_EIT_VERSION_WAIT (2 * CHECK_RESTART_DMX_AFTER_TIMEOUTS) static unsigned int epg_save_frequently; +static unsigned int epg_read_frequently; static long secondsToCache; long int secondsExtendedTextCache = 0; static long oldEventsAre; @@ -1126,6 +1127,8 @@ static void commandSetConfig(int connfd, char *data, const unsigned /*dataLength secondsExtendedTextCache = (long)(pmsg->epg_extendedcache)*60L*60L; max_events = pmsg->epg_max_events; epg_save_frequently = pmsg->epg_save_frequently; + epg_read_frequently = pmsg->epg_read_frequently; + unlockEvents(); bool time_wakeup = false; @@ -2093,7 +2096,7 @@ static void *houseKeepingThread(void *) removeOldEvents(oldEventsAre); // alte Events ecount++; - if (ecount == EPG_SAVE_FREQUENTLY_COUNT) + if (ecount == EPG_SERVICE_FREQUENTLY_COUNT) { if (epg_save_frequently > 0) { @@ -2106,6 +2109,22 @@ static void *houseKeepingThread(void *) } writeEventsToFile(d.c_str()); } + if (epg_read_frequently > 0) + { + pthread_t thrInsert; + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + std::string d = epg_dir + "/"; + + printf("[%s]: %s\n",__func__,d.c_str()); + + if (pthread_create (&thrInsert, &attr, insertEventsfromFile, (void *)d.c_str() )) + { + perror("sectionsd: pthread_create()"); + } + pthread_attr_destroy(&attr); + } ecount = 0; } @@ -2163,6 +2182,7 @@ bool CEitManager::Start() oldEventsAre = config.epg_old_events*60L*60L; //hours max_events = config.epg_max_events; epg_save_frequently = config.epg_save_frequently; + epg_read_frequently = config.epg_read_frequently; if (find_executable("ntpdate").empty()){ ntp_system_cmd_prefix = find_executable("ntpd"); diff --git a/src/gui/miscsettings_menu.cpp b/src/gui/miscsettings_menu.cpp index e6ce615ca..49bafb4bd 100644 --- a/src/gui/miscsettings_menu.cpp +++ b/src/gui/miscsettings_menu.cpp @@ -69,6 +69,7 @@ CMiscMenue::CMiscMenue() epg_save_standby = NULL; epg_save_frequently = NULL; epg_read = NULL; + epg_read_frequently = NULL; epg_dir = NULL; } @@ -409,12 +410,15 @@ void CMiscMenue::showMiscSettingsMenuEpg(CMenuWidget *ms_epg) epg_save_standby = new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SAVE_STANDBY, &g_settings.epg_save_standby, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, g_settings.epg_save); epg_save_standby->setHint("", LOCALE_MENU_HINT_EPG_SAVE_STANDBY); - epg_save_frequently = new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SAVE_FREQUENTLY, &g_settings.epg_save_frequently, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, g_settings.epg_save, sectionsdConfigNotifier); + epg_save_frequently = new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SAVE_FREQUENTLY, &g_settings.epg_save_frequently, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, g_settings.epg_save, this); epg_save_frequently->setHint("", LOCALE_MENU_HINT_EPG_SAVE_FREQUENTLY); epg_read = new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_READ, &g_settings.epg_read, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this); epg_read->setHint("", LOCALE_MENU_HINT_EPG_READ); + epg_read_frequently = new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_READ_FREQUENTLY, &g_settings.epg_read_frequently, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, g_settings.epg_read, this); + epg_read_frequently->setHint("", LOCALE_MENU_HINT_EPG_READ_FREQUENTLY); + epg_dir = new CMenuForwarder(LOCALE_MISCSETTINGS_EPG_DIR, (g_settings.epg_save || g_settings.epg_read), g_settings.epg_dir, this, "epgdir"); epg_dir->setHint("", LOCALE_MENU_HINT_EPG_DIR); @@ -462,6 +466,7 @@ void CMiscMenue::showMiscSettingsMenuEpg(CMenuWidget *ms_epg) ms_epg->addItem(epg_save_standby); ms_epg->addItem(epg_save_frequently); ms_epg->addItem(epg_read); + ms_epg->addItem(epg_read_frequently); ms_epg->addItem(epg_dir); ms_epg->addItem(GenericMenuSeparatorLine); ms_epg->addItem(mf); @@ -635,7 +640,28 @@ bool CMiscMenue::changeNotify(const neutrino_locale_t OptionName, void * /*data* } else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_EPG_READ)) { - epg_dir->setActive(g_settings.epg_save || g_settings.epg_read); + epg_read_frequently->setActive(g_settings.epg_read); + epg_dir->setActive(g_settings.epg_read || g_settings.epg_save); + + CNeutrinoApp::getInstance()->SendSectionsdConfig(); + + ret = menu_return::RETURN_REPAINT; + } + else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_EPG_READ_FREQUENTLY)) + { + g_settings.epg_read_frequently = g_settings.epg_read ? g_settings.epg_read_frequently : 0; + + CNeutrinoApp::getInstance()->SendSectionsdConfig(); + + ret = menu_return::RETURN_REPAINT; + } + else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_EPG_SAVE_FREQUENTLY)) + { + g_settings.epg_save_frequently = g_settings.epg_save ? g_settings.epg_save_frequently : 0; + + CNeutrinoApp::getInstance()->SendSectionsdConfig(); + + ret = menu_return::RETURN_REPAINT; } else if (ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_EPG_SCAN)) { diff --git a/src/gui/miscsettings_menu.h b/src/gui/miscsettings_menu.h index 8e5848ef8..b8bbaa1a7 100644 --- a/src/gui/miscsettings_menu.h +++ b/src/gui/miscsettings_menu.h @@ -45,6 +45,7 @@ class CMiscMenue : public CMenuTarget, CChangeObserver CMenuOptionChooser * epg_save_standby; CMenuOptionChooser * epg_save_frequently; CMenuOptionChooser * epg_read; + CMenuOptionChooser * epg_read_frequently; CMenuOptionChooser * epg_scan; CMenuOptionChooser * tmdb_onoff; CMenuOptionChooser * youtube_onoff; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index a983575b6..d83f98a0b 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -559,8 +559,9 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.epg_save = configfile.getBool("epg_save", false); g_settings.epg_save_standby = configfile.getBool("epg_save_standby", true); - g_settings.epg_save_frequently = configfile.getInt32("epg_save_frequently", false); + g_settings.epg_save_frequently = configfile.getInt32("epg_save_frequently", 0); g_settings.epg_read = configfile.getBool("epg_read", g_settings.epg_save); + g_settings.epg_read_frequently = configfile.getInt32("epg_read_frequently", 0); g_settings.epg_scan = configfile.getInt32("epg_scan", CEpgScan::SCAN_CURRENT); g_settings.epg_scan_mode = configfile.getInt32("epg_scan_mode", CEpgScan::MODE_OFF); // backward-compatible check @@ -1146,6 +1147,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setBool("epg_save_standby", g_settings.epg_save_standby); configfile.setInt32("epg_save_frequently", g_settings.epg_save_frequently); configfile.setBool("epg_read", g_settings.epg_read); + configfile.setInt32("epg_read_frequently", g_settings.epg_read_frequently); 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); @@ -1839,6 +1841,7 @@ void CNeutrinoApp::MakeSectionsdConfig(CSectionsdClient::epg_config& config) config.epg_max_events = g_settings.epg_max_events; config.epg_extendedcache = g_settings.epg_extendedcache; config.epg_save_frequently = g_settings.epg_save ? g_settings.epg_save_frequently : 0; + config.epg_read_frequently = g_settings.epg_read ? g_settings.epg_read_frequently : 0; config.epg_dir = g_settings.epg_dir; config.network_ntpserver = g_settings.network_ntpserver; config.network_ntprefresh = atoi(g_settings.network_ntprefresh.c_str()); @@ -1857,6 +1860,7 @@ void CNeutrinoApp::InitZapper() struct stat my_stat; g_InfoViewer->start(); + SendSectionsdConfig(); if (g_settings.epg_read) { if(stat(g_settings.epg_dir.c_str(), &my_stat) == 0) g_Sectionsd->readSIfromXML(g_settings.epg_dir.c_str()); diff --git a/src/system/locals.h b/src/system/locals.h index 866567c49..b29341ef7 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1067,6 +1067,7 @@ typedef enum LOCALE_MENU_HINT_EPG_MAX_EVENTS, LOCALE_MENU_HINT_EPG_OLD_EVENTS, LOCALE_MENU_HINT_EPG_READ, + LOCALE_MENU_HINT_EPG_READ_FREQUENTLY, LOCALE_MENU_HINT_EPG_SAVE, LOCALE_MENU_HINT_EPG_SAVE_FREQUENTLY, LOCALE_MENU_HINT_EPG_SAVE_MODE, @@ -1541,6 +1542,7 @@ typedef enum LOCALE_MISCSETTINGS_EPG_OLD_EVENTS_HINT1, LOCALE_MISCSETTINGS_EPG_OLD_EVENTS_HINT2, LOCALE_MISCSETTINGS_EPG_READ, + LOCALE_MISCSETTINGS_EPG_READ_FREQUENTLY, LOCALE_MISCSETTINGS_EPG_SAVE, LOCALE_MISCSETTINGS_EPG_SAVE_FREQUENTLY, LOCALE_MISCSETTINGS_EPG_SAVE_MODE, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 90954b5c6..bf61c27ac 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1067,6 +1067,7 @@ const char * locale_real_names[] = "menu.hint_epg_max_events", "menu.hint_epg_old_events", "menu.hint_epg_read", + "menu.hint_epg_read_frequently", "menu.hint_epg_save", "menu.hint_epg_save_frequently", "menu.hint_epg_save_mode", @@ -1541,6 +1542,7 @@ const char * locale_real_names[] = "miscsettings.epg_old_events_hint1", "miscsettings.epg_old_events_hint2", "miscsettings.epg_read", + "miscsettings.epg_read_frequently", "miscsettings.epg_save", "miscsettings.epg_save_frequently", "miscsettings.epg_save_mode", diff --git a/src/system/settings.h b/src/system/settings.h index f32e10d47..359bbd4af 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -280,6 +280,7 @@ struct SNeutrinoSettings int epg_save_standby; int epg_save_frequently; int epg_read; + int epg_read_frequently; int epg_cache; int epg_old_events; int epg_max_events;