예제 #1
0
void CVCRControl::CFileDevice::appendEPGTitle(char *buf, unsigned int size, const event_id_t epgid, const std::string& epgTitleTimer) {
	
	CSectionsdClient sdc;
	CShortEPGData epgdata;
	std::string epgTitle;
	if (size > 0)
		buf[0] = '\0';
	if (sdc.getEPGidShort(epgid, &epgdata))
		epgTitle = epgdata.title;
	else
		epgTitle = epgTitleTimer;

	if (!(epgTitle.empty()) && epgTitle.size() < size)
	{
#warning fixme sectionsd should deliver data in UTF-8 format
//				strcpy(&(filename[pos]), Latin1_to_UTF8(epgdata.title).c_str());
// all characters with code >= 128 will be discarded anyway
		strcpy(buf, epgTitle.c_str());
		char * p_act = buf;
		do {
			p_act += strspn(p_act, FILENAME_ALLOWED_CHARS);
			if (*p_act) {
				*p_act++ = '_';
			}
		} while (*p_act);
	}
}
예제 #2
0
std::string CVCRControl::CFileAndServerDevice::getCommandString(const CVCRCommand command, const t_channel_id channel_id, const event_id_t epgid, const std::string& epgTitle, unsigned char apids)
{
	char tmp[40];
	std::string apids_selected;
	const char * extCommand;
//		std::string extAudioPID= "error";
	std::string info1, info2;
	std::string extMessage = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<neutrino commandversion=\"1\">\n\t<record command=\"";
	switch(command)
	{
	case CMD_VCR_RECORD:
		extCommand = "record";
		break;
	case CMD_VCR_STOP:
		extCommand = "stop";
		break;
	case CMD_VCR_PAUSE:
		extCommand = "pause";
		break;
	case CMD_VCR_RESUME:
		extCommand = "resume";
		break;
	case CMD_VCR_AVAILABLE:
		extCommand = "available";
		break;
	case CMD_VCR_UNKNOWN:
	default:
		extCommand = "unknown";
		printf("[CVCRControl] Unknown Command\n");
	}

	extMessage += extCommand;
	extMessage += 
		"\">\n"
		"\t\t<channelname>";
	
	CZapitClient::responseGetPIDs pids;
	g_Zapit->getPIDS (pids);
	CZapitClient::CCurrentServiceInfo si = g_Zapit->getCurrentServiceInfo ();

	APIDList apid_list;
	getAPIDs(apids,apid_list);
	apids_selected="";
	for(APIDList::iterator it = apid_list.begin(); it != apid_list.end(); it++)
	{
		if(it != apid_list.begin())
			apids_selected += " ";
		sprintf(tmp, "%u", it->apid);
		apids_selected += tmp; 
	}
	
	std::string tmpstring = g_Zapit->getChannelName(channel_id);
	if (tmpstring.empty())
		extMessage += "unknown";
	else
		extMessage += ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str());
	
	extMessage += "</channelname>\n\t\t<epgtitle>";
	
