imdb: change getIMDbElement() handling; function now returns a string

Origin commit data
------------------
Branch: ni/coolstream
Commit: 0b5a851514
Author: vanhofen <vanhofen@gmx.de>
Date: 2017-05-29 (Mon, 29 May 2017)

Origin message was:
------------------
- imdb: change getIMDbElement() handling; function now returns a string

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2017-05-29 11:49:00 +02:00
parent 8d4543e450
commit 04ec1ff0ca
3 changed files with 13 additions and 27 deletions

View File

@@ -1643,8 +1643,7 @@ int CEpgData::showIMDb(bool splash)
}
//titel
std::string title = "Title";
imdb->getIMDbElement(title);
std::string title = imdb->getIMDbElement("Title");
if(((title.find("IMDb: URL (Seite) nicht gefunden")) != std::string::npos))
return 1;
@@ -1663,8 +1662,7 @@ int CEpgData::showIMDb(bool splash)
textCount = epgText.size();
//rating
imdb_rating = "imdbRating";
imdb->getIMDbElement(imdb_rating);
imdb_rating = imdb->getIMDbElement("imdbRating");
std::string value = imdb_rating;
if (imdb_rating == "N/A")
@@ -1675,13 +1673,6 @@ int CEpgData::showIMDb(bool splash)
else
imdb_rating += "/10";
#if 0
std::string votes = "imdbVotes";
imdb->getIMDbElement(votes);
if (votes != "N/A")
imdb_rating += " (Stimmen: " + votes + ")";
#endif
size_t pos = value.find_first_of(",.");
if (pos != std::string::npos)
value.replace(pos, 1, ""); // change 8,1 or 8.1 to 81

View File

@@ -54,7 +54,7 @@ class CIMDB
bool gotPoster() { return (access(posterfile.c_str(), F_OK) == 0); };
//FIXME: what if m[element] doesn't exist?
virtual void getIMDbElement(std::string& element) { element = m[element]; };
std::string getIMDbElement(std::string element) { return m[element]; };
private:
int acc;

View File

@@ -787,9 +787,8 @@ int CMovieBrowser::exec(CMenuTarget* parent, const std::string & actionKey)
imdb->getIMDb(title);
#if 0
element = "Title";
imdb->getIMDbElement(element);
if (element.compare("Title") != 0)
element = imdb->getIMDbElement("Title");
if (!element.empty())
{
printf("Title\n");
printf("* old: %s\n", m_movieSelectionHandler->epgTitle.c_str());
@@ -797,9 +796,8 @@ int CMovieBrowser::exec(CMenuTarget* parent, const std::string & actionKey)
printf("* new: %s\n", m_movieSelectionHandler->epgTitle.c_str());
}
element = "Genre";
imdb->getIMDbElement(element);
if (element.compare("Genre") != 0)
element = imdb->getIMDbElement("Genre");
if (!element.empty())
{
printf("Genre\n");
printf("* old: %s\n", m_movieSelectionHandler->epgInfo1.c_str());
@@ -808,9 +806,8 @@ int CMovieBrowser::exec(CMenuTarget* parent, const std::string & actionKey)
}
#endif
element = "Year";
imdb->getIMDbElement(element);
if (element.compare("Year") != 0)
element = imdb->getIMDbElement("Year");
if (!element.empty())
{
printf("Year\n");
printf("* old: %d\n", m_movieSelectionHandler->productionDate);
@@ -818,9 +815,8 @@ int CMovieBrowser::exec(CMenuTarget* parent, const std::string & actionKey)
printf("* new: %d\n", m_movieSelectionHandler->productionDate);
}
element = "Country";
imdb->getIMDbElement(element);
if (element.compare("Country") != 0)
element = imdb->getIMDbElement("Country");
if (!element.empty())
{
printf("Country\n");
printf("* old: %s\n", m_movieSelectionHandler->productionCountry.c_str());
@@ -828,9 +824,8 @@ int CMovieBrowser::exec(CMenuTarget* parent, const std::string & actionKey)
printf("* new: %s\n", m_movieSelectionHandler->productionCountry.c_str());
}
element = "imdbRating";
imdb->getIMDbElement(element);
if (element.compare("imdbRating") != 0 && element.compare("N/A") != 0)
element = imdb->getIMDbElement("imdbRating");
if (!element.empty())
{
if ((pos = element.find_first_of(",.")) != std::string::npos)
element.replace(pos, 1, ""); // change 8,1 or 8.1 to 81