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 //titel
std::string title = "Title"; std::string title = imdb->getIMDbElement("Title");
imdb->getIMDbElement(title);
if(((title.find("IMDb: URL (Seite) nicht gefunden")) != std::string::npos)) if(((title.find("IMDb: URL (Seite) nicht gefunden")) != std::string::npos))
return 1; return 1;
@@ -1663,8 +1662,7 @@ int CEpgData::showIMDb(bool splash)
textCount = epgText.size(); textCount = epgText.size();
//rating //rating
imdb_rating = "imdbRating"; imdb_rating = imdb->getIMDbElement("imdbRating");
imdb->getIMDbElement(imdb_rating);
std::string value = imdb_rating; std::string value = imdb_rating;
if (imdb_rating == "N/A") if (imdb_rating == "N/A")
@@ -1675,13 +1673,6 @@ int CEpgData::showIMDb(bool splash)
else else
imdb_rating += "/10"; 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(",."); size_t pos = value.find_first_of(",.");
if (pos != std::string::npos) if (pos != std::string::npos)
value.replace(pos, 1, ""); // change 8,1 or 8.1 to 81 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); }; bool gotPoster() { return (access(posterfile.c_str(), F_OK) == 0); };
//FIXME: what if m[element] doesn't exist? //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: private:
int acc; int acc;

View File

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