diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index a4cc13643..0e62192ec 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1525,6 +1525,7 @@ menu.hint_volume_digits Zifferndarstellung der Lautstärkeanzeige ein- oder auss menu.hint_volume_pos Wählen Sie die Position der Lautstärkeanzeige aus menu.hint_volume_size Wählen Sie die Höhe der Lautstärkeanzeige menu.hint_webradio_setup Hier konfigurierte WebRadio-Kanäle finden Sie in der Kanalverwaltung. +menu.hint_webradio_xml_auto Lädt automatisch alle WebRadio-Dateien aus %s/ und %s/ menu.hint_webtv_setup Hier konfigurierte WebTV-Kanäle finden Sie in der Kanalverwaltung. menu.hint_webtv_xml_auto Lädt automatisch alle WebTV-Dateien aus %s/ und %s/ menu.hint_window_size Kanalliste, EPG-Infos und einige andere Fenster werden mit diesem Faktor skaliert @@ -2568,6 +2569,7 @@ videomenu.videoformat_43 4:3 videomenu.videomode Videosystem webradio.head WebRadio webradio.xml WebRadio-Dateien +webradio.xml.auto WebRadio-Dateien automatisch laden webtv.head WebTV webtv.xml WebTV-Dateien webtv.xml.add Hinzufügen diff --git a/data/locale/english.locale b/data/locale/english.locale index 3dff7d723..6cc46167f 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1525,6 +1525,7 @@ menu.hint_volume_digits Numeric display of the volumebar on/off menu.hint_volume_pos Select volume indicator position menu.hint_volume_size Select volume indicator height menu.hint_webradio_setup WebRadio channels configured here will be available in the standard channel lists. +menu.hint_webradio_xml_auto Auto-load all existing WebRadio files from %s/ and %s/ menu.hint_webtv_setup WebTV channels configured here will be available in the standard channel lists. menu.hint_webtv_xml_auto Auto-load all existing WebTV files from %s/ and %s/ menu.hint_window_size Channellist, EPG-infos and some other windows are scaled by this factor @@ -2568,6 +2569,7 @@ videomenu.videoformat_43 4:3 videomenu.videomode Digital video mode webradio.head WebRadio webradio.xml WebRadio files +webradio.xml.auto Auto-load WebRadio files webtv.head WebTV webtv.xml WebTV files webtv.xml.add Add diff --git a/src/gui/webtv_setup.cpp b/src/gui/webtv_setup.cpp index 1d629d603..fa0e84f56 100644 --- a/src/gui/webtv_setup.cpp +++ b/src/gui/webtv_setup.cpp @@ -210,34 +210,38 @@ int CWebTVSetup::Show() m->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, webradio ? LOCALE_WEBRADIO_XML : LOCALE_WEBTV_XML)); - if (!webradio) - { - - // TODO: show/hide autoloaded content when switching g_settings.webtv_xml_auto + // TODO: show/hide autoloaded content when switching g_settings.webradio/webtv_xml_auto + CMenuOptionChooser *oc; char hint_text[1024]; - snprintf(hint_text, sizeof(hint_text) - 1, g_Locale->getText(LOCALE_MENU_HINT_WEBTV_XML_AUTO), WEBTVDIR, WEBTVDIR_VAR); - CMenuOptionChooser *oc = new CMenuOptionChooser(LOCALE_WEBTV_XML_AUTO, &g_settings.webtv_xml_auto, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this, CRCInput::convertDigitToKey(shortcut++)); + if (webradio) + { + snprintf(hint_text, sizeof(hint_text) - 1, g_Locale->getText(LOCALE_MENU_HINT_WEBRADIO_XML_AUTO), WEBRADIODIR, WEBRADIODIR_VAR); + oc = new CMenuOptionChooser(LOCALE_WEBRADIO_XML_AUTO, &g_settings.webradio_xml_auto, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this, CRCInput::convertDigitToKey(shortcut++)); + } + else + { + snprintf(hint_text, sizeof(hint_text) - 1, g_Locale->getText(LOCALE_MENU_HINT_WEBTV_XML_AUTO), WEBTVDIR, WEBTVDIR_VAR); + oc = new CMenuOptionChooser(LOCALE_WEBTV_XML_AUTO, &g_settings.webtv_xml_auto, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this, CRCInput::convertDigitToKey(shortcut++)); + } oc->setHint("", hint_text); m->addItem(oc); m->addItem(GenericMenuSeparator); item_offset = m->getItemsCount(); - // show autoloaded webtv files + // show autoloaded webradio/webtvtv files for (std::list::iterator it = webchannels.begin(); it != webchannels.end(); ++it) { - if (webtv_xml_autodir((*it))) + if (webchannels_autodir((*it))) m->addItem(new CMenuForwarder(*it, false, "auto")); } if (item_offset < m->getItemsCount()) m->addItem(GenericMenuSeparator); - } - item_offset = m->getItemsCount(); - // show users webtv files + // show users webradio/webtv files for (std::list::iterator it = webchannels.begin(); it != webchannels.end(); ++it) { - if (!webtv_xml_autodir((*it))) + if (!webchannels_autodir((*it))) m->addItem(new CMenuForwarder(*it, true, NULL, this, "c")); } @@ -257,7 +261,6 @@ int CWebTVSetup::Show() CMenuForwarder *f = static_cast(item); webchannels.push_back(f->getName()); } - webtv_xml_auto(); if (webradio) { g_settings.webradio_xml.clear(); @@ -268,6 +271,7 @@ int CWebTVSetup::Show() g_settings.webtv_xml.clear(); g_settings.webtv_xml = webchannels; } + webchannels_auto(); g_Zapit->reinitChannels(); changed = false; hint.hide(); @@ -305,41 +309,71 @@ int filefilter(const struct dirent *entry) return 0; } - -void CWebTVSetup::webtv_xml_auto() +// webradio wrapper for webchannels_auto() +void CWebTVSetup::webradio_xml_auto() { - // TODO: g_settings.webradio_xml_auto? - if (webradio) + if (!g_settings.webradio_xml_auto) return; - if (g_settings.webtv_xml_auto) - { - const char *dirs[] = {WEBTVDIR_VAR, WEBTVDIR}; - struct dirent **filelist; - char webtv_file[1024] = {0}; - for (int i = 0; i < 2; i++) - { - int file_count = scandir(dirs[i], &filelist, filefilter, alphasort); - if (file_count > -1) - { - for (int count = 0; count < file_count; count++) - { - snprintf(webtv_file, sizeof(webtv_file), "%s/%s", dirs[i], filelist[count]->d_name); - if (file_size(webtv_file)) - { - bool found = false; - for (std::list::iterator it = g_settings.webtv_xml.begin(); it != g_settings.webtv_xml.end(); it++) - found |= ((*it).find(filelist[count]->d_name) != std::string::npos); + webradio = true; + webchannels_auto(); +} - if (!found) - { - printf("[CWebTVSetup] loading: %s\n", webtv_file); - g_settings.webtv_xml.push_back(webtv_file); - } +// webtv wrapper for webchannels_auto() +void CWebTVSetup::webtv_xml_auto() +{ + if (!g_settings.webtv_xml_auto) + return; + + webradio = false; + webchannels_auto(); +} + +void CWebTVSetup::webchannels_auto() +{ + std::list webchannels; + const char *dirs[2]; + + if (webradio) + { + webchannels = g_settings.webradio_xml; + dirs[0] = WEBRADIODIR_VAR; + dirs[1] = WEBRADIODIR; + } + else + { + webchannels = g_settings.webtv_xml; + dirs[0] = WEBTVDIR_VAR; + dirs[1] = WEBTVDIR; + } + + struct dirent **filelist; + char webchannel_file[1024] = {0}; + for (int i = 0; i < 2; i++) + { + int file_count = scandir(dirs[i], &filelist, filefilter, alphasort); + if (file_count > -1) + { + for (int count = 0; count < file_count; count++) + { + snprintf(webchannel_file, sizeof(webchannel_file), "%s/%s", dirs[i], filelist[count]->d_name); + if (file_size(webchannel_file)) + { + bool found = false; + for (std::list::iterator it = webchannels.begin(); it != webchannels.end(); it++) + found |= ((*it).find(filelist[count]->d_name) != std::string::npos); + + if (!found) + { + printf("[CWebTVSetup] loading: %s\n", webchannel_file); + if (webradio) + g_settings.webradio_xml.push_back(webchannel_file); else - { - printf("[CWebTVSetup] skipping: %s\n", webtv_file); - } + g_settings.webtv_xml.push_back(webchannel_file); + } + else + { + printf("[CWebTVSetup] skipping: %s\n", webchannel_file); } } } @@ -347,14 +381,40 @@ void CWebTVSetup::webtv_xml_auto() } } +// webradio wrapper for webchannels_autodir() +bool CWebTVSetup::webradio_xml_autodir(std::string directory) +{ + webradio = true; + return webchannels_autodir(directory); +} + +// webtv wrapper for webchannels_autodir() bool CWebTVSetup::webtv_xml_autodir(std::string directory) { - if ( - (directory.empty()) - || (directory.find(WEBTVDIR) != std::string::npos) - || (directory.find(WEBTVDIR_VAR) != std::string::npos) - ) - return true; + webradio = false; + return webchannels_autodir(directory); +} + +bool CWebTVSetup::webchannels_autodir(std::string directory) +{ + if (webradio) + { + if ( + (directory.empty()) + || (directory.find(WEBRADIODIR) != std::string::npos) + || (directory.find(WEBRADIODIR_VAR) != std::string::npos) + ) + return true; + } + else + { + if ( + (directory.empty()) + || (directory.find(WEBTVDIR) != std::string::npos) + || (directory.find(WEBTVDIR_VAR) != std::string::npos) + ) + return true; + } return false; } diff --git a/src/gui/webtv_setup.h b/src/gui/webtv_setup.h index 8f87e245c..5735277e7 100644 --- a/src/gui/webtv_setup.h +++ b/src/gui/webtv_setup.h @@ -42,8 +42,15 @@ class CWebTVSetup : public CMenuTarget, CChangeObserver int exec(CMenuTarget *parent, const std::string &actionKey); int Show(); bool changeNotify(const neutrino_locale_t OptionName, void *data); + + void webradio_xml_auto(); + bool webradio_xml_autodir(std::string directory); + void webtv_xml_auto(); bool webtv_xml_autodir(std::string directory); + + void webchannels_auto(); + bool webchannels_autodir(std::string directory); }; class CWebTVResolution : public CMenuTarget diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 0217d533e..1a941fe0c 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -724,6 +724,7 @@ int CNeutrinoApp::loadSetup(const char * fname) CWebTVSetup webtvsetup; webtvsetup.webtv_xml_auto(); + g_settings.webradio_xml_auto = configfile.getInt32("webradio_xml_auto", 1); g_settings.webradio_xml.clear(); #ifndef BOXMODEL_CS_HD1 /* @@ -745,6 +746,8 @@ int CNeutrinoApp::loadSetup(const char * fname) if (file_size(webradio_xml.c_str())) g_settings.webradio_xml.push_back(webradio_xml); } + + webtvsetup.webradio_xml_auto(); #endif g_settings.xmltv_xml.clear(); @@ -1443,6 +1446,8 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setString ( "plugins_lua", g_settings.plugins_lua ); configfile.setString ( "logo_hdd_dir", g_settings.logo_hdd_dir ); + + CWebTVSetup webtvsetup; configfile.setInt32("webtv_xml_auto", g_settings.webtv_xml_auto); int webtv_count = 0; for (std::list::iterator it = g_settings.webtv_xml.begin(); it != g_settings.webtv_xml.end(); ++it) { @@ -1452,9 +1457,12 @@ void CNeutrinoApp::saveSetup(const char * fname) } configfile.setInt32 ( "webtv_xml_count", g_settings.webtv_xml.size()); + configfile.setInt32("webradio_xml_auto", g_settings.webradio_xml_auto); int webradio_count = 0; for (std::list::iterator it = g_settings.webradio_xml.begin(); it != g_settings.webradio_xml.end(); ++it) { std::string k = "webradio_xml_" + to_string(webradio_count); + if (webtvsetup.webradio_xml_autodir((*it))) + continue; configfile.setString(k, *it); webradio_count++; } diff --git a/src/system/locals.h b/src/system/locals.h index f2b95da28..74f91a5e6 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1552,6 +1552,7 @@ typedef enum LOCALE_MENU_HINT_VOLUME_POS, LOCALE_MENU_HINT_VOLUME_SIZE, LOCALE_MENU_HINT_WEBRADIO_SETUP, + LOCALE_MENU_HINT_WEBRADIO_XML_AUTO, LOCALE_MENU_HINT_WEBTV_SETUP, LOCALE_MENU_HINT_WEBTV_XML_AUTO, LOCALE_MENU_HINT_WINDOW_SIZE, @@ -2595,6 +2596,7 @@ typedef enum LOCALE_VIDEOMENU_VIDEOMODE, LOCALE_WEBRADIO_HEAD, LOCALE_WEBRADIO_XML, + LOCALE_WEBRADIO_XML_AUTO, LOCALE_WEBTV_HEAD, LOCALE_WEBTV_XML, LOCALE_WEBTV_XML_ADD, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index 25486a9ea..85a5b7ad3 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1552,6 +1552,7 @@ const char * locale_real_names[] = "menu.hint_volume_pos", "menu.hint_volume_size", "menu.hint_webradio_setup", + "menu.hint_webradio_xml_auto", "menu.hint_webtv_setup", "menu.hint_webtv_xml_auto", "menu.hint_window_size", @@ -2595,6 +2596,7 @@ const char * locale_real_names[] = "videomenu.videomode", "webradio.head", "webradio.xml", + "webradio.xml.auto", "webtv.head", "webtv.xml", "webtv.xml.add", diff --git a/src/system/settings.h b/src/system/settings.h index 3efa68a89..3491c21ed 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -280,8 +280,12 @@ struct SNeutrinoSettings int ci_ignore_messages; int ci_save_pincode; int ci_tuner; + + std::string ci_pincode; int radiotext_enable; + int webradio_xml_auto; + int webtv_xml_auto; //screen saver int screensaver_delay; @@ -330,7 +334,7 @@ struct SNeutrinoSettings std::list webtv_xml; std::list webradio_xml; std::list xmltv_xml; // see http://wiki.xmltv.org/ - int webtv_xml_auto; + //personalize enum PERSONALIZE_SETTINGS //settings.h