mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-26 15:02:50 +02:00
imdb/tmdb: unify some funtions
Origin commit data
------------------
Branch: ni/coolstream
Commit: 41a26f5872
Author: vanhofen <vanhofen@gmx.de>
Date: 2021-04-10 (Sat, 10 Apr 2021)
Origin message was:
------------------
- imdb/tmdb: unify some funtions
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -1200,11 +1200,7 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start
|
||||
epgText_saved = epgText;
|
||||
epgText.clear();
|
||||
tmdb_active = !tmdb_active;
|
||||
|
||||
epgTextSwitch = tmdb->getDescription();
|
||||
if (!tmdb->getCast().empty())
|
||||
epgTextSwitch += "\n\n"+(std::string)g_Locale->getText(LOCALE_EPGEXTENDED_ACTORS)+":\n"+ tmdb->getCast()+"\n";
|
||||
|
||||
epgTextSwitch = tmdb->CreateMovieText();
|
||||
processTextToArray(tmdb->CreateEPGText(), 0, tmdb->hasCover());
|
||||
textCount = epgText.size();
|
||||
tmdb_stars = tmdb->getStars();
|
||||
@@ -1697,39 +1693,8 @@ int CEpgData::showIMDb(bool splash)
|
||||
epgText.clear();
|
||||
|
||||
//data
|
||||
std::string txt;
|
||||
txt.clear();
|
||||
imdb->getIMDbData(txt);
|
||||
|
||||
// create mp_movie_info->epgInfo2
|
||||
if (imdb->checkIMDbElement("Plot"))
|
||||
{
|
||||
epgTextSwitch = imdb->getIMDbElement("Plot") + "\n";
|
||||
if (imdb->checkIMDbElement("Title"))
|
||||
{
|
||||
epgTextSwitch += "\n";
|
||||
epgTextSwitch += g_Locale->getString(LOCALE_IMDB_DATA_TITLE) + ": ";
|
||||
epgTextSwitch += imdb->getIMDbElement("Title");
|
||||
}
|
||||
if (imdb->checkIMDbElement("Country"))
|
||||
{
|
||||
epgTextSwitch += "\n";
|
||||
epgTextSwitch += g_Locale->getString(LOCALE_IMDB_DATA_RELEASED) + ": ";
|
||||
epgTextSwitch += imdb->getIMDbElement("Country");
|
||||
if (imdb->checkIMDbElement("Released"))
|
||||
{
|
||||
epgTextSwitch += ", " + imdb->getIMDbElement("Released");
|
||||
}
|
||||
}
|
||||
if (imdb->checkIMDbElement("Actors"))
|
||||
{
|
||||
epgTextSwitch += "\n";
|
||||
epgTextSwitch += g_Locale->getString(LOCALE_IMDB_DATA_ACTORS) + ": ";
|
||||
epgTextSwitch += imdb->getIMDbElement("Actors");
|
||||
}
|
||||
}
|
||||
|
||||
processTextToArray(txt, 0, imdb->gotPoster());
|
||||
epgTextSwitch = imdb->CreateMovieText();
|
||||
processTextToArray(imdb->CreateEPGText(), 0, imdb->gotPoster());
|
||||
|
||||
textCount = epgText.size();
|
||||
|
||||
|
@@ -364,47 +364,80 @@ bool CIMDB::checkIMDbElement(std::string element)
|
||||
return true;
|
||||
}
|
||||
|
||||
void CIMDB::getIMDbData(std::string& txt)
|
||||
std::string CIMDB::CreateEPGText()
|
||||
{
|
||||
if (m["imdbID"].empty() || m["Response"] != "True")
|
||||
{
|
||||
txt = g_Locale->getText(LOCALE_IMDB_DATA_FAILED);
|
||||
return;
|
||||
}
|
||||
return g_Locale->getText(LOCALE_IMDB_DATA_FAILED);
|
||||
|
||||
txt += g_Locale->getString(LOCALE_IMDB_DATA_VOTES) + ": " + m["imdbVotes"] + "\n";
|
||||
std::string epgtext("");
|
||||
|
||||
epgtext += g_Locale->getString(LOCALE_IMDB_DATA_VOTES) + ": " + m["imdbVotes"] + "\n";
|
||||
if (checkIMDbElement("Metascore"))
|
||||
txt += g_Locale->getString(LOCALE_IMDB_DATA_METASCORE) + ": " + m["Metascore"] + "/100\n";
|
||||
txt += "\n";
|
||||
txt += g_Locale->getString(LOCALE_IMDB_DATA_TITLE) + ": " + m["Title"] + "\n";
|
||||
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"))
|
||||
txt += g_Locale->getString(LOCALE_IMDB_DATA_RELEASED) + ": " + m["Country"] + ", " + m["Released"] + "\n";
|
||||
epgtext += g_Locale->getString(LOCALE_IMDB_DATA_RELEASED) + ": " + m["Country"] + ", " + m["Released"] + "\n";
|
||||
if (checkIMDbElement("Runtime"))
|
||||
txt += g_Locale->getString(LOCALE_IMDB_DATA_RUNTIME) + ": " + m["Runtime"] + "\n";
|
||||
epgtext += g_Locale->getString(LOCALE_IMDB_DATA_RUNTIME) + ": " + m["Runtime"] + "\n";
|
||||
if (checkIMDbElement("Genre"))
|
||||
txt += g_Locale->getString(LOCALE_IMDB_DATA_GENRE) + ": " + m["Genre"] + "\n";
|
||||
epgtext += g_Locale->getString(LOCALE_IMDB_DATA_GENRE) + ": " + m["Genre"] + "\n";
|
||||
if (checkIMDbElement("Awards"))
|
||||
txt += g_Locale->getString(LOCALE_IMDB_DATA_AWARDS) + ": " + m["Awards"] + "\n";
|
||||
epgtext += g_Locale->getString(LOCALE_IMDB_DATA_AWARDS) + ": " + m["Awards"] + "\n";
|
||||
if (checkIMDbElement("Director"))
|
||||
txt += g_Locale->getString(LOCALE_IMDB_DATA_DIRECTOR) + ": " + m["Director"] + "\n";
|
||||
epgtext += g_Locale->getString(LOCALE_IMDB_DATA_DIRECTOR) + ": " + m["Director"] + "\n";
|
||||
if (checkIMDbElement("Writer"))
|
||||
txt += g_Locale->getString(LOCALE_IMDB_DATA_WRITER) + ": " + m["Writer"] + "\n";
|
||||
epgtext += g_Locale->getString(LOCALE_IMDB_DATA_WRITER) + ": " + m["Writer"] + "\n";
|
||||
if (checkIMDbElement("Production"))
|
||||
txt += g_Locale->getString(LOCALE_IMDB_DATA_PRODUCTION) + ": " + m["Production"] + "\n";
|
||||
epgtext += g_Locale->getString(LOCALE_IMDB_DATA_PRODUCTION) + ": " + m["Production"] + "\n";
|
||||
if (checkIMDbElement("Website"))
|
||||
txt += g_Locale->getString(LOCALE_IMDB_DATA_WEBSITE) + ": " + m["Website"] + "\n";
|
||||
epgtext += g_Locale->getString(LOCALE_IMDB_DATA_WEBSITE) + ": " + m["Website"] + "\n";
|
||||
if (checkIMDbElement("BoxOffice"))
|
||||
txt += g_Locale->getString(LOCALE_IMDB_DATA_BOXOFFICE) + ": " + m["BoxOffice"] + "\n";
|
||||
epgtext += g_Locale->getString(LOCALE_IMDB_DATA_BOXOFFICE) + ": " + m["BoxOffice"] + "\n";
|
||||
if (checkIMDbElement("Actors"))
|
||||
{
|
||||
txt += "\n";
|
||||
txt += g_Locale->getString(LOCALE_IMDB_DATA_ACTORS) + ": " + m["Actors"] + "\n";
|
||||
epgtext += "\n";
|
||||
epgtext += g_Locale->getString(LOCALE_IMDB_DATA_ACTORS) + ": " + m["Actors"] + "\n";
|
||||
}
|
||||
if (checkIMDbElement("Plot"))
|
||||
{
|
||||
txt += "\n";
|
||||
txt += g_Locale->getString(LOCALE_IMDB_DATA_PLOT) + ": " + m["Plot"];
|
||||
epgtext += "\n";
|
||||
epgtext += g_Locale->getString(LOCALE_IMDB_DATA_PLOT) + ": " + m["Plot"];
|
||||
}
|
||||
|
||||
return epgtext;
|
||||
}
|
||||
|
||||
std::string CIMDB::CreateMovieText()
|
||||
{
|
||||
std::string movietext("");
|
||||
|
||||
if (checkIMDbElement("Plot"))
|
||||
{
|
||||
movietext = m["Plot"] + "\n";
|
||||
if (checkIMDbElement("Title"))
|
||||
{
|
||||
movietext += "\n";
|
||||
movietext += g_Locale->getString(LOCALE_IMDB_DATA_TITLE) + ": ";
|
||||
movietext += m["Title"];
|
||||
}
|
||||
if (checkIMDbElement("Country"))
|
||||
{
|
||||
movietext += "\n";
|
||||
movietext += g_Locale->getString(LOCALE_IMDB_DATA_RELEASED) + ": ";
|
||||
movietext += m["Country"];
|
||||
if (checkIMDbElement("Released"))
|
||||
movietext += ", " + m["Released"];
|
||||
}
|
||||
if (checkIMDbElement("Actors"))
|
||||
{
|
||||
movietext += "\n";
|
||||
movietext += g_Locale->getString(LOCALE_IMDB_DATA_ACTORS) + ": ";
|
||||
movietext += m["Actors"];
|
||||
}
|
||||
}
|
||||
|
||||
return movietext;
|
||||
}
|
||||
|
||||
std::string CIMDB::getFilename(CZapitChannel * channel, uint64_t id)
|
||||
@@ -485,5 +518,5 @@ void CIMDB::cleanup()
|
||||
|
||||
bool CIMDB::gotPoster()
|
||||
{
|
||||
return (access(posterfile.c_str(), F_OK) == 0);
|
||||
return (access(posterfile.c_str(), F_OK) == 0);
|
||||
}
|
||||
|
@@ -24,8 +24,6 @@
|
||||
#ifndef __imdb__
|
||||
#define __imdb__
|
||||
|
||||
|
||||
|
||||
#include <zapit/zapit.h>
|
||||
|
||||
class CIMDB
|
||||
@@ -46,7 +44,8 @@ class CIMDB
|
||||
void StringReplace(std::string &str, const std::string search, const std::string rstr);
|
||||
void cleanup();
|
||||
|
||||
void getIMDbData(std::string& txt);
|
||||
std::string CreateEPGText();
|
||||
std::string CreateMovieText();
|
||||
|
||||
bool gotPoster();
|
||||
|
||||
|
@@ -191,25 +191,45 @@ bool cTmdb::GetMovieDetails(std::string lang, bool second)
|
||||
|
||||
std::string cTmdb::CreateEPGText()
|
||||
{
|
||||
std::string epgtext;
|
||||
epgtext += "Vote: "+minfo.vote_average.substr(0,3)+"/10 Votecount: "+to_string(minfo.vote_count)+"\n";
|
||||
std::string epgtext("");
|
||||
|
||||
epgtext += "Vote: " + minfo.vote_average.substr(0,3) + "/10 Votecount: " + to_string(minfo.vote_count) + "\n";
|
||||
epgtext += "\n";
|
||||
epgtext += minfo.overview+"\n";
|
||||
epgtext += minfo.overview + "\n";
|
||||
epgtext += "\n";
|
||||
if (minfo.media_type == "tv")
|
||||
epgtext += (std::string)g_Locale->getText(LOCALE_EPGVIEWER_LENGTH)+": "+minfo.runtimes+"\n";
|
||||
epgtext += g_Locale->getString(LOCALE_EPGVIEWER_LENGTH) + ": " + minfo.runtimes + "\n";
|
||||
else
|
||||
epgtext += (std::string)g_Locale->getText(LOCALE_EPGVIEWER_LENGTH)+": "+to_string(minfo.runtime)+"\n";
|
||||
epgtext += (std::string)g_Locale->getText(LOCALE_EPGVIEWER_GENRE)+": "+minfo.genres+"\n";
|
||||
epgtext += (std::string)g_Locale->getText(LOCALE_EPGEXTENDED_ORIGINAL_TITLE) +" : "+ minfo.original_title+"\n";
|
||||
epgtext += (std::string)g_Locale->getText(LOCALE_EPGEXTENDED_YEAR_OF_PRODUCTION)+" : "+ minfo.release_date.substr(0,4) +"\n";
|
||||
epgtext += g_Locale->getString(LOCALE_EPGVIEWER_LENGTH) + ": " + to_string(minfo.runtime) + "\n";
|
||||
epgtext += g_Locale->getString(LOCALE_EPGVIEWER_GENRE) + ": " + minfo.genres + "\n";
|
||||
epgtext += g_Locale->getString(LOCALE_EPGEXTENDED_ORIGINAL_TITLE) + ": " + minfo.original_title + "\n";
|
||||
epgtext += g_Locale->getString(LOCALE_EPGEXTENDED_YEAR_OF_PRODUCTION) + ": " + minfo.release_date.substr(0,4) + "\n";
|
||||
if (minfo.media_type == "tv")
|
||||
epgtext += "Seasons/Episodes: "+to_string(minfo.seasons)+"/"+to_string(minfo.episodes)+"\n";
|
||||
epgtext += "Seasons/Episodes: " + to_string(minfo.seasons) + "/" + to_string(minfo.episodes) + "\n";
|
||||
if (!minfo.cast.empty())
|
||||
epgtext += (std::string)g_Locale->getText(LOCALE_EPGEXTENDED_ACTORS)+":\n"+ minfo.cast+"\n";
|
||||
epgtext += g_Locale->getString(LOCALE_EPGEXTENDED_ACTORS) + ":\n" + minfo.cast + "\n";
|
||||
|
||||
return epgtext;
|
||||
}
|
||||
|
||||
std::string cTmdb::CreateMovieText()
|
||||
{
|
||||
std::string movietext("");
|
||||
|
||||
if (!minfo.overview.empty())
|
||||
{
|
||||
movietext = minfo.overview + "\n";
|
||||
if (!minfo.cast.empty())
|
||||
{
|
||||
movietext += "\n";
|
||||
movietext += g_Locale->getString(LOCALE_EPGEXTENDED_ACTORS) + ":\n";
|
||||
movietext += minfo.cast;
|
||||
}
|
||||
}
|
||||
|
||||
return movietext;
|
||||
}
|
||||
|
||||
void cTmdb::cleanup()
|
||||
{
|
||||
if (access(TMDB_COVER, F_OK) == 0)
|
||||
|
@@ -62,6 +62,7 @@ class cTmdb
|
||||
static cTmdb* getInstance();
|
||||
void setTitle(std::string epgtitle);
|
||||
std::string CreateEPGText();
|
||||
std::string CreateMovieText();
|
||||
|
||||
std::string getTitle() { return minfo.epgtitle;}
|
||||
std::string getOrgTitle() { return minfo.original_title;}
|
||||
@@ -69,7 +70,7 @@ class cTmdb
|
||||
std::string getDescription() { return minfo.overview;}
|
||||
std::string getVote() { return minfo.vote_average;}
|
||||
std::string getCast() { return minfo.cast;}
|
||||
std::string getCover() { return TMDB_COVER;}
|
||||
std::string getCover() { return TMDB_COVER;}
|
||||
bool hasCover() { return !minfo.poster_path.empty();}
|
||||
bool getBigCover(std::string cover) { return downloadUrl("http://image.tmdb.org/t/p/w342" + minfo.poster_path, cover);}
|
||||
bool getSmallCover(std::string cover) { return downloadUrl("http://image.tmdb.org/t/p/w185" + minfo.poster_path, cover);}
|
||||
|
Reference in New Issue
Block a user