From 04ec1ff0cad769e41e9dab65e59ce274ca763cfc Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 29 May 2017 11:49:00 +0200 Subject: [PATCH] imdb: change getIMDbElement() handling; function now returns a string Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/0b5a8515149f5c5bbacc54c899dd99ccfa5c386a Author: vanhofen 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 --- src/gui/epgview.cpp | 13 ++----------- src/gui/imdb.h | 2 +- src/gui/moviebrowser/mb.cpp | 25 ++++++++++--------------- 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 4968ae486..fb8d0665c 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -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 diff --git a/src/gui/imdb.h b/src/gui/imdb.h index bfdbe1464..1f470ef61 100644 --- a/src/gui/imdb.h +++ b/src/gui/imdb.h @@ -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; diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index 4a012c0d6..969511804 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -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