mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 08:21:12 +02:00
- movieinfo
Encode and decode special chars properly. Patch by Gaucho316. git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@2158 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
@@ -288,7 +288,7 @@ bool CRecordInstance::Update()
|
|||||||
EPG_AUDIO_PIDS audio_pids;
|
EPG_AUDIO_PIDS audio_pids;
|
||||||
|
|
||||||
audio_pids.epgAudioPid = allpids.APIDs[i].pid;
|
audio_pids.epgAudioPid = allpids.APIDs[i].pid;
|
||||||
audio_pids.epgAudioPidName = ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc);
|
audio_pids.epgAudioPidName = g_RemoteControl->current_PIDs.APIDs[i].desc;
|
||||||
audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0;
|
audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0;
|
||||||
audio_pids.selected = 0;
|
audio_pids.selected = 0;
|
||||||
recMovieInfo->audioPids.push_back(audio_pids);
|
recMovieInfo->audioPids.push_back(audio_pids);
|
||||||
@@ -506,7 +506,7 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis
|
|||||||
if (tmpstring.empty())
|
if (tmpstring.empty())
|
||||||
recMovieInfo->epgChannel = "unknown";
|
recMovieInfo->epgChannel = "unknown";
|
||||||
else
|
else
|
||||||
recMovieInfo->epgChannel = ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str());
|
recMovieInfo->epgChannel = tmpstring;
|
||||||
|
|
||||||
tmpstring = "not available";
|
tmpstring = "not available";
|
||||||
if (epgid != 0) {
|
if (epgid != 0) {
|
||||||
@@ -527,10 +527,10 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis
|
|||||||
} else if (!epgTitle.empty()) {
|
} else if (!epgTitle.empty()) {
|
||||||
tmpstring = epgTitle;
|
tmpstring = epgTitle;
|
||||||
}
|
}
|
||||||
recMovieInfo->epgTitle = ZapitTools::UTF8_to_UTF8XML(tmpstring.c_str());
|
recMovieInfo->epgTitle = tmpstring;
|
||||||
recMovieInfo->epgId = channel->getChannelID();
|
recMovieInfo->epgId = channel->getChannelID();
|
||||||
recMovieInfo->epgInfo1 = ZapitTools::UTF8_to_UTF8XML(info1.c_str());
|
recMovieInfo->epgInfo1 = info1;
|
||||||
recMovieInfo->epgInfo2 = ZapitTools::UTF8_to_UTF8XML(info2.c_str());
|
recMovieInfo->epgInfo2 = info2;
|
||||||
recMovieInfo->epgEpgId = epgid;
|
recMovieInfo->epgEpgId = epgid;
|
||||||
recMovieInfo->epgMode = g_Zapit->getMode();
|
recMovieInfo->epgMode = g_Zapit->getMode();
|
||||||
recMovieInfo->epgVideoPid = allpids.PIDs.vpid;
|
recMovieInfo->epgVideoPid = allpids.PIDs.vpid;
|
||||||
@@ -542,7 +542,7 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis
|
|||||||
for(it = apid_list.begin(); it != apid_list.end(); it++) {
|
for(it = apid_list.begin(); it != apid_list.end(); it++) {
|
||||||
if(allpids.APIDs[i].pid == it->apid) {
|
if(allpids.APIDs[i].pid == it->apid) {
|
||||||
audio_pids.epgAudioPid = allpids.APIDs[i].pid;
|
audio_pids.epgAudioPid = allpids.APIDs[i].pid;
|
||||||
audio_pids.epgAudioPidName = ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc);
|
audio_pids.epgAudioPidName = g_RemoteControl->current_PIDs.APIDs[i].desc;
|
||||||
audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0;
|
audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0;
|
||||||
audio_pids.selected = (audio_pids.epgAudioPid == channel->getAudioPid()) ? 1 : 0;
|
audio_pids.selected = (audio_pids.epgAudioPid == channel->getAudioPid()) ? 1 : 0;
|
||||||
recMovieInfo->audioPids.push_back(audio_pids);
|
recMovieInfo->audioPids.push_back(audio_pids);
|
||||||
@@ -553,7 +553,7 @@ void CRecordInstance::FillMovieInfo(CZapitChannel * channel, APIDList & apid_lis
|
|||||||
if(recMovieInfo->audioPids.empty() && allpids.APIDs.size()) {
|
if(recMovieInfo->audioPids.empty() && allpids.APIDs.size()) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
audio_pids.epgAudioPid = allpids.APIDs[i].pid;
|
audio_pids.epgAudioPid = allpids.APIDs[i].pid;
|
||||||
audio_pids.epgAudioPidName = ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc);
|
audio_pids.epgAudioPidName = g_RemoteControl->current_PIDs.APIDs[i].desc;
|
||||||
audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0;
|
audio_pids.atype = allpids.APIDs[i].is_ac3 ? 1 : allpids.APIDs[i].is_aac ? 5 : 0;
|
||||||
audio_pids.selected = 1;
|
audio_pids.selected = 1;
|
||||||
recMovieInfo->audioPids.push_back(audio_pids);
|
recMovieInfo->audioPids.push_back(audio_pids);
|
||||||
|
@@ -119,7 +119,7 @@ bool CMovieInfo::convertTs2XmlName(std::string * filename)
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
#define XML_ADD_TAG_STRING(_xml_text_,_tag_name_,_tag_content_){ \
|
#define XML_ADD_TAG_STRING(_xml_text_,_tag_name_,_tag_content_){ \
|
||||||
_xml_text_ += "\t\t<"_tag_name_">"; \
|
_xml_text_ += "\t\t<"_tag_name_">"; \
|
||||||
_xml_text_ += _tag_content_; \
|
_xml_text_ += ZapitTools::UTF8_to_UTF8XML(_tag_content_.c_str()); \
|
||||||
_xml_text_ += "</"_tag_name_">\n";}
|
_xml_text_ += "</"_tag_name_">\n";}
|
||||||
|
|
||||||
#define XML_ADD_TAG_UNSIGNED(_xml_text_,_tag_name_,_tag_content_){\
|
#define XML_ADD_TAG_UNSIGNED(_xml_text_,_tag_name_,_tag_content_){\
|
||||||
@@ -141,7 +141,7 @@ bool CMovieInfo::convertTs2XmlName(std::string * filename)
|
|||||||
{\
|
{\
|
||||||
if(_node_->GetData() != NULL)\
|
if(_node_->GetData() != NULL)\
|
||||||
{\
|
{\
|
||||||
_string_dest_ = _node_->GetData();\
|
_string_dest_ = decodeXmlSpecialChars(_node_->GetData());\
|
||||||
}\
|
}\
|
||||||
}}
|
}}
|
||||||
#define XML_GET_DATA_INT(_node_,_tag_,_int_dest_){\
|
#define XML_GET_DATA_INT(_node_,_tag_,_int_dest_){\
|
||||||
@@ -201,7 +201,7 @@ bool CMovieInfo::encodeMovieInfoXml(std::string * extMessage, MI_MOVIE_INFO * mo
|
|||||||
sprintf(tmp, "%u", movie_info->audioPids[i].selected); //pids.APIDs[i].pid);
|
sprintf(tmp, "%u", movie_info->audioPids[i].selected); //pids.APIDs[i].pid);
|
||||||
*extMessage += tmp;
|
*extMessage += tmp;
|
||||||
*extMessage += "\" " MI_XML_TAG_NAME "=\"";
|
*extMessage += "\" " MI_XML_TAG_NAME "=\"";
|
||||||
*extMessage += movie_info->audioPids[i].epgAudioPidName; // ZapitTools::UTF8_to_UTF8XML(g_RemoteControl->current_PIDs.APIDs[i].desc);
|
*extMessage += ZapitTools::UTF8_to_UTF8XML(movie_info->audioPids[i].epgAudioPidName.c_str());
|
||||||
*extMessage += "\"/>\n";
|
*extMessage += "\"/>\n";
|
||||||
}
|
}
|
||||||
*extMessage += "\t\t</" MI_XML_TAG_AUDIOPIDS ">\n";
|
*extMessage += "\t\t</" MI_XML_TAG_AUDIOPIDS ">\n";
|
||||||
@@ -235,7 +235,7 @@ bool CMovieInfo::encodeMovieInfoXml(std::string * extMessage, MI_MOVIE_INFO * mo
|
|||||||
sprintf(tmp, "%d", movie_info->bookmarks.user[i].length); //pids.APIDs[i].pid);
|
sprintf(tmp, "%d", movie_info->bookmarks.user[i].length); //pids.APIDs[i].pid);
|
||||||
*extMessage += tmp;
|
*extMessage += tmp;
|
||||||
*extMessage += "\" " MI_XML_TAG_BOOKMARK_USER_NAME "=\"";
|
*extMessage += "\" " MI_XML_TAG_BOOKMARK_USER_NAME "=\"";
|
||||||
*extMessage += movie_info->bookmarks.user[i].name;
|
*extMessage += ZapitTools::UTF8_to_UTF8XML(movie_info->bookmarks.user[i].name.c_str());
|
||||||
*extMessage += "\"/>\n";
|
*extMessage += "\"/>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -372,7 +372,7 @@ bool CMovieInfo::parseXmlTree(char */*text*/, MI_MOVIE_INFO * /*movie_info*/)
|
|||||||
pids.epgAudioPid = atoi(xam2->GetAttributeValue(MI_XML_TAG_PID));
|
pids.epgAudioPid = atoi(xam2->GetAttributeValue(MI_XML_TAG_PID));
|
||||||
pids.atype = atoi(xam2->GetAttributeValue(MI_XML_TAG_ATYPE));
|
pids.atype = atoi(xam2->GetAttributeValue(MI_XML_TAG_ATYPE));
|
||||||
pids.selected = atoi(xam2->GetAttributeValue(MI_XML_TAG_SELECTED));
|
pids.selected = atoi(xam2->GetAttributeValue(MI_XML_TAG_SELECTED));
|
||||||
pids.epgAudioPidName = xam2->GetAttributeValue(MI_XML_TAG_NAME);
|
pids.epgAudioPidName = decodeXmlSpecialChars(xam2->GetAttributeValue(MI_XML_TAG_NAME));
|
||||||
//printf("MOVIE INFO: apid %d type %d name %s selected %d\n", pids.epgAudioPid, pids.atype, pids.epgAudioPidName.c_str(), pids.selected);
|
//printf("MOVIE INFO: apid %d type %d name %s selected %d\n", pids.epgAudioPid, pids.atype, pids.epgAudioPidName.c_str(), pids.selected);
|
||||||
movie_info->audioPids.push_back(pids);
|
movie_info->audioPids.push_back(pids);
|
||||||
}
|
}
|
||||||
@@ -405,16 +405,9 @@ bool CMovieInfo::parseXmlTree(char */*text*/, MI_MOVIE_INFO * /*movie_info*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
delete parser;
|
delete parser;
|
||||||
strReplace(movie_info->epgTitle, """, "\"");
|
|
||||||
strReplace(movie_info->epgInfo1, """, "\"");
|
|
||||||
strReplace(movie_info->epgTitle, "'", "'");
|
|
||||||
strReplace(movie_info->epgInfo1, "'", "'");
|
|
||||||
if (movie_info->epgInfo2 == "") {
|
if (movie_info->epgInfo2 == "") {
|
||||||
movie_info->epgInfo2 = movie_info->epgInfo1;
|
movie_info->epgInfo2 = movie_info->epgInfo1;
|
||||||
//movie_info->epgInfo1 = "";
|
//movie_info->epgInfo1 = "";
|
||||||
} else {
|
|
||||||
strReplace(movie_info->epgInfo2, """, "\"");
|
|
||||||
strReplace(movie_info->epgInfo2, "'", "'");
|
|
||||||
}
|
}
|
||||||
#endif /* XMLTREE_LIB */
|
#endif /* XMLTREE_LIB */
|
||||||
return (true);
|
return (true);
|
||||||
@@ -590,6 +583,7 @@ int find_next_char(char to_find, char *text, int start_pos, int end_pos)
|
|||||||
while(_pos_ < bytes && _text_[_pos_] != '<' ) _pos_++;\
|
while(_pos_ < bytes && _text_[_pos_] != '<' ) _pos_++;\
|
||||||
_dest_ = "";\
|
_dest_ = "";\
|
||||||
_dest_.append(&_text_[pos_prev],_pos_ - pos_prev );\
|
_dest_.append(&_text_[pos_prev],_pos_ - pos_prev );\
|
||||||
|
_dest_ = decodeXmlSpecialChars(_dest_);\
|
||||||
_pos_ += sizeof(_tag_);\
|
_pos_ += sizeof(_tag_);\
|
||||||
continue;\
|
continue;\
|
||||||
}
|
}
|
||||||
@@ -627,6 +621,16 @@ void strReplace(std::string & orig, const char *fstr, const std::string rstr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string decodeXmlSpecialChars(std::string s)
|
||||||
|
{
|
||||||
|
strReplace(s,"<","<");
|
||||||
|
strReplace(s,">",">");
|
||||||
|
strReplace(s,"&","&");
|
||||||
|
strReplace(s,""","\"");
|
||||||
|
strReplace(s,"'","\'");
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
bool CMovieInfo::parseXmlQuickFix(char *text, MI_MOVIE_INFO * movie_info)
|
bool CMovieInfo::parseXmlQuickFix(char *text, MI_MOVIE_INFO * movie_info)
|
||||||
@@ -731,7 +735,10 @@ bool CMovieInfo::parseXmlQuickFix(char *text, MI_MOVIE_INFO * movie_info)
|
|||||||
while (text[pos + pos3] != '\"' && text[pos + pos3] != 0 && text[pos + pos3] != '/')
|
while (text[pos + pos3] != '\"' && text[pos + pos3] != 0 && text[pos + pos3] != '/')
|
||||||
pos3++;
|
pos3++;
|
||||||
if (text[pos + pos3] == '\"')
|
if (text[pos + pos3] == '\"')
|
||||||
|
{
|
||||||
audio_pids.epgAudioPidName.append(&text[pos + pos2 + 1], pos3 - pos2 - 1);
|
audio_pids.epgAudioPidName.append(&text[pos + pos2 + 1], pos3 - pos2 - 1);
|
||||||
|
audio_pids.epgAudioPidName = decodeXmlSpecialChars(audio_pids.epgAudioPidName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("MOVIE INFO: apid %d type %d name %s selected %d\n", audio_pids.epgAudioPid, audio_pids.atype, audio_pids.epgAudioPidName.c_str(), audio_pids.selected);
|
printf("MOVIE INFO: apid %d type %d name %s selected %d\n", audio_pids.epgAudioPid, audio_pids.atype, audio_pids.epgAudioPidName.c_str(), audio_pids.selected);
|
||||||
@@ -776,7 +783,10 @@ bool CMovieInfo::parseXmlQuickFix(char *text, MI_MOVIE_INFO * movie_info)
|
|||||||
while (text[pos + pos3] != '\"' && text[pos + pos3] != 0 && text[pos + pos3] != '/')
|
while (text[pos + pos3] != '\"' && text[pos + pos3] != 0 && text[pos + pos3] != '/')
|
||||||
pos3++;
|
pos3++;
|
||||||
if (text[pos + pos3] == '\"')
|
if (text[pos + pos3] == '\"')
|
||||||
|
{
|
||||||
movie_info->bookmarks.user[bookmark_nr].name.append(&text[pos + pos2 + 1], pos3 - pos2 - 1);
|
movie_info->bookmarks.user[bookmark_nr].name.append(&text[pos + pos2 + 1], pos3 - pos2 - 1);
|
||||||
|
movie_info->bookmarks.user[bookmark_nr].name = decodeXmlSpecialChars(movie_info->bookmarks.user[bookmark_nr].name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -790,16 +800,9 @@ bool CMovieInfo::parseXmlQuickFix(char *text, MI_MOVIE_INFO * movie_info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
strReplace(movie_info->epgTitle, """, "\"");
|
|
||||||
strReplace(movie_info->epgInfo1, """, "\"");
|
|
||||||
strReplace(movie_info->epgTitle, "'", "'");
|
|
||||||
strReplace(movie_info->epgInfo1, "'", "'");
|
|
||||||
if (movie_info->epgInfo2 == "") {
|
if (movie_info->epgInfo2 == "") {
|
||||||
movie_info->epgInfo2 = movie_info->epgInfo1;
|
movie_info->epgInfo2 = movie_info->epgInfo1;
|
||||||
//movie_info->epgInfo1 = "";
|
//movie_info->epgInfo1 = "";
|
||||||
} else {
|
|
||||||
strReplace(movie_info->epgInfo2, """, "\"");
|
|
||||||
strReplace(movie_info->epgInfo2, "'", "'");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (true);
|
return (true);
|
||||||
|
Reference in New Issue
Block a user