//		CSectionsdClient::responseGetCurrentNextInfoChannelID current_next;
	tmpstring = "not available";
	if (epgid != 0)
	{
		CSectionsdClient sdc;
		CShortEPGData epgdata;
		if (sdc.getEPGidShort(epgid, &epgdata))
		{
#warning fixme sectionsd should deliver data in UTF-8 format
			tmpstring = Latin1_to_UTF8(epgdata.title);
			info1 = Latin1_to_UTF8(epgdata.info1);
			info2 = Latin1_to_UTF8(epgdata.info2);
		}
		else if (!epgTitle.empty())
		{
			tmpstring = epgTitle;
		}
	}
	else if (!epgTitle.empty())
	{
		tmpstring = epgTitle;
	}
	extMessage += ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str());
	
	extMessage += "</epgtitle>\n\t\t<id>";
	
	sprintf(tmp, PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel_id);
	extMessage += tmp;
	
	extMessage += "</id>\n\t\t<info1>";
	extMessage += ZapitTools::UTF8_to_UTF8XML(info1.c_str());
	extMessage += "</info1>\n\t\t<info2>";
	extMessage += ZapitTools::UTF8_to_UTF8XML(info2.c_str());
	extMessage += "</info2>\n\t\t<epgid>";
	sprintf(tmp, "%llu", epgid);
	extMessage += tmp;
	extMessage += "</epgid>\n\t\t<mode>";
	sprintf(tmp, "%d", g_Zapit->getMode());
	extMessage += tmp;
	extMessage += "</mode>\n\t\t<videopid>";
	sprintf(tmp, "%u", si.vpid);
	extMessage += tmp;
	extMessage += "</videopid>\n\t\t<audiopids selected=\"";
	extMessage += apids_selected;
	extMessage += "\">\n";
	// super hack :-), der einfachste weg an die apid descriptions ranzukommen
	g_RemoteControl->current_PIDs = pids;
	g_RemoteControl->processAPIDnames();
	for(unsigned int i= 0; i< pids.APIDs.size(); i++)
	{
		extMessage += "\t\t\t<audio pid=\"";
		sprintf(tmp, "%u", pids.APIDs[i].pid);
		extMessage += tmp;
		extMessage += "\" name=\"";
		extMessage += ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc);
		extMessage += "\"/>\n";
	}
	extMessage += 
		"\t\t</audiopids>\n"
		"\t\t<vtxtpid>";
	sprintf(tmp, "%u", si.vtxtpid);
	extMessage += tmp;
	extMessage +=
		"</vtxtpid>\n"
		"\t</record>\n"
		"</neutrino>\n";

	return extMessage;
}
예제 #3
0
std::string CVCRControl::CFileAndServerDevice::getMovieInfoString(const t_channel_id channel_id,
								  const event_id_t epgid, const time_t epg_time)
{
	std::string extMessage;
	CMovieInfo cMovieInfo;
	MI_MOVIE_INFO movieInfo;
	std::string info1, info2;

	cMovieInfo.clearMovieInfo(&movieInfo);
	CZapitClient::responseGetPIDs pids;
	g_Zapit->getPIDS (pids);
	CZapitClient::CCurrentServiceInfo si = g_Zapit->getCurrentServiceInfo ();

	std::string tmpstring = g_Zapit->getChannelName(channel_id);
	if (tmpstring.empty())
		movieInfo.epgChannel = "unknown";
	else
		movieInfo.epgChannel = ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str());

	tmpstring = "not available";
	if (epgid != 0)
	{
//#define SHORT_EPG
#ifdef SHORT_EPG
		CSectionsdClient sdc;
		CShortEPGData epgdata;
		
		if (sdc.getEPGidShort(epgid, &epgdata))
		{
#warning fixme sectionsd should deliver data in UTF-8 format
			tmpstring = Latin1_to_UTF8(epgdata.title);
			info1 = Latin1_to_UTF8(epgdata.info1);
			info2 = Latin1_to_UTF8(epgdata.info2);
		}
#else
		CSectionsdClient sdc;
		CEPGData epgdata;
		if (sdc.getEPGid(epgid, epg_time,&epgdata))
		{
#warning fixme sectionsd should deliver data in UTF-8 format
			tmpstring = Latin1_to_UTF8(epgdata.title);
			info1 = Latin1_to_UTF8(epgdata.info1);
			info2 = Latin1_to_UTF8(epgdata.info2);
			
			movieInfo.parentalLockAge = epgdata.fsk;
			if(epgdata.contentClassification.size() > 0 )
				movieInfo.genreMajor = epgdata.contentClassification[0];
				
			movieInfo.length = epgdata.epg_times.dauer	/ 60;
				
			printf("fsk:%d, Genre:%d, Dauer: %d\r\n",movieInfo.parentalLockAge,movieInfo.genreMajor,movieInfo.length);	
		}
#endif
	}
	movieInfo.epgTitle = 	ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str());
	movieInfo.epgId = 		channel_id;
	movieInfo.epgInfo1 = 	ZapitTools::UTF8_to_UTF8XML(info1.c_str());
	movieInfo.epgInfo2 = 	ZapitTools::UTF8_to_UTF8XML(info2.c_str());
	movieInfo.epgEpgId =  	epgid ;
	movieInfo.epgMode = 	g_Zapit->getMode();
	movieInfo.epgVideoPid = si.vpid;

	EPG_AUDIO_PIDS audio_pids;
	// super hack :-), der einfachste weg an die apid descriptions ranzukommen
	g_RemoteControl->current_PIDs = pids;
	g_RemoteControl->processAPIDnames();

	for(unsigned int i= 0; i< pids.APIDs.size(); i++)
	{
		audio_pids.epgAudioPid = pids.APIDs[i].pid;
		audio_pids.epgAudioPidName = ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc);
		movieInfo.audioPids.push_back(audio_pids);
	}
	movieInfo.epgVTXPID = si.vtxtpid;

	cMovieInfo.encodeMovieInfoXml(&extMessage,movieInfo);
	
	movieInfo.audioPids.clear();

	return extMessage;
}