diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp index 1699c025b..554410638 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.cpp @@ -190,7 +190,7 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]= {"updatebouquet", &CControlAPI::updateBouquetCGI, "text/plain"}, // utils {"build_live_url", &CControlAPI::build_live_url, ""}, - + {"get_logo", &CControlAPI::logoCGI, "text/plain"}, }; //----------------------------------------------------------------------------- @@ -844,11 +844,13 @@ void CControlAPI::GetBouquetCGI(CyhookHandler *hh) PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS "\n\t" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS - "\n\t\n\n", + "\n\t\n\n\n", num + j, channel->channel_id, channel->channel_id&0xFFFFFFFFFFFFULL, - channel->getName().c_str()); + channel->getName().c_str(), + NeutrinoAPI->getLogoFile(hh->WebserverConfigList["Tuxbox.LogosURL"], channel->channel_id).c_str() + ); } hh->WriteLn(""); } @@ -1927,3 +1929,12 @@ void CControlAPI::build_live_url(CyhookHandler *hh) hh->Write(url); } } +//------------------------------------------------------------------------- +void CControlAPI::logoCGI(CyhookHandler *hh) +{ + t_channel_id channel_id; + sscanf(hh->ParamList["1"].c_str(), + SCANF_CHANNEL_ID_TYPE, + &channel_id); + hh->Write(NeutrinoAPI->getLogoFile(hh->WebserverConfigList["Tuxbox.LogosURL"], channel_id)); +} diff --git a/src/nhttpd/tuxboxapi/coolstream/controlapi.h b/src/nhttpd/tuxboxapi/coolstream/controlapi.h index 26cbd8c40..3a515228b 100644 --- a/src/nhttpd/tuxboxapi/coolstream/controlapi.h +++ b/src/nhttpd/tuxboxapi/coolstream/controlapi.h @@ -94,6 +94,7 @@ private: void changeBouquetCGI(CyhookHandler *hh); void updateBouquetCGI(CyhookHandler *hh); void build_live_url(CyhookHandler *hh); + void logoCGI(CyhookHandler *hh); protected: static const unsigned int PLUGIN_DIR_COUNT = 5; diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp index c1310c1ef..4d0bbc1f9 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.cpp @@ -479,3 +479,21 @@ std::string CNeutrinoAPI::getCryptInfoAsString(void) { return out.str(); } +//------------------------------------------------------------------------- +std::string CNeutrinoAPI::getLogoFile(std::string _logoURL, t_channel_id channelId) { + std::string channelIdAsString = string_printf( PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS , channelId & 0xFFFFFFFFFFFFULL); + std::string channelName = GetServiceName(channelId); + replace(channelName, " ", "_"); + _logoURL+="/"; + if(access((_logoURL + channelIdAsString + ".jpg").c_str(), 4) == 0) + return _logoURL + channelIdAsString + ".jpg"; + else if (access((_logoURL + channelIdAsString + ".gif").c_str(), 4) == 0) + return _logoURL + channelIdAsString + ".gif"; + else if (access((_logoURL + channelName + ".jpg").c_str(), 4) == 0) + return _logoURL + channelName + ".jpg"; + else if (access((_logoURL + channelName + ".gif").c_str(), 4) == 0) + return _logoURL + channelName + ".gif"; + else + return ""; +} + diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h index 04cde3f69..892dde995 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoapi.h @@ -76,6 +76,7 @@ class CNeutrinoAPI std::string getVideoFramerateAsString(void); std::string getAudioInfoAsString(void); std::string getCryptInfoAsString(void); + std::string getLogoFile(std::string _logoURL, t_channel_id channelId); public: CNeutrinoAPI(); ~CNeutrinoAPI(void); diff --git a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp index 2452cce20..8c40f118d 100644 --- a/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/coolstream/neutrinoyparser.cpp @@ -95,7 +95,7 @@ THandleStatus CNeutrinoYParser::Hook_ReadConfig(CConfigFile *Config, CStringList Config->setInt32("configfile.version", CONF_VERSION); Config->saveConfig(HTTPD_CONFIGFILE); } - + std::string logo = ConfigList["TUXBOX_LOGOS_URL"]; return HANDLED_CONTINUE; } @@ -342,15 +342,12 @@ std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std: std::string bouquetstr = (BouquetNr >= 0) ? ("&bouquet=" + itoa(BouquetNr)) : ""; yresult += ""; -//FIXME: Logo-Extensions + if(have_logos) yresult += string_printf("", classname, channel->channel_id, - (hh->WebserverConfigList["Tuxbox.LogosURL"]).c_str(), - channel->channel_id & 0xFFFFFFFFFFFFULL); + "')\">", classname, channel->channel_id, + (NeutrinoAPI->getLogoFile(hh->WebserverConfigList["Tuxbox.LogosURL"], channel->channel_id)).c_str()); /* timer slider */ if(event && event->duration > 0) diff --git a/src/nhttpd/web/Y_EPG.js b/src/nhttpd/web/Y_EPG.js index 29705fbec..fbac42d1e 100644 --- a/src/nhttpd/web/Y_EPG.js +++ b/src/nhttpd/web/Y_EPG.js @@ -61,9 +61,10 @@ function show_epg_item(_index){ $("d_start").update(epg_data[_index][3]); $("d_stop").update(epg_data[_index][5]); $("d_channel_id").update(epg_data[_index][6]); - $('d_logo').update( (g_logosURL!="")?"":"" ); + var logo =epg_data[_index][7]; + $('d_logo').update( (logo!="")?"":"" ); var imdb_link = 'IMDb'; - var klack_link = 'klack.de'; + var klack_link = 'klack.de'; var tvinfo_link = 'tvinfo.de'; $('d_lookup').update(imdb_link+" "+klack_link+" "+tvinfo_link); @@ -78,7 +79,7 @@ function show_epg_item(_index){ show_obj("epg_info",true); } /* build one channel row*/ -function build_epg_bouquet(__bdiv, __channel_id, _starttime, _stoptime) +function build_epg_bouquet(__bdiv, __channel_id, _starttime, _stoptime, _logo) { var xml = loadSyncURLxml("/control/epg?xml=true&channelid="+__channel_id+"}&details=true&stoptime="+_stoptime); if(xml){ @@ -98,7 +99,7 @@ function build_epg_bouquet(__bdiv, __channel_id, _starttime, _stoptime) var _info2 = epg_de_qout(getXMLNodeItemValue(prog, "info2")); var __item = obj_createAt(__bdiv, "div", "ep_bouquet_item"); - var epg_obj= new Array(_desc, _info1, _info2, _start, _start_t, _stop.toString(), __channel_id); + var epg_obj= new Array(_desc, _info1, _info2, _start, _start_t, _stop.toString(), __channel_id, _logo); epg_data.push(epg_obj); __item.innerHTML = ""+_desc+""; build_epg_setbox(__item, _starttime, _stoptime, _start, _stop); @@ -191,12 +192,13 @@ function build_epg_plus_loop(_starttime, _stoptime) var __channel_name = getXMLNodeItemValue(_bouquet, "name"); var __channel_id = getXMLNodeItemValue(_bouquet, "id"); var __short_channel_id = getXMLNodeItemValue(_bouquet, "short_id"); + var __logo = getXMLNodeItemValue(_bouquet, "logo"); var ep = $("epg_plus"); var __bdiv = obj_createAt(ep, "div", "ep_bouquet"); var __bname_div = obj_createAt(__bdiv, "div", "ep_bouquet_name"); - var ch_name_with_logo= (g_logosURL!="")?"\""+__channel_name+"\"":__channel_name; + var ch_name_with_logo= (g_logosURL!="")?"\""+__channel_name+"\"":__channel_name; $(__bname_div).update(""+ch_name_with_logo+""); - build_epg_bouquet(__bdiv, __channel_id, _starttime, _stoptime); + build_epg_bouquet(__bdiv, __channel_id, _starttime, _stoptime, __logo); window.setTimeout("build_epg_plus_loop("+_starttime+","+_stoptime+")",100); g_i++; } diff --git a/src/nhttpd/web/Y_EPG_Plus.yhtm b/src/nhttpd/web/Y_EPG_Plus.yhtm index e075e7cd9..b6cacff8a 100644 --- a/src/nhttpd/web/Y_EPG_Plus.yhtm +++ b/src/nhttpd/web/Y_EPG_Plus.yhtm @@ -52,12 +52,17 @@ function epg_imdb(){ - - {=L:lookup=}: + + +
+ + + +