Пример #1
0
static eString wapEPGDetails(eString serviceRef, eString eventID)
{
	eString result;
	eService *current = NULL;
	eString ext_description;
	std::stringstream record;
	int eventid;
	eString description = "No description available";

	sscanf(eventID.c_str(), "%x", &eventid);
	eDebug("[ENIGMA_DYN] getEPGDetails: serviceRef = %s, ID = %04x", serviceRef.c_str(), eventid);

	// search for the event... to get the description...
	eDVBServiceController *sapi=eDVB::getInstance()->getServiceAPI();
	if (sapi)
	{
		eServiceReference ref(string2ref(serviceRef));
		current = eDVB::getInstance()->settings->getTransponders()->searchService((eServiceReferenceDVB&)ref);
		if (current)
		{
			EITEvent *event = eEPGCache::getInstance()->lookupEvent((eServiceReferenceDVB&)ref, eventid);
			if (event)
			{
				LocalEventData led;
				led.getLocalData(event, &description, &ext_description);
				ext_description.strReplace("\n", "<br/>");
				if (!ext_description)
					ext_description = "No detailed information available";
#ifndef DISABLE_FILE
				record << "<a href=\"/wap?mode=addTimerEvent"
					<< ",path=" << ref2string(ref)
					<< ",ID=" << std::hex << event->event_id << std::dec
					<< ",start=" << event->start_time
					<< ",duration=" << event->duration
					<< ",descr=" << filter_string(description)
					<< ",channel=" << filter_string(current->service_name)
					<< "\">Record</a>";
#endif
				delete event;
			}
		}
	}

	result = readFile(TEMPLATE_DIR + "wapEPGDetails.tmp");
	result.strReplace("#EVENT#", filter_string(description));
	result.strReplace("#RECORD#", record.str());
	result.strReplace("#BODY#", filter_string(ext_description));

	return result;
}
Пример #2
0
    void operator()(const eServiceReference &e)
    {
        eEPGCache *epgcache=eEPGCache::getInstance();
        eServiceReferenceDVB &ref = (eServiceReferenceDVB&)e;
        const timeMap *evmap = epgcache->getTimeMap((eServiceReferenceDVB&)ref);
        if (evmap)
        {
            int tsidonid = (ref.getTransportStreamID().get()<<16)|ref.getOriginalNetworkID().get();
            timeMap::const_iterator ibegin = evmap->begin(), iend = evmap->end();
            for (timeMap::const_iterator event(ibegin); event != iend; ++event)
            {
                if (event->second->search(tsidonid,search,intExactMatch,intCaseSensitive,genre,Range))
                {
                    EITEvent *ev = new EITEvent(*event->second, tsidonid);
                    for (ePtrList<Descriptor>::iterator d(ev->descriptor); d != ev->descriptor.end(); ++d)
                    {
                        Descriptor *descriptor=*d;
                        if (descriptor->Tag() == DESCR_LINKAGE)
                        {
                            LinkageDescriptor *ld=(LinkageDescriptor*)descriptor;
                            if (ld->linkage_type==0xB0)
                            {
                                eServiceReferenceDVB MySubService(ref.getDVBNamespace(),
                                                                  eTransportStreamID(ld->transport_stream_id),
                                                                  eOriginalNetworkID(ld->original_network_id),
                                                                  eServiceID(ld->service_id), 7);
                                ref = MySubService;
                                break;
                            }
                        }
                    }
                    eString titlefound;
                    LocalEventData led;
                    led.getLocalData(ev, &titlefound, 0);

                    SEARCH_EPG_DATA tempSEARCH_EPG_DATA;
                    tempSEARCH_EPG_DATA.ref = (eServiceReference)ref;
                    tempSEARCH_EPG_DATA.start_time = ev->start_time;
                    tempSEARCH_EPG_DATA.duration = ev->duration;
                    tempSEARCH_EPG_DATA.title = titlefound;
                    SearchResultsEPG.push_back(tempSEARCH_EPG_DATA);
                    delete ev;
                }
            }
        }
    }
