- epgview: more imdb/tmdb unifications

Conflicts:
	src/gui/epgview.cpp

Signed-off-by: Thilo Graf <dbt@novatux.de>

TODO: fix star values, no count of stars at epg window to see,
variable 'stars' is missing.
This commit is contained in:
svenhoefer
2021-05-03 01:00:35 +02:00
committed by Thilo Graf
parent 976bb352e7
commit 367840ccd7
2 changed files with 76 additions and 75 deletions

View File

@@ -293,9 +293,10 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear)
medlineheight = font->getHeight(); medlineheight = font->getHeight();
// show ranking // show ranking
if ((stars > 0 || imdb_stars > 0) && (tmdb_active || imdb_active) && startPos == 0) if (startPos == 0 && (imdb_active || tmdb_active))
{ {
std::string provider_logo = ""; std::string provider_logo = "";
int stars = 0;
if (tmdb_active && startPos == 0) if (tmdb_active && startPos == 0)
provider_logo = NEUTRINO_ICON_TMDB; provider_logo = NEUTRINO_ICON_TMDB;
@@ -705,7 +706,6 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start
imdb_active = false; imdb_active = false;
imdb_stars = 0; imdb_stars = 0;
tmdb_active = false; tmdb_active = false;
stars = 0;
t_channel_id epg_id = channel_id; t_channel_id epg_id = channel_id;
CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id); CZapitChannel * channel = CServiceManager::getInstance()->FindChannel(channel_id);
@@ -1154,8 +1154,10 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start
break; break;
case CRCInput::RC_0: //imdb case CRCInput::RC_0: //imdb
{ {
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();
@@ -1163,25 +1165,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();
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;
stars=0;
showText(showPos, sy + toph); showText(showPos, sy + toph);
} }
} }
@@ -1189,44 +1196,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();
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;
} }
@@ -1638,32 +1668,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

@@ -35,8 +35,8 @@
#include <system/settings.h> #include <system/settings.h>
#include <gui/mdb-imdb.h> #include "mdb-imdb.h"
#include <gui/mdb-tmdb.h> #include "mdb-tmdb.h"
#include <driver/movieinfo.h> #include <driver/movieinfo.h>
#include "widget/menue.h" #include "widget/menue.h"
#include "widget/navibar.h" #include "widget/navibar.h"
@@ -68,7 +68,7 @@ class CEpgData
bool has_follow_screenings; bool has_follow_screenings;
bool call_fromfollowlist; bool call_fromfollowlist;
bool tmdb_active; bool tmdb_active;
int stars;
time_t tmp_curent_zeit; time_t tmp_curent_zeit;
uint64_t prev_id; uint64_t prev_id;
@@ -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 tmdb_stars, 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: