src/gui/moviebrowser.cpp use one key for delete cover or add tmdb cover

Origin commit data
------------------
Branch: ni/coolstream
Commit: 51bf5c2195
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2016-07-29 (Fri, 29 Jul 2016)


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

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2016-07-29 15:34:41 +02:00
parent 225dc86b48
commit 27ef7161f5

View File

@@ -1849,11 +1849,33 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg)
else if (msg == (neutrino_msg_t) g_settings.mbkey_cover)
{
if (m_movieSelectionHandler != NULL) {
if (ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_MOVIEBROWSER_DELETE_SCREENSHOT, CMessageBox::mbrNo, CMessageBox:: mbYes | CMessageBox::mbNo) == CMessageBox::mbrYes) {
std::string fname = getScreenshotName(m_movieSelectionHandler->file.Name, S_ISDIR(m_movieSelectionHandler->file.Mode));
if (!fname.empty())
unlink(fname.c_str());
refresh();
std::string fname = getScreenshotName(m_movieSelectionHandler->file.Name, S_ISDIR(m_movieSelectionHandler->file.Mode));
if (!fname.empty()){
//delete Cover
if (ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_MOVIEBROWSER_DELETE_SCREENSHOT, CMessageBox::mbrNo, CMessageBox:: mbYes | CMessageBox::mbNo) == CMessageBox::mbrYes) {
unlink(fname.c_str());
refresh();
}
}else {
//add TMDB Cover
fname = m_movieSelectionHandler->file.Name.c_str();
int ext_pos = 0;
ext_pos = fname.rfind('.');
if( ext_pos > 0) {
std::string extension;
extension = fname.substr(ext_pos + 1, fname.length() - ext_pos);
extension = "." + extension;
strReplace(fname, extension.c_str(), ".jpg");
printf("TMDB: %s : %s\n",m_movieSelectionHandler->file.Name.c_str(),fname.c_str());
cTmdb* tmdb = new cTmdb(m_movieSelectionHandler->epgTitle);
if ((tmdb->getResults() > 0) && (tmdb->hasCover())) {
if (!fname.empty())
if (tmdb->getSmallCover(fname))
refresh();
}
if (tmdb)
delete tmdb;
}
}
}
}
@@ -2006,46 +2028,6 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg)
smsInput.resetOldKey();
}
}
else if (msg == CRCInput::RC_favorites)
{
if (m_movieSelectionHandler != NULL) {
#if 0
if (ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_MOVIEBROWSER_DELETE_SCREENSHOT, CMessageBox::mbrNo, CMessageBox:: mbYes | CMessageBox::mbNo) == CMessageBox::mbrYes) {
std::string fname = getScreenshotName(m_movieSelectionHandler->file.Name, S_ISDIR(m_movieSelectionHandler->file.Mode));
if (!fname.empty())
unlink(fname.c_str());
refresh();
}
#else
std::string fname = m_movieSelectionHandler->file.Name.c_str();
int ext_pos = 0;
ext_pos = fname.rfind('.');
if( ext_pos > 0) {
std::string extension;
extension = fname.substr(ext_pos + 1, fname.length() - ext_pos);
extension = "." + extension;
strReplace(fname, extension.c_str(), ".jpg");
}
printf("TMDB: %s : %s\n",m_movieSelectionHandler->file.Name.c_str(),fname.c_str());
if (!access(fname, F_OK)) {
if (ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_MOVIEBROWSER_DELETE_SCREENSHOT, CMessageBox::mbrNo, CMessageBox:: mbYes | CMessageBox::mbNo) == CMessageBox::mbrYes) {
if (!fname.empty())
unlink(fname.c_str());
refresh();
}
} else {
cTmdb* tmdb = new cTmdb(m_movieSelectionHandler->epgTitle);
if ((tmdb->getResults() > 0) && (tmdb->hasCover())) {
if (!fname.empty())
if (tmdb->getSmallCover(fname))
refresh();
}
if (tmdb)
delete tmdb;
}
#endif
}
}
else
{
//TRACE("[mb]->onButtonPressMainFrame none\n");