dont use tmdb if api key not defined

This commit is contained in:
Jacek Jendrzej
2016-07-29 17:00:29 +02:00
parent 51bf5c2195
commit 86cea031ad
2 changed files with 51 additions and 44 deletions

View File

@@ -680,7 +680,8 @@ int CEpgData::show_mp(MI_MOVIE_INFO *mp_movie_info, int /*mp_position*/, int /*m
int h = std::max(fh, icol_h+4); int h = std::max(fh, icol_h+4);
int aw = ox - 20 - 2 * (ICON_LARGE_WIDTH + 2); int aw = ox - 20 - 2 * (ICON_LARGE_WIDTH + 2);
frameBuffer->paintBoxRel(sx,sy+oy,ox,h, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_LARGE, CORNER_BOTTOM); frameBuffer->paintBoxRel(sx,sy+oy,ox,h, COL_INFOBAR_SHADOW_PLUS_1, RADIUS_LARGE, CORNER_BOTTOM);
::paintButtons(sx + 10, sy+oy, 0, 2, Button, aw, h, "", false, COL_INFOBAR_SHADOW_TEXT, NULL, 1); if (g_settings.tmdb_api_key != "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
::paintButtons(sx + 10, sy+oy, 0, 2, Button, aw, h, "", false, COL_INFOBAR_SHADOW_TEXT, NULL, 1);
#if 0 #if 0
int height = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->getHeight(); int height = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_DATE]->getHeight();
@@ -744,36 +745,40 @@ int CEpgData::show_mp(MI_MOVIE_INFO *mp_movie_info, int /*mp_position*/, int /*m
case CRCInput::RC_info: case CRCInput::RC_info:
{ {
showPos = 0; if (g_settings.tmdb_api_key != "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"){
if (!tmdbtoggle) { showPos = 0;
cTmdb* tmdb = new cTmdb(mp_movie_info->epgTitle); if (!tmdbtoggle) {
if ((tmdb->getResults() > 0) && (!tmdb->getDescription().empty())) { cTmdb* tmdb = new cTmdb(mp_movie_info->epgTitle);
epgText_saved = epgText; if ((tmdb->getResults() > 0) && (!tmdb->getDescription().empty())) {
epgText.clear(); epgText_saved = epgText;
tmdbtoggle = !tmdbtoggle; epgText.clear();
tmdb_str = tmdb->getDescription(); tmdbtoggle = !tmdbtoggle;
if (!tmdb->getCast().empty()) tmdb_str = tmdb->getDescription();
tmdb_str += "\n\n"+(std::string)g_Locale->getText(LOCALE_EPGEXTENDED_ACTORS)+":\n"+ tmdb->getCast()+"\n"; if (!tmdb->getCast().empty())
processTextToArray(tmdb->CreateEPGText(), 0, tmdb->hasCover()); tmdb_str += "\n\n"+(std::string)g_Locale->getText(LOCALE_EPGEXTENDED_ACTORS)+":\n"+ tmdb->getCast()+"\n";
textCount = epgText.size(); processTextToArray(tmdb->CreateEPGText(), 0, tmdb->hasCover());
stars = tmdb->getStars(); textCount = epgText.size();
showText(showPos, sy + toph, tmdbtoggle); stars = tmdb->getStars();
showText(showPos, sy + toph, tmdbtoggle);
} else {
ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_EPGVIEWER_NODETAILED, CMessageBox::mbrOk , CMessageBox::mbrOk);
}
delete tmdb;
} else { } else {
ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_EPGVIEWER_NODETAILED, CMessageBox::mbrOk , CMessageBox::mbrOk); epgText = epgText_saved;
textCount = epgText.size();
tmdbtoggle = !tmdbtoggle;
stars=0;
showText(showPos, sy + toph);
} }
delete tmdb;
} else {
epgText = epgText_saved;
textCount = epgText.size();
tmdbtoggle = !tmdbtoggle;
stars=0;
showText(showPos, sy + toph);
} }
break; break;
} }
case CRCInput::RC_red: case CRCInput::RC_red:
{ {
if (tmdbtoggle) { if (g_settings.tmdb_api_key != "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
break;
else if (tmdbtoggle) {
mp_movie_info->epgInfo2 = tmdb_str; mp_movie_info->epgInfo2 = tmdb_str;
} }
} }
@@ -1291,27 +1296,29 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start
break; break;
case CRCInput::RC_info: case CRCInput::RC_info:
{ {
showPos = 0; if (g_settings.tmdb_api_key != "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"){
if (!tmdbtoggle) { showPos = 0;
cTmdb* tmdb = new cTmdb(epgData.title); if (!tmdbtoggle) {
if ((tmdb->getResults() > 0) && (!tmdb->getDescription().empty())) { cTmdb* tmdb = new cTmdb(epgData.title);
epgText_saved = epgText; if ((tmdb->getResults() > 0) && (!tmdb->getDescription().empty())) {
epgText.clear(); epgText_saved = epgText;
tmdbtoggle = !tmdbtoggle; epgText.clear();
processTextToArray(tmdb->CreateEPGText(), 0, tmdb->hasCover()); tmdbtoggle = !tmdbtoggle;
textCount = epgText.size(); processTextToArray(tmdb->CreateEPGText(), 0, tmdb->hasCover());
stars = tmdb->getStars(); textCount = epgText.size();
showText(showPos, sy + toph, tmdbtoggle); stars = tmdb->getStars();
showText(showPos, sy + toph, tmdbtoggle);
} else {
ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_EPGVIEWER_NODETAILED, CMessageBox::mbrOk , CMessageBox::mbrOk);
}
delete tmdb;
} else { } else {
ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_EPGVIEWER_NODETAILED, CMessageBox::mbrOk , CMessageBox::mbrOk); epgText = epgText_saved;
textCount = epgText.size();
tmdbtoggle = !tmdbtoggle;
stars=0;
showText(showPos, sy + toph);
} }
delete tmdb;
} else {
epgText = epgText_saved;
textCount = epgText.size();
tmdbtoggle = !tmdbtoggle;
stars=0;
showText(showPos, sy + toph);
} }
break; break;
} }

View File

@@ -1856,7 +1856,7 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg)
unlink(fname.c_str()); unlink(fname.c_str());
refresh(); refresh();
} }
}else { }else if (g_settings.tmdb_api_key != "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"){
//add TMDB Cover //add TMDB Cover
fname = m_movieSelectionHandler->file.Name.c_str(); fname = m_movieSelectionHandler->file.Name.c_str();
int ext_pos = 0; int ext_pos = 0;