Пример #3
0
static eString getEPGTitle()
{
	eServiceReference &ref = eServiceInterface::getInstance()->service;

	eString descr(_("no description is available"));

	EITEvent *tmp=eEPGCache::getInstance()->lookupEvent((eServiceReferenceDVB&)ref);

	if(tmp)
	{
		LocalEventData led;
		eString text;
		led.getLocalData(tmp, &descr, &text);
		if (text)
			descr += " - " + text;
		delete tmp;
	}
	return descr;
}
Пример #4
0
void eEventDisplay::setEvent(EITEvent *event)
{
	valid=0;
	// update evt.. when setEvent is called from outside..
	if ( evt )  
		evt = event;

	long_description->hide();
	long_description->move( ePoint(0,0) );
	if (event)
	{
		eString _title=0, _long_description="";
		eString _eventDate="";
		eString _eventTime="";

		if ( ref.path )
		{
			_eventDate.sprintf(_("Original duration: %d min"), event->duration/60 );
			eSize s = eventDate->getSize();
			eSize s2 = eventTime->getSize();
			s2.setHeight(0);
			s+=s2;
			eventDate->resize(s);
		}
		else
		{
			tm *begin=event->start_time!=-1?localtime(&event->start_time):0;
			if (begin)
			{
				valid |= 1;
				_eventTime.sprintf("%02d:%02d", begin->tm_hour, begin->tm_min);
				_eventDate=eString().sprintf("%02d.%02d.%4d", begin->tm_mday, begin->tm_mon+1, begin->tm_year+1900);
			}
			time_t endtime=event->start_time+event->duration;
			tm *end=event->start_time!=-1?localtime(&endtime):0;
			if (end)
			{
				valid |= 2;
				_eventTime+=eString().sprintf(" - %02d:%02d", end->tm_hour, end->tm_min);
			}
		}

		LocalEventData led;
		eString lang=0;
		if (led.language_exists(event,led.primary_language))
			lang=led.primary_language;
		else if (led.language_exists(event,led.secondary_language))
			lang=led.secondary_language;
		else if (led.language_exists(event,"eng"))
			lang="eng";

		for (ePtrList<Descriptor>::iterator d(event->descriptor); d != event->descriptor.end(); ++d)
		{
			if (d->Tag()==DESCR_SHORT_EVENT)
			{
				ShortEventDescriptor *s=(ShortEventDescriptor*)*d;
                
				valid |= 4;

				if (!lang || !strncmp(lang.c_str(), s->language_code, 3))
				{
					_title=s->event_name;
#ifndef DISABLE_LCD	
					if (LCDElement)
					LCDElement->setText(s->text);
#endif
					if ((s->text.length() > 0) && (s->text!=_title))
					{
						valid |= 8;
						_long_description+=s->text;
						_long_description+="\n\n";
					}
				} 
			}
			else if (d->Tag()==DESCR_EXTENDED_EVENT)
			{
				ExtendedEventDescriptor *ss=(ExtendedEventDescriptor*)*d;
				valid |= 16;
				if (!lang || !strncmp(lang.c_str(), ss->language_code, 3))
					_long_description+=ss->text;
			}
		}
		if (!_title)
			_title = _("no information is available");
		if ( !ref.path )
			channel->setText(service);

		eventTime->setText(_eventTime);
		eventDate->setText(_eventDate);

		setText(_title);

		if (!_long_description)
			long_description->setText(_("no description is available"));
		else
			long_description->setText(_long_description);

		checkTimerIcon(event);
	} 
	else
	{
		setText(service);
		long_description->setText(_("no description is available"));
	}
	updateScrollbar();
	long_description->show();
}
Пример #5
0
void eChannelInfo::ParseEITInfo(EITEvent *e)
{
		name=descr=genre=starttime="";
		cflags=0;
		eString t;
			
		if(e->start_time!=0)
		{
			tm *stime=localtime(&e->start_time);
			starttime.sprintf("%02d:%02d", stime->tm_hour, stime->tm_min);
			int show_current_remaining=1;
			eConfig::getInstance()->getKey("/ezap/osd/showCurrentRemaining", show_current_remaining);
			if (show_current_remaining)
			{
				time_t now = time(0) + eDVB::getInstance()->time_difference;
				int duration = e->duration - (now - e->start_time);
				if ( duration > e->duration )
					duration = e->duration;
				else if ( duration < 0 )
					duration = 0;
				t.sprintf("  (+%dmin)", (int)(duration/60));
			}
			else
				t.sprintf("  (%dmin)", (int)(e->duration/60));
		}

		if (e->free_CA_mode )
			cflags |= cflagScrambled;

		LocalEventData led;
		led.getLocalData(e, &name, &descr, 0);
		DescriptionForEPGSearch = name;
		for (ePtrList<Descriptor>::iterator d(e->descriptor); d != e->descriptor.end(); ++d)
		{
			Descriptor *descriptor=*d;
			if (descriptor->Tag()==DESCR_COMPONENT)
			{
				ComponentDescriptor *cd=(ComponentDescriptor*)descriptor;
				
				if( cd->stream_content == 2 && cd->component_type == 5)
					cflags |= cflagDolby;
				else if( cd->stream_content == 2 && cd->component_type == 3)
					cflags |= cflagStereo;
				else if( cd->stream_content == 1 && (cd->component_type == 2 || cd->component_type == 3) )
					cflags |= cflagWide;
			}
			else if(descriptor->Tag()==DESCR_CONTENT)
			{
				ContentDescriptor *cod=(ContentDescriptor*)descriptor;

				for(ePtrList<descr_content_entry_struct>::iterator ce(cod->contentList.begin()); ce != cod->contentList.end(); ++ce)
				{
					if(genresTableShort[ce->content_nibble_level_1*16+ce->content_nibble_level_2])
					{
/*						if ( !genre.length() )
							genre+=_("GENRE: ");*/
						genre += gettext( genresTableShort[ce->content_nibble_level_1*16+ce->content_nibble_level_2] );
						genre += " ";
					}
				}
			}
		}
		if(!t.isNull()) name += t;

		cname.setText( name );
		if ( genre.size() )
		{
			if ( name.size() )
				descr+=" / ";
			descr+=genre;
		}
		cdescr.setText( descr );
		ctime.setText( starttime );

		int n = 0;
		n = LayoutIcon(&cdolby, (cflags & cflagDolby), n);
		n = LayoutIcon(&cstereo, (cflags & cflagStereo), n);
		n = LayoutIcon(&cformat, (cflags & cflagWide), n );
		n = LayoutIcon(&cscrambled, (cflags & cflagScrambled), n );
}
Пример #6
0
static eString wapEPG(int page)
{
	std::stringstream result;
	eString description;
	result << std::setfill('0');

	eService* current;

	eDVBServiceController *sapi=eDVB::getInstance()->getServiceAPI();
	if (!sapi)
		return "No EPG available";

	eServiceReference ref = sapi->service;

	current = eDVB::getInstance()->settings->getTransponders()->searchService(ref);

	if (!current)
		return "No EPG available";

	eServiceReferenceDVB &rref = (eServiceReferenceDVB&)ref;
	timeMapPtr evt = eEPGCache::getInstance()->getTimeMapPtr(rref);

	if (!evt)
		return "No EPG available";
	else
	{
		timeMap::const_iterator It;
		int tsidonid = (rref.getTransportStreamID().get()<<16)|rref.getOriginalNetworkID().get();

		int i = 0;
		for(It=evt->begin(); It!= evt->end(); ++It)
		{
			if ((i >= page * 25) && (i < (page + 1) * 25))
			{
				EITEvent event(*It->second, tsidonid, It->second->type);
				LocalEventData led;
				led.getLocalData(&event, &description);
				tm* t = localtime(&event.start_time);

				result	<< std::setw(2) << t->tm_mday << '.'
					<< std::setw(2) << t->tm_mon+1 << ". - "
					<< getTimeStr(t, 0)
					<< "<br/>";

				result << "<a href=\"/wap?mode=epgDetails"
							<< ",path=" << ref2string(ref)
							<< ",ID=" << std::hex << event.event_id << std::dec
							<< "\">"
							<< filter_string(description)
							<< "</a><br/>\n";
			}
			i++;
		}
		if (i >= (page + 1) * 25)
		{
			page++;
			result << "<a href=\"wap?mode=epg,page=" << eString().sprintf("%d", page) << "\">Next Page</a><br/>";
		}
	}

	eString tmp = readFile(TEMPLATE_DIR + "wapepg.tmp");
	tmp.strReplace("#CHANNEL#", filter_string(current->service_name));
	tmp.strReplace("#BODY#", result.str());
	return tmp;
}
Пример #7
0
static int searchforEvent(EITEvent *ev, const eString &search, eString &titlefound, eServiceReferenceDVB &new_ref, int intExactMatch, int intCaseSensitive, int genre)
{
	eString title;
	eString sFind;
	
	int intFound = 0;

	// Genre Suchkriterium schlägt immer Titelsuche ;)
	if ( genre != 0)
	{
		int Range = 0;
		switch (genre)
		{
			case 32:
				Range = 36;
				break;
			case 48:
				Range = 51;
				break;
			case 64:
				Range = 75;
				break;
			case 80:
				Range = 85;
				break;
			case 96:
				Range = 102;
				break;
			case 112:
				Range = 123;
				break;
			case 128:
				Range = 131;
				break;
			case 144:
				Range = 151;
				break;
			case 160:
				Range = 167;
				break;
			case 176:
				Range = 179;
				break;
			default:
				break;

		}

		for (ePtrList<Descriptor>::iterator d(ev->descriptor); d != ev->descriptor.end(); ++d)
		{
			Descriptor *descriptor=*d;
			if(descriptor->Tag()==DESCR_CONTENT)
			{
				ContentDescriptor *cod=(ContentDescriptor*)descriptor;

				for(ePtrList<descr_content_entry_struct>::iterator ce(cod->contentList.begin()); ce != cod->contentList.end(); ++ce)
				{

					if ( genre < 32 )
					{
						if (genre  == ce->content_nibble_level_1*16+ce->content_nibble_level_2)
							intFound = 1;
					}
					else
					{
						int genreID = ce->content_nibble_level_1*16+ce->content_nibble_level_2;
						if ( (genreID >= genre) && (genreID <= Range))
							intFound = 1;
					}
				}
			}
		}
		if (intFound)
		{
			LocalEventData led;
			led.getLocalData(ev, &title, 0);
			titlefound = title;
		}
	}
	else
	{
		if (search != "")
		{
			LocalEventData led;
			
			led.getLocalData(ev, &title, 0);
			titlefound = title;
			if (intExactMatch || intCaseSensitive) 
				sFind = title;
			else
				sFind = title.upper();
			if (!intExactMatch)
			{
				if (sFind.find(search) != eString::npos)
					intFound = 1;
			}
			else
			{
				if (!strcmp(search.c_str(),sFind.c_str()))
					intFound = 1;
			}
		}
	}
	if (intFound)
	{
		for (ePtrList<Descriptor>::iterator d(ev->descriptor); d != ev->descriptor.end(); ++d)
		{
			Descriptor *descriptor=*d;
			if (descriptor->Tag() == DESCR_LINKAGE)
			{
					LinkageDescriptor *ld=(LinkageDescriptor*)descriptor;
					if (ld->linkage_type==0xB0)
					{
						eServiceReferenceDVB MySubService(new_ref.getDVBNamespace(),
							eTransportStreamID(ld->transport_stream_id),
							eOriginalNetworkID(ld->original_network_id),
							eServiceID(ld->service_id), 7);
						new_ref = MySubService;
						break;
					}
			}
		}
	}
	return intFound;
}
Пример #8
0
eString getServiceEPG(eString format, eString opts)
{
	eString result, result1, events;
	std::map<eString, eString> opt = getRequestOptions(opts, '&');

	unsigned int entries = 0xFFFFFFFF;
	if (opt["entries"] != "")
		entries = atoi(opt["entries"].c_str());
	
	result1 = readFile(TEMPLATE_DIR + format + "ServiceEPG.tmp");
		
	eService* current;
	eServiceReference ref;

	// we read the default action on timer end
	int defaultendaction = 0;

	eConfig::getInstance()->getKey("/enigma/timerenddefaultaction", defaultendaction);


	eDVBServiceController *sapi=eDVB::getInstance()->getServiceAPI();
	if (sapi)
	{
		eString serviceRef = opt["ref"];
		ref = (serviceRef) ? string2ref(serviceRef) : sapi->service;
		current = eDVB::getInstance()->settings->getTransponders()->searchService(ref);
		if (current)
		{
			result1.strReplace("#REFERENCE#", ref2string(ref));
			result1.strReplace("#NAME#", filter_string(current->service_name));
			
			eServiceReferenceDVB &rref = (eServiceReferenceDVB&)ref;
			timeMapPtr evt = eEPGCache::getInstance()->getTimeMapPtr(rref);

			if (evt)
			{
				eString title, description, details, genre;
				int genreCategory, genreSubCat;

				timeMap::const_iterator It;
				int tsidonid = (rref.getTransportStreamID().get() << 16) | rref.getOriginalNetworkID().get();
			
				unsigned int i = 0;
				for (It = evt->begin(); It != evt->end() && i < entries; ++It)
				{
					EITEvent event(*It->second, tsidonid, It->second->type,It->second->source);
					genre = "";
					genreCategory = 0;
					genreSubCat = 0;
					LocalEventData led;
					led.getLocalData(&event, &description, &details);
					details.strReplace("\n", "<br/>",UTF8_ENCODING);

					for (ePtrList<Descriptor>::iterator d(event.descriptor); d != event.descriptor.end(); ++d)
					{
						Descriptor *descriptor = *d;
						if (descriptor->Tag() == DESCR_CONTENT)
						{
							ContentDescriptor *cod = (ContentDescriptor *)descriptor;

							for (ePtrList<descr_content_entry_struct>::iterator ce(cod->contentList.begin()); ce != cod->contentList.end(); ++ce)
							{
								if (genreCategory == 0)
									genreCategory = ce->content_nibble_level_1;
								genreSubCat = ce->content_nibble_level_2;
								if (!genre && eChannelInfo::getGenre(genreCategory << 4 | genreSubCat))
									genre += gettext(eChannelInfo::getGenre(genreCategory << 4 | genreSubCat).c_str());
							}
						}
					}
			
					if (!genre)
						genre = _("n/a");
					// genre += eString().sprintf("(%d.%d)", genreCategory, genreSubCat);

					tm* t = localtime(&event.start_time);
					if (format == "XML")
					{	
						result = readFile(TEMPLATE_DIR + "XMLEPGEntry.tmp");
						result.strReplace("#GENRE#", genre);
					}          
					else
					{
						result = readFile(TEMPLATE_DIR + "HTMLEPGEntry.tmp");
						result.strReplace("#DURATION_MINUTS#", (eString)" (" +
							eString().sprintf("%d", (int)event.duration / 60) + (eString)" min)");
						result.strReplace("#GENRE#",(eString)_("Genre") + (eString)": " + genre);
					}
					result.strReplace("#DURATION#", eString().sprintf("%d", event.duration));
					result.strReplace("#NO#", eString().sprintf("%d", i));
					result.strReplace("#DATE#", eString().sprintf("%02d.%02d.%04d", t->tm_mday, t->tm_mon + 1, t->tm_year + 1900));
					result.strReplace("#TIME#", getTimeStr(t, 0));
					
					eString tmp = filter_string(description);
					result.strReplace("#DESCRIPTION#", XMLify(tmp, format)); 
					tmp.strReplace("\'", "\\\'",UTF8_ENCODING);
					tmp.strReplace("\"", "\\\"",UTF8_ENCODING);
					tmp.strReplace("&", "~",UTF8_ENCODING);
					result.strReplace("#DESCRIPTIONJS#", XMLify(tmp, format));
					result.strReplace("#TIMERENDACTION#", eString().sprintf("%d", defaultendaction));
					
					tmp = filter_string(details);
					result.strReplace("#DETAILS#", XMLify(tmp, format));
					result.strReplace("#GENRECATEGORY#", eString().sprintf("%02d", genreCategory));
					result.strReplace("#START#", eString().sprintf("%d", event.start_time));
					result.strReplace("#REFERENCE#", ref2string(ref));
					
					tmp = filter_string(current->service_name);
					result.strReplace("#NAME#", XMLify(tmp, format));
					tmp.strReplace("\'", "\\\'",UTF8_ENCODING);
					tmp.strReplace("\"", "\\\"",UTF8_ENCODING);
					tmp.strReplace("&", "~",UTF8_ENCODING);
					result.strReplace("#NAMEJS#", XMLify(tmp, format));
					
					events += result;
					i++;
				}
			}
		}
	}
	result1.strReplace("#BODY#", events);

	return result1;
}
Пример #9
0
	void getcurepg(const eServiceReference &ref)
	{
		// sorry.. at moment we dont show any directory.. or locked service in webif
		if (ref.isLocked() && pinCheck::getInstance()->pLockActive())
			return;

		time_t now = time(0) + eDVB::getInstance()->time_difference;

		std::stringstream result;
		result << std::setfill('0');
		eService* current;

		// we read the default action on timer end
		int defaultendaction = 0;
		eConfig::getInstance()->getKey("/enigma/timerenddefaultaction", defaultendaction);

		eDVBServiceController *sapi = eDVB::getInstance()->getServiceAPI();
		if (sapi)
		{
			current = eDVB::getInstance()->settings->getTransponders()->searchService(ref);
			if (current)
			{
				eServiceReferenceDVB &dref = (eServiceReferenceDVB&)ref;
				timeMapPtr evt = eEPGCache::getInstance()->getTimeMapPtr(dref);
				if (evt)
				{
					int tsidonid = (dref.getTransportStreamID().get() << 16) | dref.getOriginalNetworkID().get();
					int tablePos = 0;
					time_t tableTime = start;
					result  << "<tr>"
						<< "<td id=\"channel\" width=\"" << eString().sprintf("%d", channelWidth) << "\">"
						<< "<span class=\"channel\">"
						<< filter_string(current->service_name)
						<< "</span>"
						<< "</td>";
					tablePos += CHANNELWIDTH;

					timeMap::const_iterator It;

					for (It = evt->begin(); It != evt->end(); ++It)
					{
						eString description;
						eString details;
						eString genre;
						int genreCategory, genreSubCat;
						EITEvent event(*It->second, tsidonid, It->second->type,It->second->source);
						LocalEventData led;
						led.getLocalData(&event, &description, &details);
						details.strReplace("\n", "<br/>",UTF8_ENCODING);
						genre = "";
						genreCategory = 0; //none
						genreSubCat = 0; //default
						for (ePtrList<Descriptor>::iterator d(event.descriptor); d != event.descriptor.end(); ++d)
						{
							Descriptor *descriptor = *d;
							if (descriptor->Tag() == DESCR_CONTENT)
							{
								ContentDescriptor *cod = (ContentDescriptor *)descriptor;

								for (ePtrList<descr_content_entry_struct>::iterator ce(cod->contentList.begin()); ce != cod->contentList.end(); ++ce)
								{
									if (genreCategory == 0)
										genreCategory = ce->content_nibble_level_1;
									genreSubCat = ce->content_nibble_level_2;
									if (!genre && eChannelInfo::getGenre(genreCategory << 4 | genreSubCat))
										genre = gettext(eChannelInfo::getGenre(genreCategory << 4 | genreSubCat).c_str());
								}
							}
						}

						if (!genre)
							genre = _("n/a");
						// genre += eString().sprintf("(%d.%d)", genreCategory, genreSubCat);

						time_t eventStart = adjust2FifteenMinutes(event.start_time);
						time_t eventEnd = eventStart + adjust2FifteenMinutes(event.duration);

						int eventDuration = 0;
						int colUnits = 0;
						if ((eventStart > end) || (eventEnd < tableTime))
						{
							eventDuration = 0;
						}
						else
						if ((eventStart < tableTime) && (eventEnd > tableTime))
						{
							eventDuration = eventEnd - tableTime;
						}
						else
						if (eventStart == tableTime)
						{
							eventDuration = adjust2FifteenMinutes(event.duration);
						}
						else
						if ((eventStart > tableTime) && (eventStart < end))
						{
							eventDuration = eventStart - tableTime;
							colUnits = eventDuration / 60 / 15;
							if (colUnits == 1)
							{
								eventStart = tableTime;
								eventDuration += adjust2FifteenMinutes(event.duration);
							}
							else
							{
								result << "<td colspan=\"" << colUnits << "\">&#160;</td>";
								tableTime = eventStart;
								tablePos += colUnits * 15 * d_min;
								eventDuration = adjust2FifteenMinutes(event.duration);
							}
						}

						if ((eventDuration > 0) && (eventDuration < 15 * 60))
							eventDuration = 15 * 60;

						if (tableTime + eventDuration > end)
							eventDuration = end - tableTime;

						colUnits = eventDuration / 60 / 15;
						if (colUnits > 0)
						{
							result  << "<td class=\"genre"
								<< eString().sprintf("%02d", genreCategory)
								<< "\" colspan=\"" << colUnits << "\">";
#ifndef DISABLE_FILE
							int timeroffsetstart = 0;
							eConfig::getInstance()->getKey("/enigma/timeroffsetstart", timeroffsetstart);
							int timeroffsetstop = 0;
							eConfig::getInstance()->getKey("/enigma/timeroffsetstop", timeroffsetstop);

							result  << "<a href=\"javascript:record('"
								<< ref2string(ref) << "','"
								<< event.start_time - (timeroffsetstart * 60) << "','"
								<< event.duration + (timeroffsetstart * 60) + (timeroffsetstop * 60) << "','";
							eString tmp = filter_string(description);
							tmp.strReplace("\'", "\\\'",UTF8_ENCODING);
							tmp.strReplace("\"", "\\\"",UTF8_ENCODING);
							tmp.strReplace("&", "~",UTF8_ENCODING);
							result  << tmp << "','"
								<< filter_string(current->service_name)
								<< "','"
								<< defaultendaction
								<< "')\"><img src=\"timer.gif\" border=\"0\" /></a>"
								<< "&#160;&#160;";
#endif
							tm* t = localtime(&event.start_time);
							result  << std::setfill('0')
								<< "<span class=\"time\">"
								<< std::setw(2) << t->tm_mday << '.'
								<< std::setw(2) << t->tm_mon+1 << ". - "
								<< getTimeStr(t, 0) << ' '
								<< "</span>"
								<< "<span class=\"duration\">"
								<< " (" << event.duration / 60 << " min)"
								<< "</span>"
								<< "<br />";
							if ((eventStart <= now) && (eventEnd >= now))
								result << "<a href=\"javascript:switchChannel('" << ref2string(ref) << "', '0', '-1')\">";
							result  << "<span class=\"event\">"
								<< "<b>" << description << "</b>"
								<< "</span>";
							if ((eventStart <= now) && (eventEnd >= now))
								result << "</a>";

							result	<< "<br />"
								<< _("Genre") << ": " << genre
								<< "<br />";

							if ((eventDuration >= 15 * 60) && (pdaScreen == 0))
							{
								result  << "<span class=\"description\">"
									<< filter_string(details)
									<< "</span>";
							}

							result  << "</td>\n";
							tablePos += colUnits * 15 * d_min;
							tableTime += eventDuration;
						}
					}
					if (tablePos < tableWidth)
						result << "<td colspan=\"" << (tableWidth - tablePos) / d_min / 15 << "\">&#160;</td>";

					result << "</tr>\n";
				}
				multiEPG += result.str();
			}
		}
	}
Пример #10
0
eString getEITC(eString result, eString format)
{
	eString now_start, now_date, now_time, now_duration, now_text, now_longtext,
		next_start, next_date, next_time, next_duration, next_text, next_longtext;

	eServiceReferenceDVB &ref = (eServiceReferenceDVB&)eServiceInterface::getInstance()->service;

	timeMapPtr pMap = eEPGCache::getInstance()->getTimeMapPtr(ref, 0, 0, 2);

	if (pMap)
	{
		int p = 0;
		int tsidonid = (ref.getTransportStreamID().get() << 16) | ref.getOriginalNetworkID().get();

		for (timeMap::const_iterator It = pMap->begin(); It != pMap->end() && p < 2; It++, p++)
		{
			EITEvent event(*It->second, tsidonid, It->second->type,It->second->source);
			if (p == 0)
			{
				if (event.start_time)
				{
					now_start = eString().sprintf("%d", (int)event.start_time);
					tm* t = localtime(&event.start_time);
					now_time = getTimeStr(t, 0);
					now_date.sprintf("%02d.%02d.%04d", t->tm_mday, t->tm_mon + 1, t->tm_year + 1900);
					now_duration.sprintf("%d", (int)(event.duration / 60));
				}
			}
			if (p == 1)
			{
				if (event.start_time)
				{
					next_start = eString().sprintf("%d", (int)event.start_time);
					tm* t = localtime(&event.start_time);
					next_time = getTimeStr(t, 0);
					next_date.sprintf("%02d.%02d.%04d", t->tm_mday, t->tm_mon + 1, t->tm_year + 1900);
					next_duration.sprintf("%d", (int)(event.duration / 60));
				}
			}
			LocalEventData led;
			switch (p)
			{
				case 0:
					led.getLocalData(&event, &now_text, &now_longtext);
					now_longtext.strReplace("\n", "<br/>",UTF8_ENCODING);
					break;
				case 1:
					led.getLocalData(&event, &next_text, &next_longtext);
					next_longtext.strReplace("\n", "<br/>",UTF8_ENCODING);
					break;
			}
		}
	}

	result.strReplace("#NOWSTART#", now_start);
	result.strReplace("#NOWT#", now_time);
	result.strReplace("#NOWDATE#", now_date);
	result.strReplace("#NOWDURATION#", now_duration);
	if (now_duration)
		now_duration = "(" + now_duration + ")";
	result.strReplace("#NOWD#", now_duration);
	result.strReplace("#NOWST#", XMLify(filter_string(now_text.strReplace("\"", "'",UTF8_ENCODING)), format));
	result.strReplace("#NOWLT#", XMLify(filter_string(now_longtext.strReplace("\"", "'",UTF8_ENCODING)), format));
	result.strReplace("#NEXTSTART#", next_start);
	result.strReplace("#NEXTT#", next_time);
	result.strReplace("#NEXTDATE#", next_date);
	result.strReplace("#NEXTDURATION#", next_duration);
	if (next_duration)
		next_duration = "(" + next_duration + ")";
	result.strReplace("#NEXTD#", next_duration);
	result.strReplace("#NEXTST#", XMLify(filter_string(next_text.strReplace("\"", "'",UTF8_ENCODING)), format));
	result.strReplace("#NEXTLT#", XMLify(filter_string(next_longtext.strReplace("\"", "'",UTF8_ENCODING)), format));

	eString curService = getCurService();
	eString curServiceRef;
	eDVBServiceController *sapi = eDVB::getInstance()->getServiceAPI();
	if (sapi)
		curServiceRef = ref2string(sapi->service);
	eString curSubService = getCurrentSubChannel(curServiceRef);
	if (curSubService)
	{
		if (curService)
			curService += ": " + curSubService;
		else
			curService = curSubService;
	}
	result.strReplace("#SERVICENAME#", curService);

	return result;
}
Пример #11
0
eString getEITC(eString result, eString format)
{
	eString now_start, now_date, now_time, now_duration, now_text, now_longtext,
		next_start, next_date, next_time, next_duration, next_text, next_longtext;

	EIT *eit = eDVB::getInstance()->getEIT();
	if (eit)
	{
		int p = 0;
		for (ePtrList<EITEvent>::iterator event(eit->events); event != eit->events.end(); ++event)
		{
			if (*event)
			{
				if (p == 0)
				{
					if (event->start_time)
					{
						now_start = eString().sprintf("%d", (int)event->start_time);
						tm* t = localtime(&event->start_time);
						now_time.sprintf("%02d:%02d", t->tm_hour, t->tm_min);
						now_date.sprintf("%02d.%02d.%04d", t->tm_mday, t->tm_mon + 1, t->tm_year + 1900);
						now_duration.sprintf("%d", (int)(event->duration / 60));
					}
				}
				if (p == 1)
				{
					if (event->start_time)
					{
						next_start = eString().sprintf("%d", (int)event->start_time);
						tm* t = localtime(&event->start_time);
						next_time.sprintf("%02d:%02d", t->tm_hour, t->tm_min);
						next_date.sprintf("%02d.%02d.%04d", t->tm_mday, t->tm_mon + 1, t->tm_year + 1900);
						next_duration.sprintf("%d", (int)(event->duration / 60));
					}
				}
				LocalEventData led;
				switch (p)
				{
					case 0:
						led.getLocalData(event, &now_text, 0, &now_longtext);
						break;
					case 1:
						led.getLocalData(event, &next_text, 0, &next_longtext);
						break;
				}
				p++;
		 	}
		}
		eit->unlock();
	}

	result.strReplace("#NOWSTART#", now_start);
	result.strReplace("#NOWT#", now_time);
	result.strReplace("#NOWDATE#", now_date);
	result.strReplace("#NOWDURATION#", now_duration);
	if (now_duration)
		now_duration = "(" + now_duration + ")";
	result.strReplace("#NOWD#", now_duration);
	result.strReplace("#NOWST#", XMLify(filter_string(now_text.strReplace("\"", "'")), format));
	result.strReplace("#NOWLT#", XMLify(filter_string(now_longtext.strReplace("\"", "'")), format));
	result.strReplace("#NEXTSTART#", next_start);
	result.strReplace("#NEXTT#", next_time);
	result.strReplace("#NEXTDATE#", next_date);
	result.strReplace("#NEXTDURATION#", next_duration);
	if (next_duration)
		next_duration = "(" + next_duration + ")";
	result.strReplace("#NEXTD#", next_duration);
	result.strReplace("#NEXTST#", XMLify(filter_string(next_text.strReplace("\"", "'")), format));
	result.strReplace("#NEXTLT#", XMLify(filter_string(next_longtext.strReplace("\"", "'")), format));

	eString curService = getCurService();
	eString curServiceRef;
	eDVBServiceController *sapi = eDVB::getInstance()->getServiceAPI();
	if (sapi)
		curServiceRef = ref2string(sapi->service);
	eString curSubService = getCurrentSubChannel(curServiceRef);
	if (curSubService)
	{
		if (curService)
			curService += ": " + curSubService;
		else
			curService = curSubService;
	}
	result.strReplace("#SERVICENAME#", curService);

	return result;
}