diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index c96ab58b0..b719d9f56 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1720,6 +1720,7 @@ menu.hint_volume_size Wählen Sie die Höhe der Lautstärkeanzeige 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 +menu.hint_xmltv_setup Hier konfigurieren Sie XMLTV-Dateien, die EPG-Daten enthalten menu.hint_youtube_dev_id Geben Sie die YouTube Dev ID ein. Eine leere Eingabe schaltet die YouTube-Unterstützung aus menu.hint_youtube_enabled Schaltet die YouTube-Unterstützung ein oder aus menu.hint_ytplay Wiedergabe von ausgewählten YouTube Feeds @@ -2822,6 +2823,12 @@ wizard.welcome_text Neutrino ist eine von der Tuxbox-Community entwickelte und g word.after nach word.from ab word.in in +xmltv.head XMLTV +xmltv.xml XMLTV-Dateien +xmltv.xml.add Hinzufügen +xmltv.xml.del Entfernen +xmltv.xml.enter Eintragen +xmltv.xml.reload Neu laden youtube.dev_id YouTube Dev ID youtube.enabled YouTube-Unterstützung zapit.scantype Service-Auswahl diff --git a/data/locale/english.locale b/data/locale/english.locale index 7c82fcc37..95180e527 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1720,6 +1720,7 @@ menu.hint_volume_size Select volume indicator height 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 +menu.hint_xmltv_setup Configure XMLTV files with EPG data to describe TV listings menu.hint_youtube_dev_id Type your YouTube Dev ID. An empty input disables YouTube support menu.hint_youtube_enabled Enable or disable YouTube support menu.hint_ytplay Play selected YouTube feeds @@ -2822,6 +2823,12 @@ wizard.welcome_text Neutrino is designed for set-top boxes and is maintained by word.after after word.from from word.in in +xmltv.head XMLTV +xmltv.xml XMLTV files +xmltv.xml.add Add +xmltv.xml.del Remove +xmltv.xml.enter Enter +xmltv.xml.reload Reload youtube.dev_id YouTube Dev ID youtube.enabled YouTube support zapit.scantype scan for services diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index 8a47b3438..26c4694e1 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -114,6 +114,7 @@ libneutrino_gui_a_SOURCES = \ videosettings.cpp \ volumebar.cpp \ webtv_setup.cpp \ + xmltv_setup.cpp \ zapit_setup.cpp #if BOXTYPE_ARMBOX diff --git a/src/gui/mediaplayer_setup.cpp b/src/gui/mediaplayer_setup.cpp index 2eb01bcea..1c3b704ac 100644 --- a/src/gui/mediaplayer_setup.cpp +++ b/src/gui/mediaplayer_setup.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -97,11 +98,18 @@ int CMediaPlayerSetup::showMediaPlayerSetup() mf->setHint(NEUTRINO_ICON_HINT_PICVIEW, LOCALE_MENU_HINT_PICTUREVIEWER_SETUP); mediaSetup->addItem(mf); + mediaSetup->addItem(GenericMenuSeparator); + CWebTVSetup wsetup; mf = new CMenuForwarder(LOCALE_WEBTV_HEAD, true, NULL, &wsetup, "show_menu", CRCInput::RC_yellow); mf->setHint(NEUTRINO_ICON_HINT_TVMODE /* FIXME */, LOCALE_MENU_HINT_WEBTV_SETUP); mediaSetup->addItem(mf); + CXMLTVSetup xmltvsetup; + mf = new CMenuForwarder(LOCALE_XMLTV_HEAD, true, NULL, &xmltvsetup, "show_menu", CRCInput::RC_blue); + mf->setHint(NEUTRINO_ICON_HINT_TVMODE /* FIXME */, LOCALE_MENU_HINT_XMLTV_SETUP); + mediaSetup->addItem(mf); + mediaSetup->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_MAINMENU_MOVIEPLAYER)); CMovieBrowser msetup; diff --git a/src/gui/xmltv_setup.cpp b/src/gui/xmltv_setup.cpp new file mode 100644 index 000000000..5957023f0 --- /dev/null +++ b/src/gui/xmltv_setup.cpp @@ -0,0 +1,190 @@ +/* + XMLTV setup menue + + Copyright (C) 2018 'vanhofen' + Homepage: http://www.neutrino-images.de/ + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "xmltv_setup.h" + +#include +#include +#include + +CXMLTVSetup::CXMLTVSetup() +{ + width = 55; + selected = -1; + item_offset = 0; + changed = false; +} + +CXMLTVSetup::~CXMLTVSetup() +{ +} + +static const struct button_label CXMLTVSetupFooterButtons[] = +{ + { NEUTRINO_ICON_BUTTON_RED, LOCALE_XMLTV_XML_DEL }, + { NEUTRINO_ICON_BUTTON_GREEN, LOCALE_XMLTV_XML_ADD }, + { NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_XMLTV_XML_ENTER }, + { NEUTRINO_ICON_BUTTON_BLUE, LOCALE_XMLTV_XML_RELOAD } +}; +#define CXMLTVSetupFooterButtonCount (sizeof(CXMLTVSetupFooterButtons)/sizeof(button_label)) + +int CXMLTVSetup::exec(CMenuTarget *parent, const std::string &actionKey) +{ + int res = menu_return::RETURN_REPAINT; + + if (actionKey == "d" /* delete */) + { + selected = m->getSelected(); + if (selected >= item_offset) + { + m->removeItem(selected); + m->hide(); + selected = m->getSelected(); + changed = true; + } + return res; + } + if (actionKey == "c" /* change */) + { + selected = m->getSelected(); + CMenuItem *item = m->getItem(selected); + CMenuForwarder *f = static_cast(item); + std::string dirname(f->getName()); + if (strstr(dirname.c_str(), "://")) + { + std::string entry = dirname; + + CKeyboardInput *e = new CKeyboardInput(LOCALE_XMLTV_XML_ENTER, &entry, 50); + e->exec(this, ""); + delete e; + + if (entry.compare(dirname) != 0) + { + f->setName(entry); + changed = true; + } + } + else + { + CFileBrowser fileBrowser; + CFileFilter fileFilter; + fileFilter.addFilter("xml"); + fileBrowser.Filter = &fileFilter; + + dirname = dirname.substr(0, dirname.rfind('/')); + if (fileBrowser.exec(dirname.c_str())) + { + f->setName(fileBrowser.getSelectedFile()->Name); + changed = true; + } + } + return res; + } + if (actionKey == "a" /* add */) + { + CFileBrowser fileBrowser; + CFileFilter fileFilter; + fileFilter.addFilter("xml"); + fileBrowser.Filter = &fileFilter; + if (fileBrowser.exec("/tmp")) // /tmp ? + { + std::string s = fileBrowser.getSelectedFile()->Name; + m->addItem(new CMenuForwarder(s, true, NULL, this, "c")); + changed = true; + } + return res; + } + if (actionKey == "e" /* enter */) + { + std::string tpl = "http://xxx.xxx.xxx.xxx/control/xmltv.xml"; + std::string entry = tpl; + + CKeyboardInput *e = new CKeyboardInput(LOCALE_XMLTV_XML_ENTER, &entry, 50); + e->exec(this, ""); + delete e; + + if (entry.compare(tpl) != 0) + { + m->addItem(new CMenuForwarder(entry, true, NULL, this, "c")); + changed = true; + } + return res; + } + if (actionKey == "r" /* reload */) + { + changed = true; + return menu_return::RETURN_EXIT_ALL; + } + + if (parent) + parent->hide(); + + res = Show(); + + return res; +} + +int CXMLTVSetup::Show() +{ + item_offset = 0; + + m = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_STREAMING, width, MN_WIDGET_ID_XMLTVSETUP); + m->addKey(CRCInput::RC_red, this, "d"); + m->addKey(CRCInput::RC_green, this, "a"); + m->addKey(CRCInput::RC_yellow, this, "e"); + m->addKey(CRCInput::RC_blue, this, "r"); + + m->addIntroItems(LOCALE_XMLTV_HEAD, LOCALE_XMLTV_XML); + + item_offset = m->getItemsCount(); + // show users xmltv files + for (std::list::iterator it = g_settings.xmltv_xml.begin(); it != g_settings.xmltv_xml.end(); ++it) + { + m->addItem(new CMenuForwarder(*it, true, NULL, this, "c")); + } + + m->setFooter(CXMLTVSetupFooterButtons, CXMLTVSetupFooterButtonCount); + + int res = m->exec(NULL, ""); + m->hide(); + + if (changed) + { + g_settings.xmltv_xml.clear(); + for (int i = item_offset; i < m->getItemsCount(); i++) + { + CMenuItem *item = m->getItem(i); + CMenuForwarder *f = static_cast(item); + g_settings.xmltv_xml.push_back(f->getName()); + } + + for (std::list::iterator it = g_settings.xmltv_xml.begin(); it != g_settings.xmltv_xml.end(); ++it) + { + printf("Reading xmltv epg from %s ...\n", (*it).c_str()); + g_Sectionsd->readSIfromXMLTV((*it).c_str()); + } + } + + delete m; + return res; +} diff --git a/src/gui/xmltv_setup.h b/src/gui/xmltv_setup.h new file mode 100644 index 000000000..187d3c309 --- /dev/null +++ b/src/gui/xmltv_setup.h @@ -0,0 +1,45 @@ +/* + XMLTV setup menue + + Copyright (C) 2018 'vanhofen' + Homepage: http://www.neutrino-images.de/ + + License: GPL + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __xmltv_setup_h__ +#define __xmltv_setup_h__ + +#include + +class CXMLTVSetup : public CMenuTarget +{ + private: + int width; + int selected; + int item_offset; + bool changed; + CMenuWidget *m; + + public: + CXMLTVSetup(); + ~CXMLTVSetup(); + int exec(CMenuTarget *parent, const std::string &actionKey); + int Show(); +}; + +#endif diff --git a/src/neutrino_menue.h b/src/neutrino_menue.h index 2117e359f..7b210d397 100644 --- a/src/neutrino_menue.h +++ b/src/neutrino_menue.h @@ -108,10 +108,13 @@ enum MN_WIDGET_ID //audio setup MN_WIDGET_ID_AUDIOSETUP, - //web tv setup + //webtv setup MN_WIDGET_ID_WEBTVSETUP, MN_WIDGET_ID_LIVESTREAM_RESOLUTION, + //xmltv setup + MN_WIDGET_ID_XMLTVSETUP, + //misc settings MN_WIDGET_ID_MISCSETUP, MN_WIDGET_ID_MISCSETUP_GENERAL, diff --git a/src/system/locals.h b/src/system/locals.h index 7b700843a..32deffe9a 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -1747,6 +1747,7 @@ typedef enum LOCALE_MENU_HINT_WEBTV_SETUP, LOCALE_MENU_HINT_WEBTV_XML_AUTO, LOCALE_MENU_HINT_WINDOW_SIZE, + LOCALE_MENU_HINT_XMLTV_SETUP, LOCALE_MENU_HINT_YOUTUBE_DEV_ID, LOCALE_MENU_HINT_YOUTUBE_ENABLED, LOCALE_MENU_HINT_YTPLAY, @@ -2849,6 +2850,12 @@ typedef enum LOCALE_WORD_AFTER, LOCALE_WORD_FROM, LOCALE_WORD_IN, + LOCALE_XMLTV_HEAD, + LOCALE_XMLTV_XML, + LOCALE_XMLTV_XML_ADD, + LOCALE_XMLTV_XML_DEL, + LOCALE_XMLTV_XML_ENTER, + LOCALE_XMLTV_XML_RELOAD, LOCALE_YOUTUBE_DEV_ID, LOCALE_YOUTUBE_ENABLED, LOCALE_ZAPIT_SCANTYPE, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index c9bed483e..5085ad53a 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -1747,6 +1747,7 @@ const char * locale_real_names[] = "menu.hint_webtv_setup", "menu.hint_webtv_xml_auto", "menu.hint_window_size", + "menu.hint_xmltv_setup", "menu.hint_youtube_dev_id", "menu.hint_youtube_enabled", "menu.hint_ytplay", @@ -2849,6 +2850,12 @@ const char * locale_real_names[] = "word.after", "word.from", "word.in", + "xmltv.head", + "xmltv.xml", + "xmltv.xml.add", + "xmltv.xml.del", + "xmltv.xml.enter", + "xmltv.xml.reload", "youtube.dev_id", "youtube.enabled", "zapit.scantype",