diff --git a/data/Makefile.am b/data/Makefile.am index 1ff743d21..7dcb1ef5c 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -19,5 +19,6 @@ endif configdir = $(CONFIGDIR) config_DATA = cables.xml satellites.xml encoding.conf tobackup.conf providermap.xml settingsupdate.conf terrestrial.xml bad_package_pattern.list.sample +config_DATA += epglanguages.conf webtv_usr.xml webradio_usr.xml install-data-hook: $(INSTALL) -d $(DESTDIR)/$(CONFIGDIR)/zapit diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 6683f3a8c..540b9d65f 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -227,6 +227,7 @@ bouquetname.new Neue Kanäle bouquetname.other Unbekannter Provider bouquetname.removed Gelöschte Kanäle bouquetname.uhdtv UHD-Kanäle +bouquetname.webradio WebRadio-Kanäle bouquetname.webtv WebTV-Kanäle buildinfo.compiled_on Build Host buildinfo.compiled_with Compiler Version diff --git a/data/locale/english.locale b/data/locale/english.locale index a31cfd0ba..e63350e96 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -227,6 +227,7 @@ bouquetname.new New channels bouquetname.other Unknown provider bouquetname.removed Removed channels bouquetname.uhdtv UHD channels +bouquetname.webradio WebRadio channels bouquetname.webtv WebTV channels buildinfo.compiled_on Build Host buildinfo.compiled_with Compiler version diff --git a/data/webradio_usr.xml b/data/webradio_usr.xml new file mode 100644 index 000000000..723b703af --- /dev/null +++ b/data/webradio_usr.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index c2d670f5a..e862ca5ca 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -174,7 +174,7 @@ std::string CBEChannelWidget::getInfoText(int index) std::string satname = CServiceManager::getInstance()->GetSatelliteName((*Channels)[index]->getSatellitePosition()); if (IS_WEBTV((*Channels)[index]->getChannelID())) - satname = "WebTV"; + satname = "Web-Channel"; // TODO split into WebTV/WebRadio transponder t; CServiceManager::getInstance()->GetTransponder((*Channels)[index]->getTransponderId(), t); std::string desc = t.description(); diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 4ad6606f8..4e035795a 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -178,7 +178,7 @@ std::string CBEChannelSelectWidget::getInfoText(int index) std::string satname = CServiceManager::getInstance()->GetSatelliteName(Channels[index]->getSatellitePosition()); if (IS_WEBTV(Channels[index]->getChannelID())) - satname = "WebTV"; + satname = "Web-Channel"; // TODO split into WebTV/WebRadio transponder t; CServiceManager::getInstance()->GetTransponder(Channels[index]->getTransponderId(), t); std::string desc = t.description(); diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index fb62b4b07..214195864 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -244,9 +244,9 @@ int CBouquetList::doMenu() /* provider bouquet */ if (zapitBouquet && !zapitBouquet->bUser) { menu->addItem(new CMenuForwarder(LOCALE_FAVORITES_COPY, true, NULL, selector, cnt, CRCInput::RC_blue), old_selected == i ++); - if (!zapitBouquet->bWebtv && g_settings.epg_scan == CEpgScan::SCAN_SEL) + if ((!zapitBouquet->bWebtv && !zapitBouquet->bWebradio) && g_settings.epg_scan == CEpgScan::SCAN_SEL) menu->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SCAN, &zapitBouquet->bScanEpg, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); - if (!zapitBouquet->bWebtv) + if (!zapitBouquet->bWebtv && !zapitBouquet->bWebradio) menu->addItem(new CMenuOptionChooser(LOCALE_CI_USE, &zapitBouquet->bUseCI, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); menu->exec(NULL, ""); delete menu; @@ -315,9 +315,9 @@ int CBouquetList::doMenu() } else { /* user or satellite bouquet */ menu->addItem(new CMenuForwarder(LOCALE_BOUQUETEDITOR_DELETE, true, NULL, selector, cnt, CRCInput::RC_red), old_selected == i ++); - if (zapitBouquet && !zapitBouquet->bWebtv && (g_settings.epg_scan == CEpgScan::SCAN_SEL)) + if (zapitBouquet && (!zapitBouquet->bWebtv && !zapitBouquet->bWebradio) && (g_settings.epg_scan == CEpgScan::SCAN_SEL)) menu->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SCAN, &zapitBouquet->bScanEpg, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); - if (zapitBouquet && !zapitBouquet->bWebtv) + if (zapitBouquet && (!zapitBouquet->bWebtv && !zapitBouquet->bWebradio)) menu->addItem(new CMenuOptionChooser(LOCALE_CI_USE, &zapitBouquet->bUseCI, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true)); menu->exec(NULL, ""); diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 5f5d270cf..0406b062e 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -325,7 +325,7 @@ int CChannelList::doChannelMenu(void) CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select); bool empty = (*chanlist).empty(); - bool allow_edit = (bouquet && bouquet->zapitBouquet && !bouquet->zapitBouquet->bOther && !bouquet->zapitBouquet->bWebtv); + bool allow_edit = (bouquet && bouquet->zapitBouquet && !bouquet->zapitBouquet->bOther && (!bouquet->zapitBouquet->bWebtv && !bouquet->zapitBouquet->bWebradio)); bool got_history = (CNeutrinoApp::getInstance()->channelList->getLastChannels().size() > 1); int i = 0; diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 04ab15332..5e88987d9 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -794,7 +794,8 @@ void CInfoViewer::showTitle(CZapitChannel * channel, const bool calledFromNumZap //fprintf(stderr, "after showchannellogo, mode = %d ret = %d logo_ok = %d\n",g_settings.infobar_show_channellogo, ChannelLogoMode, logo_ok); if (g_settings.infobar_sat_display) { - std::string name = (IS_WEBTV(current_channel_id))? "WebTV" : CServiceManager::getInstance()->GetSatelliteName(satellitePosition); + // TODO split into WebTV/WebRadio + std::string name = (IS_WEBTV(current_channel_id))? "Web-Channel" : CServiceManager::getInstance()->GetSatelliteName(satellitePosition); int satNameWidth = g_SignalFont->getRenderWidth (name); std::string satname_tmp = name; if (satNameWidth > (ChanWidth - numbox_offset*2)) { diff --git a/src/gui/lua/luainstance.cpp b/src/gui/lua/luainstance.cpp index 7f7485a9a..c5291fa1d 100644 --- a/src/gui/lua/luainstance.cpp +++ b/src/gui/lua/luainstance.cpp @@ -380,6 +380,7 @@ static void set_lua_variables(lua_State *L) { "TS", (lua_Integer)CNeutrinoApp::mode_ts }, { "OFF", (lua_Integer)CNeutrinoApp::mode_off }, { "WEBTV", (lua_Integer)CNeutrinoApp::mode_webtv }, + { "WEBRADIO", (lua_Integer)CNeutrinoApp::mode_webradio }, { "MASK", (lua_Integer)CNeutrinoApp::mode_mask }, { "NOREZAP", (lua_Integer)CNeutrinoApp::norezap }, { NULL, 0 } diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index cadd41358..27229ec64 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -747,7 +747,8 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) g_Font[font_info]->RenderString(xpos, ypos, box_width, buf, COL_MENUCONTENT_TEXT); - snprintf(buf, sizeof(buf), "%s", IS_WEBTV(channel->getChannelID()) ? g_Locale->getText(LOCALE_WEBTV_HEAD) : + // TODO: split info WebTV/WebRadio + snprintf(buf, sizeof(buf), "%s", IS_WEBTV(channel->getChannelID()) ? "Web-Channel" : CServiceManager::getInstance()->GetSatelliteName(channel->getSatellitePosition()).c_str()); g_Font[font_info]->RenderString (xpos+spaceoffset, ypos, box_width2, buf, COL_MENUCONTENT_TEXT); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 3a5271bb6..2313fec6a 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -435,6 +435,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.make_hd_list = configfile.getInt32("make_hd_list", 0); g_settings.make_webtv_list = configfile.getInt32("make_webtv_list", 1); + g_settings.make_webradio_list = configfile.getInt32("make_webradio_list", 1); g_settings.make_new_list = configfile.getInt32("make_new_list", 1); g_settings.make_removed_list = configfile.getInt32("make_removed_list", 1); g_settings.keep_channel_numbers = configfile.getInt32("keep_channel_numbers", 0); @@ -700,6 +701,11 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.webtv_xml.push_back(webtv_xml); } + + std::string webradio_xml = configfile.getString("webradio_xml", WEBRADIO_XML); + if (file_size(webradio_xml.c_str())) + g_settings.webradio_xml.push_back(webradio_xml); + loadKeys(); g_settings.timeshift_pause = configfile.getInt32( "timeshift_pause", 1 ); @@ -1148,6 +1154,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32( "make_hd_list", g_settings.make_hd_list); configfile.setInt32( "make_webtv_list", g_settings.make_webtv_list); + configfile.setInt32( "make_webradio_list", g_settings.make_webradio_list); configfile.setInt32( "make_new_list", g_settings.make_new_list); configfile.setInt32( "make_removed_list", g_settings.make_removed_list); configfile.setInt32( "keep_channel_numbers", g_settings.keep_channel_numbers); @@ -1582,19 +1589,18 @@ void CNeutrinoApp::channelsInit(bool bOnly) if(RADIOwebList) delete RADIOwebList; TVchannelList = new CChannelList(g_Locale->getText(LOCALE_CHANNELLIST_HEAD), false, true); - RADIOchannelList = new CChannelList(g_Locale->getText(LOCALE_CHANNELLIST_HEAD), false, true); - TVbouquetList = new CBouquetList(g_Locale->getText(LOCALE_CHANNELLIST_PROVS)); TVfavList = new CBouquetList(g_Locale->getText(LOCALE_CHANNELLIST_FAVS)); TVwebList = new CBouquetList(g_Locale->getText(LOCALE_BOUQUETNAME_WEBTV)); - RADIOwebList = new CBouquetList(g_Locale->getText(LOCALE_BOUQUETNAME_WEBTV)); + RADIOchannelList = new CChannelList(g_Locale->getText(LOCALE_CHANNELLIST_HEAD), false, true); RADIObouquetList = new CBouquetList(g_Locale->getText(LOCALE_CHANNELLIST_PROVS)); RADIOfavList = new CBouquetList(g_Locale->getText(LOCALE_CHANNELLIST_FAVS)); + RADIOwebList = new CBouquetList(g_Locale->getText(LOCALE_BOUQUETNAME_WEBRADIO)); int tvi = 0, ri = 0; - ZapitChannelList zapitList, webtvList; + ZapitChannelList zapitList, webtvList, webradioList; /* all TV channels */ CServiceManager::getInstance()->GetAllTvChannels(zapitList); @@ -1672,6 +1678,20 @@ void CNeutrinoApp::channelsInit(bool bOnly) printf("[neutrino] got %d WebTV channels\n", (int)webtvList.size()); fflush(stdout); } } + /* all WebRadio channels */ + if (g_settings.make_webradio_list) { + if (CServiceManager::getInstance()->GetAllWebRadioChannels(webradioList)) { + /* all channels */ + CBouquet* webradioBouquet = new CBouquet(0, g_Locale->getText(LOCALE_BOUQUETNAME_WEBRADIO), false, true); + webradioBouquet->channelList->SetChannelList(&webradioList); + RADIOallList->Bouquets.push_back(webradioBouquet); + /* "satellite" */ + webradioBouquet = new CBouquet(0, g_Locale->getText(LOCALE_BOUQUETNAME_WEBRADIO), false, true); + webradioBouquet->channelList->SetChannelList(&webradioList); + RADIOsatList->Bouquets.push_back(webradioBouquet); + printf("[neutrino] got %d WebRadio channels\n", (int)webradioList.size()); fflush(stdout); + } + } /* all HD channels */ if (g_settings.make_hd_list) { if (CServiceManager::getInstance()->GetAllHDChannels(zapitList)) { @@ -1742,7 +1762,7 @@ void CNeutrinoApp::channelsInit(bool bOnly) if (b->getRadioChannels(zapitList) || (g_settings.show_empty_favorites && b->bUser)) { if(b->bUser) tmp = RADIOfavList->addBouquet(b); - else if(b->bWebtv) + else if(b->bWebradio) tmp = RADIOwebList->addBouquet(b); else tmp = RADIObouquetList->addBouquet(b); @@ -2251,6 +2271,7 @@ TIMER_START(); ZapStart_arg.ci_clock = g_settings.ci_clock; ZapStart_arg.volume = g_settings.current_volume; ZapStart_arg.webtv_xml = &g_settings.webtv_xml; + ZapStart_arg.webradio_xml = &g_settings.webradio_xml; ZapStart_arg.osd_resolution = g_settings.osd_resolution; @@ -2606,7 +2627,7 @@ void CNeutrinoApp::RealRun() } } - if( ( mode == mode_tv ) || ( mode == mode_radio ) || ( mode == mode_webtv ) ) { + if( ( mode == mode_tv ) || ( mode == mode_radio ) || ( mode == mode_webtv ) || ( mode == mode_webradio ) ) { if( (msg == NeutrinoMessages::SHOW_EPG) /* || (msg == CRCInput::RC_info) */ ) { InfoClock->enableInfoClock(false); StopSubtitles(); @@ -2739,7 +2760,18 @@ void CNeutrinoApp::RealRun() StartSubtitles(); } else if (((msg == CRCInput::RC_tv) || (msg == CRCInput::RC_radio)) && (g_settings.key_tvradio_mode == (int)CRCInput::RC_nokey)) { - switchTvRadioMode();//used with defined default tv/radio rc key + if (msg == CRCInput::RC_tv) + { + if (mode == mode_radio || mode == mode_webradio) + tvMode(); + } + else if (msg == CRCInput::RC_radio) + { + if (mode == mode_tv || mode == mode_webtv) + radioMode(); + } + else + switchTvRadioMode(); //used with defined default tv/radio rc key } /* in case key_subchannel_up/down redefined */ else if( msg == CRCInput::RC_left || msg == CRCInput::RC_right) { @@ -3046,7 +3078,11 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) if (CMoviePlayerGui::getInstance().PlayBackgroundStart(cc->getUrl(), cc->getName(), cc->getChannelID(), cc->getScriptName())) delete [] (unsigned char*) data; else + { + if (mode == mode_webtv || mode == mode_webradio) + videoDecoder->setBlank(true); g_RCInput->postMsg(NeutrinoMessages::EVT_ZAP_FAILED, data); + } } else delete [] (unsigned char*) data; } @@ -3135,7 +3171,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) /* ================================== KEYS ================================================ */ if( msg == CRCInput::RC_ok || (!g_InfoViewer->getSwitchMode() && CNeutrinoApp::getInstance()->listModeKey(msg))) { - if( (mode == mode_tv) || (mode == mode_radio) || (mode == mode_ts) || (mode == mode_webtv)) { + if( (mode == mode_tv) || (mode == mode_radio) || (mode == mode_ts) || (mode == mode_webtv) || (mode == mode_webradio)) { showChannelList(msg); return messages_return::handled; } @@ -3431,7 +3467,7 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) dvbsub_stop(); - if ((!isTVMode) && (mode != mode_radio)) { + if ((!isTVMode) && (mode != mode_radio) && (mode != mode_webradio)) { radioMode(true); } else if (isTVMode && (mode != mode_tv) && (mode != mode_webtv)) { @@ -3517,8 +3553,9 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) else if( msg == NeutrinoMessages::RELOAD_SETUP ) { bool tmp1 = g_settings.make_hd_list; bool tmp2 = g_settings.make_webtv_list; + bool tmp3 = g_settings.make_webradio_list; loadSetup(NEUTRINO_SETTINGS_FILE); - if(tmp1 != g_settings.make_hd_list || tmp2 != g_settings.make_webtv_list) + if(tmp1 != g_settings.make_hd_list || tmp2 != g_settings.make_webtv_list || tmp3 != g_settings.make_webradio_list) g_Zapit->reinitChannels(); SendSectionsdConfig(); @@ -3652,9 +3689,12 @@ int CNeutrinoApp::handleMsg(const neutrino_msg_t _msg, neutrino_msg_data_t data) lastMode=mode; mode=mode_ts; } - if((data & mode_mask)== mode_webtv) { + if((data & mode_mask)== mode_webtv || (data & mode_mask)== mode_webradio) { lastMode=mode; - mode=mode_webtv; + if ((data & mode_mask) == mode_webtv) + mode=mode_webtv; + else + mode=mode_webradio; if ((data & norezap) != norezap) { CZapitChannel * cc = CZapit::getInstance()->GetCurrentChannel(); if (cc && IS_WEBTV(cc->getChannelID())) { @@ -4021,7 +4061,7 @@ void CNeutrinoApp::tvMode( bool rezap ) CRecordManager::getInstance()->StopAutoRecord(); } #endif - if (mode != mode_webtv) { + if (mode != mode_webtv || mode != mode_webradio) { frameBuffer->useBackground(false); frameBuffer->paintBackground(); } @@ -4064,7 +4104,7 @@ void CNeutrinoApp::scartMode( bool bOnOff ) #endif mode = mode_unknown; //re-set mode - if( lastMode == mode_radio ) { + if( lastMode == mode_radio || lastMode == mode_webradio) { radioMode( false ); } else if( lastMode == mode_tv || lastMode == mode_webtv) { @@ -4244,7 +4284,7 @@ void CNeutrinoApp::radioMode( bool rezap) { //printf("radioMode: rezap %s\n", rezap ? "yes" : "no"); INFO("rezap %d current mode %d", rezap, mode); - if (mode == mode_webtv) { + if (mode == mode_webtv || mode == mode_webradio) { CMoviePlayerGui::getInstance().setLastMode(mode_unknown); CMoviePlayerGui::getInstance().stopPlayBack(); CVFD::getInstance()->ShowIcon(FP_ICON_TV, false); @@ -4269,7 +4309,7 @@ void CNeutrinoApp::radioMode( bool rezap) #endif CRecordManager::getInstance()->StopAutoRecord(); - if (mode != mode_webtv) { + if (mode != mode_webtv || mode != mode_webradio) { frameBuffer->useBackground(false); frameBuffer->paintBackground(); } @@ -4311,7 +4351,7 @@ void CNeutrinoApp::switchTvRadioMode(const int prev_mode) else if(prev_mode == mode_radio && mode != mode_radio) radioMode(); } else { - if (mode == mode_radio ) + if (mode == mode_radio || mode == mode_webradio) tvMode(); else if(mode == mode_tv || mode == mode_webtv) radioMode(); @@ -5105,7 +5145,8 @@ bool CNeutrinoApp::adjustToChannelID(const t_channel_id channel_id) TVallList->adjustToChannelID(channel_id); } - else if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_radio) { + else if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_radio + || CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_webradio) { has_channel = RADIOfavList->adjustToChannelID(channel_id); if (has_channel && first_mode_found < 0) first_mode_found = LIST_MODE_FAV; diff --git a/src/neutrino.h b/src/neutrino.h index b70f5586f..7b99b3612 100644 --- a/src/neutrino.h +++ b/src/neutrino.h @@ -156,6 +156,7 @@ public: mode_off = 8, mode_webtv = 9, mode_upnp = 10, + mode_webradio = 11, mode_mask = 0xFF, norezap = 0x100 }; diff --git a/src/neutrinoMessages.h b/src/neutrinoMessages.h index 81f77fa6c..d0fa25562 100644 --- a/src/neutrinoMessages.h +++ b/src/neutrinoMessages.h @@ -182,6 +182,7 @@ struct NeutrinoMessages { mode_ts = 7, mode_webtv = 9, mode_upnp = 10, + mode_webradio = 11, mode_mask = 0xFF, norezap = 0x100 }; diff --git a/src/system/locals.h b/src/system/locals.h index c48667857..03da88351 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -254,6 +254,7 @@ typedef enum LOCALE_BOUQUETNAME_OTHER, LOCALE_BOUQUETNAME_REMOVED, LOCALE_BOUQUETNAME_UHDTV, + LOCALE_BOUQUETNAME_WEBRADIO, LOCALE_BOUQUETNAME_WEBTV, LOCALE_BUILDINFO_COMPILED_ON, LOCALE_BUILDINFO_COMPILED_WITH, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index b20d0242f..b6cfdcedf 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -254,6 +254,7 @@ const char * locale_real_names[] = "bouquetname.other", "bouquetname.removed", "bouquetname.uhdtv", + "bouquetname.webradio", "bouquetname.webtv", "buildinfo.compiled_on", "buildinfo.compiled_with", diff --git a/src/system/settings.h b/src/system/settings.h index 85ad9cec9..c16086540 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -255,6 +255,7 @@ struct SNeutrinoSettings int standby_cpufreq; int make_hd_list; int make_webtv_list; + int make_webradio_list; int make_new_list; int make_removed_list; int keep_channel_numbers; @@ -315,6 +316,7 @@ struct SNeutrinoSettings std::string ifname; std::list webtv_xml; + std::list webradio_xml; //personalize enum PERSONALIZE_SETTINGS //settings.h diff --git a/src/zapit/include/zapit/bouquets.h b/src/zapit/include/zapit/bouquets.h index 2adc88f4b..49ae8e21a 100644 --- a/src/zapit/include/zapit/bouquets.h +++ b/src/zapit/include/zapit/bouquets.h @@ -43,6 +43,7 @@ class CZapitBouquet bool bOther; int bScanEpg; bool bWebtv; // dont save + bool bWebradio; // dont save int bUseCI; t_satellite_position satellitePosition; @@ -59,6 +60,7 @@ class CZapitBouquet bOther = DEFAULT_BQ_OTHER; bScanEpg = DEFAULT_BQ_SCANEPG; bWebtv = false; + bWebradio = false; bUseCI = false; } @@ -148,6 +150,8 @@ class CBouquetManager void setBouquetLock(const unsigned int id, bool state); void setBouquetLock(CZapitBouquet* bouquet, bool state); void loadWebtv(); + void loadWebradio(); + void loadWebchannels(int mode); //bouquet writeChannelsNames selection options enum{ BWN_NEVER, diff --git a/src/zapit/include/zapit/channel.h b/src/zapit/include/zapit/channel.h index bd0973ec4..ba601e27c 100644 --- a/src/zapit/include/zapit/channel.h +++ b/src/zapit/include/zapit/channel.h @@ -121,13 +121,13 @@ class CZapitChannel private: /* channel name */ std::string name; - /* scripts for webtv livestreams */ + /* scripts for webtv/webradio livestreams */ std::string script; /* TODO : Enable different unames in different bouquets ( generated bouquetID ? ) */ std::string uname; t_channel_id epg_id; - /* WebTV */ + /* WebTV/WebRadio */ std::string url; std::string desc; @@ -210,7 +210,7 @@ class CZapitChannel /* constructor, desctructor */ CZapitChannel(const std::string & p_name, t_service_id p_sid, t_transport_stream_id p_tsid, t_original_network_id p_onid, unsigned char p_service_type, t_satellite_position p_satellite_position, freq_id_t freq, const std::string script_name=""); CZapitChannel(const std::string & p_name, t_channel_id p_channel_id, unsigned char p_service_type, t_satellite_position p_satellite_position, freq_id_t p_freq, const std::string script_name=""); - CZapitChannel(const char *p_name, t_channel_id p_channel_id, const char *p_url, const char *p_desc, t_channel_id epgid = 0, const char* script_name=NULL); + CZapitChannel(const char *p_name, t_channel_id p_channel_id, const char *p_url, const char *p_desc, t_channel_id epgid = 0, const char* script_name=NULL, int MODE = 0 /*MODE_WEBTV*/); ~CZapitChannel(void); /* get methods - read only variables */ diff --git a/src/zapit/include/zapit/getservices.h b/src/zapit/include/zapit/getservices.h index 5ca49e89c..ed0fa2bed 100644 --- a/src/zapit/include/zapit/getservices.h +++ b/src/zapit/include/zapit/getservices.h @@ -144,6 +144,7 @@ class CServiceManager bool GetAllHDChannels(ZapitChannelList &list, int flags = CZapitChannel::PRESENT); bool GetAllUHDChannels(ZapitChannelList &list, int flags = CZapitChannel::PRESENT); bool GetAllWebTVChannels(ZapitChannelList &list, int flags = CZapitChannel::PRESENT); + bool GetAllWebRadioChannels(ZapitChannelList &list, int flags = CZapitChannel::PRESENT); bool GetAllSatelliteChannels(ZapitChannelList &list, t_satellite_position position, int flags = CZapitChannel::PRESENT); bool GetAllTransponderChannels(ZapitChannelList &list, transponder_id_t tpid, int flags = CZapitChannel::PRESENT); bool GetAllUnusedChannels(ZapitChannelList &list, int flags = CZapitChannel::PRESENT); diff --git a/src/zapit/include/zapit/settings.h b/src/zapit/include/zapit/settings.h index d22b11ddd..570e0c72a 100644 --- a/src/zapit/include/zapit/settings.h +++ b/src/zapit/include/zapit/settings.h @@ -49,6 +49,7 @@ #define SATELLITES_XML CONFIGDIR "/satellites.xml" #define TERRESTRIAL_XML CONFIGDIR "/terrestrial.xml" #define WEBTV_XML CONFIGDIR "/webtv_usr.xml" +#define WEBRADIO_XML CONFIGDIR "/webradio_usr.xml" #if HAVE_TRIPLEDRAGON == 0 #define AUDIO_DEVICE "/dev/dvb/adapter0/audio0" diff --git a/src/zapit/include/zapit/zapit.h b/src/zapit/include/zapit/zapit.h index 2d34ea1a3..690374e13 100644 --- a/src/zapit/include/zapit/zapit.h +++ b/src/zapit/include/zapit/zapit.h @@ -46,8 +46,14 @@ typedef struct ZAPIT_start_arg int volume; int ci_clock; std::list *webtv_xml; + std::list *webradio_xml; } Z_start_arg; +enum { + MODE_WEBTV = 0, + MODE_WEBRADIO +}; + typedef struct Zapit_config { int writeChannelsNames; int makeRemainingChannelsBouquet; @@ -118,6 +124,7 @@ class CZapit : public OpenThreads::Thread int volume_percent; std::list *webtv_xml; + std::list *webradio_xml; int currentMode; bool playbackStopForced; @@ -271,5 +278,8 @@ class CZapit : public OpenThreads::Thread void unlockPlayBack(const bool sendpmt = true); void Rezap(); std::list *GetWebTVXML(void) { return webtv_xml; } + std::list *GetWebRadioXML(void) { return webradio_xml; } + bool getUseChannelFilter(); + void setMoviePlayer(bool enable); }; #endif /* __zapit_h__ */ diff --git a/src/zapit/src/bouquets.cpp b/src/zapit/src/bouquets.cpp index 81c85792f..a584cc0d0 100644 --- a/src/zapit/src/bouquets.cpp +++ b/src/zapit/src/bouquets.cpp @@ -273,7 +273,7 @@ void CBouquetManager::saveBouquets(void) for (unsigned int i = 0; i < Bouquets.size(); i++) { if (Bouquets[i] != remainChannels) { DBG("save Bouquets: name %s user: %d\n", Bouquets[i]->Name.c_str(), Bouquets[i]->bUser); - if(!Bouquets[i]->bUser && !Bouquets[i]->bWebtv) { + if(!Bouquets[i]->bUser && (!Bouquets[i]->bWebtv || !Bouquets[i]->bWebradio)) { writeBouquet(bouq_fd, i,false); } } @@ -508,6 +508,7 @@ void CBouquetManager::loadBouquets(bool ignoreBouquetFile) } loadWebtv(); + loadWebradio(); parseBouquetsXml(UBOUQUETS_XML, true); renumServices(); CServiceManager::getInstance()->SetCIFilter(); @@ -810,13 +811,23 @@ CZapitBouquet* CBouquetManager::addBouquetIfNotExist(const std::string &name) void CBouquetManager::loadWebtv() { - std::list *webtv_xml = CZapit::getInstance()->GetWebTVXML(); - if (!webtv_xml) + loadWebchannels(MODE_WEBTV); +} + +void CBouquetManager::loadWebradio() +{ + loadWebchannels(MODE_WEBRADIO); +} + +void CBouquetManager::loadWebchannels(int mode) +{ + std::list *webchannels_xml = (mode == MODE_WEBTV) ? CZapit::getInstance()->GetWebTVXML() : CZapit::getInstance()->GetWebRadioXML(); + if (!webchannels_xml) return; - for (std::list::iterator it = webtv_xml->begin(); it != webtv_xml->end(); ++it) { + for (std::list::iterator it = webchannels_xml->begin(); it != webchannels_xml->end(); ++it) { if (!access((*it).c_str(), R_OK)) { - INFO("Loading webtv from %s ...", (*it).c_str()); + INFO("Loading %s from %s ...", (mode == MODE_WEBTV) ? "webtv" : "webradio", (*it).c_str()); xmlDocPtr parser = parseXmlFile((*it).c_str()); if (parser == NULL) continue; @@ -827,11 +838,14 @@ void CBouquetManager::loadWebtv() CZapitBouquet* pbouquet = NULL; const char *prov = xmlGetAttribute(l0, "name"); if (!prov) - prov = "WebTV"; + prov = (mode == MODE_WEBTV) ? "WebTV" : "WebRadio"; pbouquet = addBouquetIfNotExist(prov); - pbouquet->bWebtv = true; + if (mode == MODE_WEBTV) + pbouquet->bWebtv = true; + else + pbouquet->bWebradio = true; - while ((xmlGetNextOccurence(l1, "webtv"))) { + while ((xmlGetNextOccurence(l1, (mode == MODE_WEBTV) ? "webtv" : "webradio"))) { const char *title = xmlGetAttribute(l1, "title"); const char *url = xmlGetAttribute(l1, "url"); const char *desc = xmlGetAttribute(l1, "description"); @@ -846,11 +860,14 @@ void CBouquetManager::loadWebtv() if (genre) { std::string bname = prov ? std::string(std::string(prov) + " ") + genre : genre; gbouquet = addBouquetIfNotExist(bname); - gbouquet->bWebtv = true; + if (mode == MODE_WEBTV) + gbouquet->bWebtv = true; + else + gbouquet->bWebradio = true; } if (title && url) { t_channel_id chid = create_channel_id64(0, 0, 0, 0, 0, url); - CZapitChannel * channel = new CZapitChannel(title, chid, url, desc, epg_id, script); + CZapitChannel * channel = new CZapitChannel(title, chid, url, desc, epg_id, script, mode); CServiceManager::getInstance()->AddChannel(channel); channel->flags = CZapitChannel::UPDATED; if (gbouquet) diff --git a/src/zapit/src/channel.cpp b/src/zapit/src/channel.cpp index ecf5cbf2a..17c0cf2b8 100644 --- a/src/zapit/src/channel.cpp +++ b/src/zapit/src/channel.cpp @@ -58,8 +58,8 @@ CZapitChannel::CZapitChannel(const std::string & p_name, t_channel_id p_channel_ Init(); } -// For WebTV ... -CZapitChannel::CZapitChannel(const char *p_name, t_channel_id p_channel_id, const char *p_url, const char *p_desc, t_channel_id epgid, const char* script_name) +// For WebTV/WebRadio ... +CZapitChannel::CZapitChannel(const char *p_name, t_channel_id p_channel_id, const char *p_url, const char *p_desc, t_channel_id epgid, const char* script_name, int mode) { if (!p_name || !p_url) return; @@ -71,7 +71,10 @@ CZapitChannel::CZapitChannel(const char *p_name, t_channel_id p_channel_id, cons service_id = 0; transport_stream_id = 0; original_network_id = 0; - serviceType = ST_DIGITAL_TELEVISION_SERVICE; + if (mode == MODE_WEBTV) + serviceType = ST_DIGITAL_TELEVISION_SERVICE; + else + serviceType = ST_DIGITAL_RADIO_SOUND_SERVICE; satellitePosition = 0; freq = 0; epg_id = epgid; diff --git a/src/zapit/src/getservices.cpp b/src/zapit/src/getservices.cpp index dd63e1fca..52a2dfe75 100644 --- a/src/zapit/src/getservices.cpp +++ b/src/zapit/src/getservices.cpp @@ -313,7 +313,17 @@ bool CServiceManager::GetAllWebTVChannels(ZapitChannelList &list, int flags) { list.clear(); for (channel_map_iterator_t it = allchans.begin(); it != allchans.end(); ++it) { - if ((it->second.flags & flags) && !it->second.getUrl().empty()) + if ((it->second.flags & flags) && !it->second.getUrl().empty() && (it->second.getServiceType() == ST_DIGITAL_TELEVISION_SERVICE)) + list.push_back(&(it->second)); + } + return (!list.empty()); +} + +bool CServiceManager::GetAllWebRadioChannels(ZapitChannelList &list, int flags) +{ + list.clear(); + for (channel_map_iterator_t it = allchans.begin(); it != allchans.end(); ++it) { + if ((it->second.flags & flags) && !it->second.getUrl().empty() && (it->second.getServiceType() == ST_DIGITAL_RADIO_SOUND_SERVICE)) list.push_back(&(it->second)); } return (!list.empty()); diff --git a/src/zapit/src/zapit.cpp b/src/zapit/src/zapit.cpp index 281a7a308..b83be82c6 100644 --- a/src/zapit/src/zapit.cpp +++ b/src/zapit/src/zapit.cpp @@ -2469,6 +2469,7 @@ bool CZapit::Start(Z_start_arg *ZapStart_arg) current_volume = ZapStart_arg->volume; webtv_xml = ZapStart_arg->webtv_xml; + webradio_xml = ZapStart_arg->webradio_xml; videoDemux = new cDemux(); videoDemux->Open(DMX_VIDEO_CHANNEL);