epgview: allow to save imdb/tmdb poster with g_settings.mbkey_cover

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

Origin message was:
------------------
- epgview: allow to save imdb/tmdb poster with g_settings.mbkey_cover

------------------
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 23:16:52 +02:00
parent 17e81f8afb
commit 515a2cfa39
7 changed files with 52 additions and 45 deletions

View File

@@ -288,6 +288,14 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear)
cover_offset = 0;
frameBuffer->paintBoxRel(sx, y, ox-SCROLLBAR_WIDTH, sb, COL_MENUCONTENT_PLUS_0); // background of the text box
}
/* FIXME
else
{
char hint[1024];
snprintf(hint, sizeof(hint), g_Locale->getText(LOCALE_MDB_SAVE_POSTER_HINT), g_RCInput->getKeyName((neutrino_msg_t) g_settings.mbkey_cover));
font->RenderString(sx+OFFSET_INNER_MID, y+OFFSET_INNER_MID+cover_height+OFFSET_INNER_MID+font->getHeight(), cover_width, hint, COL_MENUCONTENT_TEXT);
}
*/
}
// recalculate
@@ -1207,30 +1215,6 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start
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 = CMDBTools::getInstance()->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
{
imdb_active = false;
@@ -1399,6 +1383,38 @@ int CEpgData::show(const t_channel_id channel_id, uint64_t a_id, time_t* a_start
} else
loop = false;
}
else if (msg == (neutrino_msg_t) g_settings.mbkey_cover)
{
std::string poster("");
if (imdb_active && imdb->hasPoster())
poster = imdb->getPoster();
else if (tmdb_active && tmdb->hasPoster())
poster = tmdb->getPoster();
if (!poster.empty())
{
CHintBox hintBox(LOCALE_MESSAGEBOX_INFO, LOCALE_MDB_SAVE_POSTER);
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 = CMDBTools::getInstance()->getFilename(channel, epgData.eventID);
CFileHelpers fh;
if (!fh.copyFile(poster.c_str(), picname.c_str(), 0644))
perror( "IMDb: error copy file" );
sleep(2);
hintBox.hide();
}
}
else if (CNeutrinoApp::getInstance()->listModeKey(msg)) {
if (!call_fromfollowlist) {
g_RCInput->postMsg (msg, 0);
@@ -1655,21 +1671,9 @@ void CEpgData::showTimerEventBar (bool pshow, bool adzap, bool mp_info)
adzap_button += g_Locale->getText(LOCALE_UNIT_SHORT_MINUTE);
}
// check imdb button
if (g_settings.omdb_enabled)
{
if (imdb_active)
{
EpgButtons[UsedButtons][1].button = (imdb->hasPoster()) ? NEUTRINO_ICON_BUTTON_GREEN : NEUTRINO_ICON_BUTTON_DUMMY_SMALL;
EpgButtons[UsedButtons][1].locale = LOCALE_IMDB_INFO_SAVE;
}
else
{
EpgButtons[UsedButtons][1].button = NEUTRINO_ICON_BUTTON_GREEN;
EpgButtons[UsedButtons][1].locale = LOCALE_IMDB_INFO;
}
}
EpgButtons[UsedButtons][1].button = NEUTRINO_ICON_BUTTON_GREEN;
else
EpgButtons[UsedButtons][1].button = NEUTRINO_ICON_BUTTON_DUMMY_SMALL;
@@ -1680,9 +1684,7 @@ void CEpgData::showTimerEventBar (bool pshow, bool adzap, bool mp_info)
EpgButtons[UsedButtons][2].button = NEUTRINO_ICON_BUTTON_DUMMY_SMALL;
if (mp_info)
{
::paintButtons(x, y, w, MaxButtons, EpgButtons[MP_BUTTONS], w, h);
}
else
{
// check followscreenings button