diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index 12de4eaab..471d96df1 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -1229,7 +1229,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start //show IMDb info imdb_active = true; showIMDb(true); //show splashscreen only - imdb->getIMDb(epgData.title); + imdb->getMovieDetails(epgData.title); showIMDb(); showTimerEventBar(true, !mp_info && isCurrentEPG(channel_id), mp_info); //show buttons timeoutEnd = CRCInput::calcTimeoutEnd(timeout); diff --git a/src/gui/mdb-imdb.cpp b/src/gui/mdb-imdb.cpp index 20797f4f0..12a9e8d65 100644 --- a/src/gui/mdb-imdb.cpp +++ b/src/gui/mdb-imdb.cpp @@ -299,7 +299,7 @@ void CIMDB::initMap( std::map& my ) //my["Type"] = root.get("Type", "").asString(); } -int CIMDB::getIMDb(const std::string& epgTitle) +int CIMDB::getMovieDetails(const std::string& epgTitle) { CHTTPTool httpTool; int ret = 0; @@ -350,7 +350,7 @@ int CIMDB::getIMDb(const std::string& epgTitle) return ret; } -bool CIMDB::checkIMDbElement(std::string element) +bool CIMDB::checkElement(std::string element) { if (m[element].empty() || m[element].compare("N/A") == 0) return false; @@ -366,34 +366,34 @@ std::string CIMDB::getEPGText() std::string epgtext(""); epgtext += g_Locale->getString(LOCALE_IMDB_DATA_VOTES) + ": " + m["imdbVotes"] + "\n"; - if (checkIMDbElement("Metascore")) + if (checkElement("Metascore")) epgtext += g_Locale->getString(LOCALE_IMDB_DATA_METASCORE) + ": " + m["Metascore"] + "/100\n"; epgtext += "\n"; epgtext += g_Locale->getString(LOCALE_IMDB_DATA_TITLE) + ": " + m["Title"] + "\n"; - if (checkIMDbElement("Released")) + if (checkElement("Released")) epgtext += g_Locale->getString(LOCALE_IMDB_DATA_RELEASED) + ": " + m["Country"] + ", " + m["Released"] + "\n"; - if (checkIMDbElement("Runtime")) + if (checkElement("Runtime")) epgtext += g_Locale->getString(LOCALE_IMDB_DATA_RUNTIME) + ": " + m["Runtime"] + "\n"; - if (checkIMDbElement("Genre")) + if (checkElement("Genre")) epgtext += g_Locale->getString(LOCALE_IMDB_DATA_GENRE) + ": " + m["Genre"] + "\n"; - if (checkIMDbElement("Awards")) + if (checkElement("Awards")) epgtext += g_Locale->getString(LOCALE_IMDB_DATA_AWARDS) + ": " + m["Awards"] + "\n"; - if (checkIMDbElement("Director")) + if (checkElement("Director")) epgtext += g_Locale->getString(LOCALE_IMDB_DATA_DIRECTOR) + ": " + m["Director"] + "\n"; - if (checkIMDbElement("Writer")) + if (checkElement("Writer")) epgtext += g_Locale->getString(LOCALE_IMDB_DATA_WRITER) + ": " + m["Writer"] + "\n"; - if (checkIMDbElement("Production")) + if (checkElement("Production")) epgtext += g_Locale->getString(LOCALE_IMDB_DATA_PRODUCTION) + ": " + m["Production"] + "\n"; - if (checkIMDbElement("Website")) + if (checkElement("Website")) epgtext += g_Locale->getString(LOCALE_IMDB_DATA_WEBSITE) + ": " + m["Website"] + "\n"; - if (checkIMDbElement("BoxOffice")) + if (checkElement("BoxOffice")) epgtext += g_Locale->getString(LOCALE_IMDB_DATA_BOXOFFICE) + ": " + m["BoxOffice"] + "\n"; - if (checkIMDbElement("Actors")) + if (checkElement("Actors")) { epgtext += "\n"; epgtext += g_Locale->getString(LOCALE_IMDB_DATA_ACTORS) + ": " + m["Actors"] + "\n"; } - if (checkIMDbElement("Plot")) + if (checkElement("Plot")) { epgtext += "\n"; epgtext += g_Locale->getString(LOCALE_IMDB_DATA_PLOT) + ": " + m["Plot"]; @@ -406,24 +406,24 @@ std::string CIMDB::getMovieText() { std::string movietext(""); - if (checkIMDbElement("Plot")) + if (checkElement("Plot")) { movietext = m["Plot"] + "\n"; - if (checkIMDbElement("Title")) + if (checkElement("Title")) { movietext += "\n"; movietext += g_Locale->getString(LOCALE_IMDB_DATA_TITLE) + ": "; movietext += m["Title"]; } - if (checkIMDbElement("Country")) + if (checkElement("Country")) { movietext += "\n"; movietext += g_Locale->getString(LOCALE_IMDB_DATA_RELEASED) + ": "; movietext += m["Country"]; - if (checkIMDbElement("Released")) + if (checkElement("Released")) movietext += ", " + m["Released"]; } - if (checkIMDbElement("Actors")) + if (checkElement("Actors")) { movietext += "\n"; movietext += g_Locale->getString(LOCALE_IMDB_DATA_ACTORS) + ": "; diff --git a/src/gui/mdb-imdb.h b/src/gui/mdb-imdb.h index 12c69408d..4bc6bfc4e 100644 --- a/src/gui/mdb-imdb.h +++ b/src/gui/mdb-imdb.h @@ -53,7 +53,7 @@ class CIMDB std::string imdb_outfile; std::string posterfile; - int getIMDb(const std::string& epgTitle); + int getMovieDetails(const std::string& epgTitle); std::string getFilename(CZapitChannel * channel, uint64_t id); void StringReplace(std::string &str, const std::string search, const std::string rstr); void cleanup(); @@ -64,7 +64,7 @@ class CIMDB std::string getPoster() { return posterfile;} bool hasPoster() { return (access(posterfile.c_str(), F_OK) == 0); } - bool checkIMDbElement(std::string element); + bool checkElement(std::string element); //FIXME: what if m[element] doesn't exist? std::string getIMDbElement(std::string element) { return m[element]; }; }; diff --git a/src/gui/mdb-tmdb.cpp b/src/gui/mdb-tmdb.cpp index 41c653f59..1cc7437de 100644 --- a/src/gui/mdb-tmdb.cpp +++ b/src/gui/mdb-tmdb.cpp @@ -70,9 +70,9 @@ void CTMDB::setTitle(std::string epgtitle) hintbox->paint(); std::string lang = Lang2ISO639_1(g_settings.language); - GetMovieDetails(lang); + getMovieDetails(lang); if ((minfo.result < 1 || minfo.overview.empty()) && lang != "en") - GetMovieDetails("en", true); + getMovieDetails("en", true); if(hintbox){ hintbox->hide(); @@ -81,7 +81,7 @@ void CTMDB::setTitle(std::string epgtitle) } } -bool CTMDB::GetData(std::string url, Json::Value *root) +bool CTMDB::getData(std::string url, Json::Value *root) { std::string answer; if (!getUrl(url, answer)) @@ -97,13 +97,13 @@ bool CTMDB::GetData(std::string url, Json::Value *root) return true; } -bool CTMDB::GetMovieDetails(std::string lang, bool second) +bool CTMDB::getMovieDetails(std::string lang, bool second) { printf("[TMDB]: %s\n",__func__); Json::Value root; const std::string urlapi = "http://api.themoviedb.org/3/"; std::string url = urlapi + "search/multi?api_key="+key+"&language="+lang+"&query=" + encodeUrl(minfo.epgtitle); - if(!(GetData(url, &root))) + if(!(getData(url, &root))) return false; minfo.result = root.get("total_results",0).asInt(); @@ -115,7 +115,7 @@ bool CTMDB::GetMovieDetails(std::string lang, bool second) printf("[TMDB]: second try\n"); title.replace(pos1, pos2-pos1+1, ""); url = urlapi + "search/multi?api_key="+key+"&language="+lang+"&query=" + encodeUrl(title); - if(!(GetData(url, &root))) + if(!(getData(url, &root))) return false; minfo.result = root.get("total_results",0).asInt(); @@ -136,7 +136,7 @@ bool CTMDB::GetMovieDetails(std::string lang, bool second) } if (minfo.id > -1) { url = urlapi+minfo.media_type+"/"+to_string(minfo.id)+"?api_key="+key+"&language="+lang+"&append_to_response=credits"; - if(!(GetData(url, &root))) + if(!(getData(url, &root))) return false; minfo.overview = root.get("overview","").asString(); diff --git a/src/gui/mdb-tmdb.h b/src/gui/mdb-tmdb.h index 49d52e875..7a5aac644 100644 --- a/src/gui/mdb-tmdb.h +++ b/src/gui/mdb-tmdb.h @@ -52,8 +52,8 @@ class CTMDB tmdbinfo minfo; CHintBox* hintbox; std::string key; // tmdb api key - bool GetMovieDetails(std::string lang, bool second = false); - bool GetData(std::string url, Json::Value *root); + bool getMovieDetails(std::string lang, bool second = false); + bool getData(std::string url, Json::Value *root); void selectResult(Json::Value elements, int results, int &used_result); std::string posterfile; diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index 0c84cf471..e3e416d3e 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -818,7 +818,7 @@ int CMovieBrowser::exec(CMenuTarget* parent, const std::string & actionKey) std::string title = m_movieSelectionHandler->epgTitle; CIMDB *imdb = CIMDB::getInstance(); - imdb->getIMDb(title); + imdb->getMovieDetails(title); #if 0 element = imdb->getIMDbElement("Title");