epgview: more imdb/tmdb unifications

Origin commit data
------------------
Branch: ni/coolstream
Commit: 7f42e3ead6
Author: vanhofen <vanhofen@gmx.de>
Date: 2021-05-03 (Mon, 03 May 2021)

Origin message was:
------------------
- epgview: more imdb/tmdb unifications

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

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2021-05-03 01:00:35 +02:00
parent b57ec6a248
commit ab9d3031a2
2 changed files with 70 additions and 69 deletions

View File

@@ -1183,8 +1183,10 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start
break; break;
case CRCInput::RC_0: //tmdb case CRCInput::RC_0: //tmdb
{ {
if (imdb_active) { if (imdb_active)
{
imdb_active = false; imdb_active = false;
imdb_stars = 0;
showTimerEventBar(true, !mp_info && isCurrentEPG(channel_id), mp_info); //show buttons showTimerEventBar(true, !mp_info && isCurrentEPG(channel_id), mp_info); //show buttons
epgText = epgText_saved; epgText = epgText_saved;
textCount = epgText.size(); textCount = epgText.size();
@@ -1192,25 +1194,30 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start
if (g_settings.tmdb_enabled) if (g_settings.tmdb_enabled)
{ {
showPos = 0; showPos = 0;
if (!tmdb_active) { if (!tmdb_active)
{
tmdb->setTitle(epgData.title); tmdb->setTitle(epgData.title);
if ((tmdb->getResults() > 0) && (!tmdb->getDescription().empty())) { if ((tmdb->getResults() > 0) && (!tmdb->getDescription().empty()))
{
tmdb_active = true;
tmdb_stars = tmdb->getStars();
epgText_saved = epgText; epgText_saved = epgText;
epgText.clear(); epgText.clear();
tmdb_active = true;
epgTextSwitch = tmdb->getMovieText(); epgTextSwitch = tmdb->getMovieText();
processTextToArray(tmdb->getEPGText(), 0, tmdb->hasPoster()); processTextToArray(tmdb->getEPGText(), 0, tmdb->hasPoster());
textCount = epgText.size(); textCount = epgText.size();
tmdb_stars = tmdb->getStars();
showText(showPos, sy + toph, tmdb->hasPoster()); showText(showPos, sy + toph, tmdb->hasPoster());
} else { timeoutEnd = CRCInput::calcTimeoutEnd(timeout);
ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_EPGVIEWER_NODETAILED, CMsgBox::mbrOk , CMsgBox::mbrOk);
} }
} else { else
ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_EPGVIEWER_NODETAILED, CMsgBox::mbrOk , CMsgBox::mbrOk);
}
else
{
tmdb_active = false;
tmdb_stars = 0;
epgText = epgText_saved; epgText = epgText_saved;
textCount = epgText.size(); textCount = epgText.size();
tmdb_active = false;
tmdb_stars=0;
showText(showPos, sy + toph); showText(showPos, sy + toph);
} }
} }
@@ -1218,44 +1225,67 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start
} }
case CRCInput::RC_green: case CRCInput::RC_green:
{ {
if (tmdb_active) { if (tmdb_active)
{
tmdb_active = false; tmdb_active = false;
tmdb_stars = 0;
epgText = epgText_saved; epgText = epgText_saved;
textCount = epgText.size(); textCount = epgText.size();
tmdb_stars=0;
} }
if (!imdb_active) if (g_settings.omdb_enabled)
{ {
//show IMDb info showPos = 0;
imdb_active = true; if (!imdb_active)
imdb->setTitle(epgData.title);
showIMDb();
showTimerEventBar(true, !mp_info && isCurrentEPG(channel_id), mp_info); //show buttons
timeoutEnd = CRCInput::calcTimeoutEnd(timeout);
}
else if (imdb_active && imdb->hasPoster())
{
imdb_active = false;
CHintBox * hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, LOCALE_IMDB_INFO_SAVE);
hintBox->paint();
std::string picname;
if (mp_info)
{ {
size_t _pos; imdb->setTitle(epgData.title);
if ((_pos = movie_filename.rfind(".")) != std::string::npos) if (((imdb->getIMDbElement("Title").find(imdb->search_error)) == std::string::npos))
picname = movie_filename.substr(0, _pos) + ".jpg"; {
imdb_active = true;
imdb_stars = imdb->getStars();
epgText_saved = epgText;
epgText.clear();
epgTextSwitch = imdb->getMovieText();
processTextToArray(imdb->getEPGText(), 0, imdb->hasPoster());
textCount = epgText.size();
showText(0, sy + toph, imdb->hasPoster());
showTimerEventBar(true, !mp_info && isCurrentEPG(channel_id), mp_info); //show buttons
timeoutEnd = CRCInput::calcTimeoutEnd(timeout);
}
else
ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_EPGVIEWER_NODETAILED, CMsgBox::mbrOk , CMsgBox::mbrOk);
}
else if (imdb_active && imdb->hasPoster())
{
imdb_active = false;
CHintBox * hintBox = new CHintBox(LOCALE_MESSAGEBOX_INFO, LOCALE_IMDB_INFO_SAVE);
hintBox->paint();
std::string picname;
if (mp_info)
{
size_t _pos;
if ((_pos = movie_filename.rfind(".")) != std::string::npos)
picname = movie_filename.substr(0, _pos) + ".jpg";
}
else
picname = imdb->getFilename(channel, epgData.eventID);
CFileHelpers fh;
if (!fh.copyFile(imdb->posterfile.c_str(), picname.c_str(), 0644))
perror( "IMDb: error copy file" );
sleep(2);
hintBox->hide();
showTimerEventBar(true, !mp_info && isCurrentEPG(channel_id), mp_info); //show buttons
} }
else else
picname = imdb->getFilename(channel, epgData.eventID); {
imdb_active = false;
CFileHelpers fh; imdb_stars = 0;
if (!fh.copyFile(imdb->posterfile.c_str(), picname.c_str(), 0644)) epgText = epgText_saved;
perror( "IMDb: error copy file" ); textCount = epgText.size();
showText(showPos, sy + toph);
sleep(2); }
hintBox->hide();
showTimerEventBar(true, !mp_info && isCurrentEPG(channel_id), mp_info); //show buttons
} }
break; break;
} }
@@ -1667,32 +1697,6 @@ void CEpgData::showTimerEventBar (bool pshow, bool adzap, bool mp_info)
} }
} }
//imdb start
int CEpgData::showIMDb()
{
//title
std::string title = imdb->getIMDbElement("Title");
if(((title.find(imdb->search_error)) != std::string::npos))
return 1;
// clear epg array
epgText_saved = epgText;
epgText.clear();
//data
epgTextSwitch = imdb->getMovieText();
processTextToArray(imdb->getEPGText(), 0, imdb->hasPoster());
textCount = epgText.size();
//rating
imdb_stars = imdb->getStars();
showText(0, sy + toph, imdb->hasPoster());
return 0;
}
void CEpgData::ResetModules() void CEpgData::ResetModules()
{ {
if (header){ if (header){

View File

@@ -101,14 +101,11 @@ class CEpgData
void showProgressBar(); void showProgressBar();
bool isCurrentEPG(const t_channel_id channel_id); bool isCurrentEPG(const t_channel_id channel_id);
bool imdb_active; bool imdb_active;
int imdb_stars; int imdb_stars;
std::string imdb_rating; std::string imdb_rating;
std::string epg_title; std::string epg_title;
std::string movie_filename; std::string movie_filename;
int showIMDb();
Font *fontIMDb;
public: public: