mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 16:01:10 +02:00
movieinfo: more cleanup; use htmlEntityDecode from helpers.cpp
Origin commit data
------------------
Branch: ni/coolstream
Commit: 22fcc8fe4d
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-08-11 (Thu, 11 Aug 2016)
Origin message was:
------------------
- movieinfo: more cleanup; use htmlEntityDecode from helpers.cpp
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -1871,7 +1871,7 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg)
|
||||
std::string extension;
|
||||
extension = fname.substr(ext_pos + 1, fname.length() - ext_pos);
|
||||
extension = "." + extension;
|
||||
strReplace(fname, extension.c_str(), ".jpg");
|
||||
str_replace(extension, ".jpg", fname);
|
||||
printf("TMDB: %s : %s\n",m_movieSelectionHandler->file.Name.c_str(),fname.c_str());
|
||||
cTmdb* tmdb = new cTmdb(m_movieSelectionHandler->epgTitle);
|
||||
if ((tmdb->getResults() > 0) && (tmdb->hasCover())) {
|
||||
|
@@ -252,7 +252,7 @@ static int find_next_char(char to_find, const char *text, int start_pos, int end
|
||||
while(_pos_ < bytes && _text_[_pos_] != '<' ) _pos_++;\
|
||||
_dest_ = "";\
|
||||
_dest_.append(&_text_[pos_prev],_pos_ - pos_prev );\
|
||||
_dest_ = decodeXmlSpecialChars(_dest_);\
|
||||
_dest_ = htmlEntityDecode(_dest_);\
|
||||
_pos_ += sizeof(_tag_);\
|
||||
continue;\
|
||||
}
|
||||
@@ -276,31 +276,6 @@ static int find_next_char(char to_find, const char *text, int start_pos, int end
|
||||
continue;\
|
||||
}
|
||||
|
||||
void strReplace(std::string &orig, const char *fstr, const std::string &rstr)
|
||||
{
|
||||
// replace all occurrence of fstr with rstr and returns a reference to itself
|
||||
size_t index = 0;
|
||||
size_t fstrlen = strlen(fstr);
|
||||
size_t rstrlen = rstr.size();
|
||||
|
||||
while ((index = orig.find(fstr, index)) != std::string::npos) {
|
||||
orig.replace(index, fstrlen, rstr);
|
||||
index += rstrlen;
|
||||
}
|
||||
}
|
||||
|
||||
std::string decodeXmlSpecialChars(std::string s)
|
||||
{
|
||||
strReplace(s,"<","<");
|
||||
strReplace(s,">",">");
|
||||
strReplace(s,"&","&");
|
||||
strReplace(s,""","\"");
|
||||
strReplace(s,"'","\'");
|
||||
strReplace(s,"
","\n");
|
||||
strReplace(s,"
","\n");
|
||||
return s;
|
||||
}
|
||||
|
||||
bool CMovieInfo::parseXmlTree(std::string &_text, MI_MOVIE_INFO *movie_info)
|
||||
{
|
||||
int bookmark_nr = 0;
|
||||
@@ -408,7 +383,7 @@ bool CMovieInfo::parseXmlTree(std::string &_text, MI_MOVIE_INFO *movie_info)
|
||||
if (text[pos + pos3] == '\"')
|
||||
{
|
||||
audio_pids.epgAudioPidName.append(&text[pos + pos2 + 1], pos3 - pos2 - 1);
|
||||
audio_pids.epgAudioPidName = decodeXmlSpecialChars(audio_pids.epgAudioPidName);
|
||||
audio_pids.epgAudioPidName = htmlEntityDecode(audio_pids.epgAudioPidName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -456,7 +431,7 @@ bool CMovieInfo::parseXmlTree(std::string &_text, MI_MOVIE_INFO *movie_info)
|
||||
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 = decodeXmlSpecialChars(movie_info->bookmarks.user[bookmark_nr].name);
|
||||
movie_info->bookmarks.user[bookmark_nr].name = htmlEntityDecode(movie_info->bookmarks.user[bookmark_nr].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -487,6 +487,8 @@ std::string& htmlEntityDecode(std::string& text)
|
||||
};
|
||||
decode_table dt[] =
|
||||
{
|
||||
{"\n", "
"},
|
||||
{"\n", "
"},
|
||||
{" ", " "},
|
||||
{"&", "&"},
|
||||
{"<", "<"},
|
||||
|
Reference in New Issue
Block a user