//------------------------------------------------------------------------- // y-func : get_channel_dropdown [<bouquet_nr> [<channel_id>]] //------------------------------------------------------------------------- std::string CNeutrinoYParser::func_get_channels_as_dropdown(CyhookHandler *, std::string para) { std::string abouquet, achannel_id, yresult, sel, sid; int bnumber = 1; int mode = NeutrinoAPI->Zapit->getMode(); ySplitString(para," ",abouquet, achannel_id); if(abouquet != "") bnumber = atoi(abouquet.c_str()); if(bnumber > 0) { bnumber--; ZapitChannelList channels; channels = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->Bouquets[bnumber]->radioChannels : g_bouquetManager->Bouquets[bnumber]->tvChannels; for(int j = 0; j < (int) channels.size(); j++) { CEPGData epg; CZapitChannel * channel = channels[j]; char buf[100],id[20]; sprintf(id,PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS,channel->channel_id); std::string _sid = std::string(id); sel = (_sid == achannel_id) ? "selected=\"selected\"" : ""; sectionsd_getActualEPGServiceKey(channel->channel_id&0xFFFFFFFFFFFFULL, &epg); sprintf(buf,"<option value="PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS" %s>%.20s - %.30s</option>\n", channel->channel_id, sel.c_str(), channel->getName().c_str(),epg.title.c_str()); yresult += buf; } } return yresult; }
void CTestMenu::testShowActuellEPG() { CEPGData epgData; event_id_t epgid = 0; if(sectionsd_getActualEPGServiceKey(live_channel_id&0xFFFFFFFFFFFFULL, &epgData)) epgid = epgData.eventID; if(epgid != 0) { CShortEPGData epgdata; if(sectionsd_getEPGidShort(epgid, &epgdata)) { //InfoBox std::string title; title = g_Zapit->getChannelName(live_channel_id); title += ":"; title += epgdata.title; std::string buffer; buffer = epgdata.info1; buffer += "\n"; buffer += epgdata.info2; InfoBox(title.c_str(), buffer.c_str(), CInfoBox::mbrBack, CInfoBox::mbBack); // UTF-8 } } else MessageBox(LOCALE_MESSAGEBOX_ERROR, "No EPG found!", CMessageBox::mbrCancel, CMessageBox::mbCancel, NEUTRINO_ICON_ERROR); }
//------------------------------------------------------------------------- // 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 CVCRControl::Screenshot(const t_channel_id channel_id, char * fname) { char filename[512]; // UTF-8 char cmd[512]; std::string channel_name; CEPGData epgData; event_id_t epgid = 0; unsigned int pos; if(!fname) { if(safe_mkdir((char *) "/hdd/screenshots/")) return; strcpy(filename, "/hdd/screenshots/"); pos = strlen(filename); channel_name = g_Zapit->getChannelName(channel_id); if (!(channel_name.empty())) { strcpy(&(filename[pos]), UTF8_TO_FILESYSTEM_ENCODING(channel_name.c_str())); char * p_act = &(filename[pos]); do { p_act += strcspn(p_act, "/ \"%&-\t`'´!,:;"); if (*p_act) { *p_act++ = '_'; } } while (*p_act); strcat(filename, "_"); } pos = strlen(filename); //if (g_Sectionsd->getActualEPGServiceKey(channel_id&0xFFFFFFFFFFFFULL, &epgData)) if(sectionsd_getActualEPGServiceKey(channel_id&0xFFFFFFFFFFFFULL, &epgData)); epgid = epgData.eventID; if(epgid != 0) { CShortEPGData epgdata; //if (g_Sectionsd->getEPGidShort(epgid, &epgdata)) { if(sectionsd_getEPGidShort(epgid, &epgdata)) { if (!(epgdata.title.empty())) { strcpy(&(filename[pos]), epgdata.title.c_str()); char * p_act = &(filename[pos]); do { p_act += strcspn(p_act, "/ \"%&-\t`'~<>!,:;?^°$\\=*#@¤|"); if (*p_act) { *p_act++ = '_'; } } while (*p_act); } } } pos = strlen(filename); time_t t = time(NULL); strftime(&(filename[pos]), sizeof(filename) - pos - 1, "%Y%m%d_%H%M%S", localtime(&t)); strcat(filename, ".bmp"); } else strcpy(filename, fname); sprintf(cmd, "grab -v %s", filename); printf("Executing %s\n", cmd); CHintBox * hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, "Saving screenshot.."); hintBox->paint(); system(cmd); hintBox->hide(); delete hintBox; }
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; }