bool CMovieInfo::loadMovieInfo(MI_MOVIE_INFO * movie_info, CFile * file)
{
	//TRACE("[mi]->loadMovieInfo \r\n");
	bool result = true;
	CFile file_xml;

	if (file == NULL) {
		// if there is no give file, we use the file name from movie info but we have to convert the ts name to xml name first
		file_xml.Name = movie_info->file.Name;
		result = convertTs2XmlName(file_xml.Name);
	} else {
		file_xml.Name = file->Name;
	}

	if (result == true) {
		// load xml file in buffer
		std::string text;
		result = loadFile(file_xml, text);
		if (result == true) {
#ifdef XMLTREE_LIB
			result = parseXmlTree(text, movie_info);
#else /* XMLTREE_LIB */
			result = parseXmlQuickFix(text, movie_info);
#endif /* XMLTREE_LIB */
		}
	}
	if (movie_info->productionDate > 50 && movie_info->productionDate < 200)	// backwardcompaibility
		movie_info->productionDate += 1900;

	return (result);
}
std::auto_ptr<ParseTree>
parseXmlTree(const std::string & line)
{
    std::vector<std::string> xmlTokens(TokenizeXml(line));
    std::vector<std::string>::const_iterator begin(xmlTokens.begin());
    std::vector<std::string>::const_iterator end(xmlTokens.end());
    return parseXmlTree(begin, end);
}
Exemple #3
0
bool CMovieInfo::loadMovieInfo( MI_MOVIE_INFO* movie_info, CFile* file )
{
	//TRACE("[mi]->loadMovieInfo \r\n");
	bool result = true;
	CFile file_xml;
	bool is_vdr = false;

	if(file == NULL)
	{
		// if there is no give file, we use the file name from movie info but we have to convert the ts name to xml name first
		file_xml.Name = movie_info->file.Name;
		int pos = file_xml.Name.rfind(".vdr");
		if (pos == (int)file_xml.Name.length() - 4)
		{
			is_vdr = true;
			file_xml.Name = movie_info->file.getPath() + "/info.vdr";
			result = !access(file_xml.Name.c_str(), R_OK);
		}
		else
		{
			result = convertTs2XmlName(&file_xml.Name);
		}
	}
	else
	{
		file_xml.Name = file->Name;
	}
	
	if(result == true)
	{
		// load xml file in buffer
		char text[6000];
		result = loadFile(file_xml,text, 6000);
		if(result == true)  
		{
			if (is_vdr)
			{
				result = parseInfoVDR(text, movie_info);
			}
			else
			{
#ifdef XMLTREE_LIB
				a result = parseXmlTree(text, movie_info);
#else /* XMLTREE_LIB */
				result = parseXmlQuickFix(text, movie_info);
#endif /* XMLTREE_LIB */
			}
		}
	}
    if(movie_info->productionDate >50 && movie_info->productionDate <200)// backwardcompaibility
        movie_info->productionDate += 1900;

	return (result);
}