bool CServiceManager::AddNVODChannel(CZapitChannel * &channel) { t_service_id service_id = channel->getServiceId(); t_original_network_id original_network_id = channel->getOriginalNetworkId(); t_transport_stream_id transport_stream_id = channel->getTransportStreamId(); t_satellite_position satellitePosition = channel->getSatellitePosition(); t_channel_id sub_channel_id = ((uint64_t) ( satellitePosition >= 0 ? satellitePosition : (uint64_t)(0xF000+ abs(satellitePosition))) << 48) | (uint64_t) CREATE_CHANNEL_ID_FROM_SERVICE_ORIGINALNETWORK_TRANSPORTSTREAM_ID(service_id, original_network_id, transport_stream_id); channel_insert_res_t ret = nvodchannels.insert ( channel_pair_t (sub_channel_id, *channel)); delete channel; channel = &ret.first->second; return ret.second; }
t_channel_id uniqueKey(void) const { //return CREATE_CHANNEL_ID; //notice that tsid & onid were changed for compatibility sake - order should be onid tsid when being sorted return CREATE_CHANNEL_ID_FROM_SERVICE_ORIGINALNETWORK_TRANSPORTSTREAM_ID(service_id, transport_stream_id, original_network_id); }
//------------------------------------------------------------------------- // TODO: clean up code // use templates? //------------------------------------------------------------------------- std::string CNeutrinoYParser::func_get_bouquets_with_epg(CyhookHandler *hh, std::string para) { int BouquetNr = 0; std::string abnumber, tmp,yresult; ZapitChannelList channels; int num; int mode = NeutrinoAPI->Zapit->getMode(); ySplitString(para," ",abnumber, tmp); if(abnumber != "") BouquetNr = atoi(abnumber.c_str()); if (BouquetNr > 0) { BouquetNr--; channels = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->Bouquets[BouquetNr]->radioChannels : g_bouquetManager->Bouquets[BouquetNr]->tvChannels; num = 1 + (mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin().getNrofFirstChannelofBouquet(BouquetNr) : g_bouquetManager->tvChannelsBegin().getNrofFirstChannelofBouquet(BouquetNr)) ; } else { CBouquetManager::ChannelIterator cit = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->radioChannelsBegin() : g_bouquetManager->tvChannelsBegin(); for (; !(cit.EndOfChannels()); cit++) channels.push_back(*cit); num = 1; } NeutrinoAPI->GetChannelEvents(); int i = 1; char classname; t_channel_id current_channel = live_channel_id; int prozent; CSectionsdClient::responseGetCurrentNextInfoChannelID currentNextInfo; std::string timestr; bool have_logos = false; if(hh->WebserverConfigList["Tuxbox.LogosURL"] != "") have_logos = true; for(int j = 0; j < (int) channels.size(); j++) { CZapitChannel * channel = channels[j]; CChannelEvent *event; event = NeutrinoAPI->ChannelListEvents[channel->channel_id]; classname = (i++ & 1) ? 'a' : 'b'; if (channel->channel_id == current_channel) classname = 'c'; std::string bouquetstr = (BouquetNr >= 0) ? ("&bouquet=" + itoa(BouquetNr)) : ""; yresult += "<tr>"; if(have_logos) yresult += string_printf("<td class=\"%c\" width=\"44\" rowspan=\"2\"><a href=\"javascript:do_zap('" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS "')\"><img class=\"channel_logo\" src=\"%s\"/></a></td>", classname, channel->channel_id, (NeutrinoAPI->getLogoFile(hh->WebserverConfigList["Tuxbox.LogosURL"], channel->channel_id)).c_str()); /* timer slider */ if(event && event->duration > 0) prozent = 100 * (time(NULL) - event->startTime) / event->duration; else prozent = 100; yresult += string_printf("<td class=\"%c\"><table border=\"0\" cellspacing=\"0\" cellpadding=\"3\"><tr><td>\n" "\t<table border=\"0\" rules=\"none\" class=\"cslider_table\" width=\"32\">" "<tr>" "<td class=\"cslider_used\" width=\"%d\"></td>" "<td class=\"cslider_free\" width=\"%d\"></td>" "</tr>" "</table>\n</td>\n" , classname , (prozent / 10) * 3 , (10 - (prozent / 10))*3 ); /* channel name and buttons */ yresult += string_printf("<td>\n%s<a class=\"clist\" href=\"javascript:do_zap('" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS "')\"> %d. %s%s</a> <a href=\"javascript:do_epg('" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS "','" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS "')\">%s</a>\n", ((channel->channel_id == current_channel) ? "<a name=\"akt\"></a>" : " "), channel->channel_id, num + j /*channel->nr*/, channel->getName().c_str(), (channel->getServiceType() == ST_NVOD_REFERENCE_SERVICE) ? " (NVOD)" : "", channel->channel_id, channel->channel_id & 0xFFFFFFFFFFFFULL, ((NeutrinoAPI->ChannelListEvents[channel->channel_id]) ? "<img src=\"/images/elist.gif\" alt=\"Program preview\" style=\"border: 0px\" />" : "")); if (channel->channel_id == current_channel) yresult += string_printf("\n <a href=\"javascript:do_streaminfo()\"><img src=\"/images/streaminfo.png\" alt=\"Streaminfo\" style=\"border: 0px\" /></a>"); yresult += string_printf("</td></tr></table>\n</td>\n</tr>\n"); if (channel->getServiceType() == ST_NVOD_REFERENCE_SERVICE) { CSectionsdClient::NVODTimesList nvod_list; if (sectionsd_getNVODTimesServiceKey(channel->channel_id&0xFFFFFFFFFFFFULL, nvod_list)) { CZapitClient::subServiceList subServiceList; for (CSectionsdClient::NVODTimesList::iterator ni = nvod_list.begin(); ni != nvod_list.end(); ni++) { CZapitClient::commandAddSubServices cmd; CEPGData epg; // Byte Sequence by ntohs cmd.original_network_id = ntohs(ni->original_network_id); cmd.service_id = ntohs(ni->service_id); cmd.transport_stream_id = ntohs(ni->transport_stream_id); t_channel_id channel_id = CREATE_CHANNEL_ID_FROM_SERVICE_ORIGINALNETWORK_TRANSPORTSTREAM_ID(cmd.service_id, cmd.original_network_id, cmd.transport_stream_id); timestr = timeString(ni->zeit.startzeit); // FIXME: time is wrong (at least on little endian)! sectionsd_getActualEPGServiceKey(channel_id&0xFFFFFFFFFFFFULL, &epg); // FIXME: der scheissendreck geht nit!!! yresult += string_printf("<tr>\n<td align=\"left\" style=\"width: 31px\" class=\"%cepg\"> </td>", classname); yresult += string_printf("<td class=\"%cepg\">%s ", classname, timestr.c_str()); yresult += string_printf("%s<a href=\"javascript:do_zap('" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS ")'\">%04x:%04x:%04x %s</a>", // FIXME: get name (channel_id == current_channel) ? "<a name=\"akt\"></a>" : " ", channel_id, bouquetstr.c_str(), cmd.transport_stream_id, cmd.original_network_id, cmd.service_id, epg.title.c_str()); yresult += string_printf("</td>\n</tr>"); subServiceList.push_back(cmd); } if (!(subServiceList.empty())) NeutrinoAPI->Zapit->setSubServices(subServiceList); } } else if ((event = NeutrinoAPI->ChannelListEvents[channel->channel_id])) { bool has_current_next = true; sectionsd_getCurrentNextServiceKey(channel->channel_id&0xFFFFFFFFFFFFULL, currentNextInfo); timestr = timeString(event->startTime); yresult += string_printf("<tr><td class=\"%cepg\">",classname); yresult += string_printf("%s %s " "<span style=\"font-size: 8pt; white-space: nowrap\">(%ld von %d min, %d%%)</span>" , timestr.c_str() , event->description.c_str() , (time(NULL) - event->startTime)/60 , event->duration / 60,prozent); if ((has_current_next) && (currentNextInfo.flags & CSectionsdClient::epgflags::has_next)) { timestr = timeString(currentNextInfo.next_zeit.startzeit); yresult += string_printf("<br />%s %s", timestr.c_str(), currentNextInfo.next_name.c_str()); } yresult += string_printf("</td></tr>\n"); } else yresult += string_printf("<tr style=\"height: 2px\"><td></td></tr>\n"); } return yresult; }
void EventList::readEvents(const t_channel_id channel_id) { evtlist.clear(); sectionsd_getEventsServiceKey(channel_id &0xFFFFFFFFFFFFULL, evtlist); time_t azeit = time(NULL); CChannelEventList::iterator e; if ( evtlist.size() != 0 ) { CEPGData epgData; // todo: what if there are more than one events in the Portal if (sectionsd_getActualEPGServiceKey(channel_id&0xFFFFFFFFFFFFULL, &epgData)) { CSectionsdClient::LinkageDescriptorList linkedServices; if ( sectionsd_getLinkageDescriptorsUniqueKey( epgData.eventID, linkedServices ) ) { if ( linkedServices.size() > 1 ) { CChannelEventList evtlist2; // stores the temporary eventlist of the subchannel channelid t_channel_id channel_id2; for (unsigned int i = 0; i < linkedServices.size(); i++) { channel_id2 = CREATE_CHANNEL_ID_FROM_SERVICE_ORIGINALNETWORK_TRANSPORTSTREAM_ID( linkedServices[i].serviceId, linkedServices[i].originalNetworkId, linkedServices[i].transportStreamId); // do not add parent events if (channel_id != channel_id2) { evtlist2.clear(); sectionsd_getEventsServiceKey(channel_id2 &0xFFFFFFFFFFFFULL, evtlist2); for (unsigned int loop = 0 ; loop < evtlist2.size(); loop++ ) { //FIXME: bad ?evtlist2[loop].sub = true; evtlist.push_back(evtlist2[loop]); } evtlist2.clear(); } } } } } // Houdini added for Private Premiere EPG, start sorted by start date/time sort(evtlist.begin(), evtlist.end(), sortByDateTime); // Houdini: dirty workaround for RTL double events, remove them CChannelEventList::iterator e2; for ( e = evtlist.begin(); e != evtlist.end(); ++e ) { e2 = e + 1; if ( e2 != evtlist.end() && (e->startTime == e2->startTime)) { evtlist.erase(e2); } } timerlist.clear(); g_Timerd->getTimerList(timerlist); } current_event = (unsigned int) - 1; for ( e = evtlist.begin(); e != evtlist.end(); ++e ) { if ( e->startTime > azeit ) { break; } current_event++; } if ( evtlist.size() == 0 ) { CChannelEvent evt; evt.description = g_Locale->getText(LOCALE_EPGLIST_NOEVENTS); evt.eventID = 0; evtlist.push_back(evt); } if (current_event == (unsigned int) - 1) current_event = 0; selected = current_event; return; }