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

@@ -1083,7 +1083,6 @@ imdb.data_votes Stimmen
imdb.data_website Webseite
imdb.data_writer Drehbuchautor
imdb.info IMDb-Info
imdb.info_save Bild speichern
imdb.read_data Suche IMDb-Daten ...
inetradio.name Internetradio
inetradio_autostart Internetradio Auto-Start
@@ -1287,6 +1286,8 @@ mbkey.copy_several Film kopieren und teilen
mbkey.cover Filmcover erzeugen/löschen
mbkey.cut Film schneiden
mbkey.truncate Film kürzen
mdb.save_poster Bild speichern
mdb.save_poster_hint Bild speichern mit %s
menu.back Zurück
menu.cancel Abbrechen
menu.hint_a_pic Konfigurieren Sie den Audioplayer und den Bildbetrachter

View File

@@ -1083,7 +1083,6 @@ imdb.data_votes Votes
imdb.data_website Website
imdb.data_writer Screenplay author
imdb.info IMDb-Info
imdb.info_save save Cover
imdb.read_data Search IMDb data ...
inetradio.name Internetradio
inetradio_autostart Internetradio auto-start
@@ -1287,6 +1286,8 @@ mbkey.copy_several Copy and split movie
mbkey.cover Create/remove movie cover
mbkey.cut Cut movie
mbkey.truncate Truncate movie
mdb.save_poster Save poster
mdb.save_poster_hint Save poster with %s
menu.back Back
menu.cancel Cancel
menu.hint_a_pic Configure audio player and picture viewer

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

View File

@@ -42,6 +42,8 @@ class CIMDB
std::string parseFile(std::string search1, std::string search2, const char *file, std::string firstline = "", int line_offset = 0);
std::map<std::string, std::string> m;
std::string posterfile;
void initMap(std::map<std::string, std::string> &my);
public:
@@ -56,7 +58,6 @@ class CIMDB
std::string search_outfile;
std::string search_error;
std::string imdb_outfile;
std::string posterfile;
int getMovieDetails(const std::string &epgTitle);
void cleanup();

View File

@@ -877,7 +877,7 @@ int CMovieBrowser::exec(CMenuTarget* parent, const std::string & actionKey)
poster = m_movieSelectionHandler->file.Name.substr(0, pos);
poster += ".jpg";
CFileHelpers fh;
if (fh.copyFile(imdb->posterfile.c_str(), poster.c_str(), 0644))
if (fh.copyFile(imdb->getPoster().c_str(), poster.c_str(), 0644))
printf("* poster: %s\n", poster.c_str());
else
printf("* poster: copy error\n");

View File

@@ -1110,7 +1110,6 @@ typedef enum
LOCALE_IMDB_DATA_WEBSITE,
LOCALE_IMDB_DATA_WRITER,
LOCALE_IMDB_INFO,
LOCALE_IMDB_INFO_SAVE,
LOCALE_IMDB_READ_DATA,
LOCALE_INETRADIO_NAME,
LOCALE_INETRADIO_AUTOSTART,
@@ -1314,6 +1313,8 @@ typedef enum
LOCALE_MBKEY_COVER,
LOCALE_MBKEY_CUT,
LOCALE_MBKEY_TRUNCATE,
LOCALE_MDB_SAVE_POSTER,
LOCALE_MDB_SAVE_POSTER_HINT,
LOCALE_MENU_BACK,
LOCALE_MENU_CANCEL,
LOCALE_MENU_HINT_A_PIC,

View File

@@ -1110,7 +1110,6 @@ const char * locale_real_names[] =
"imdb.data_website",
"imdb.data_writer",
"imdb.info",
"imdb.info_save",
"imdb.read_data",
"inetradio.name",
"inetradio_autostart",
@@ -1314,6 +1313,8 @@ const char * locale_real_names[] =
"mbkey.cover",
"mbkey.cut",
"mbkey.truncate",
"mdb.save_poster",
"mdb.save_poster_hint",
"menu.back",
"menu.cancel",
"menu.hint_a_pic",