mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-03 10:51:05 +02:00
src/gui/moviebrowser.cpp use one key for delete cover or add tmdb cover
Origin commit data
------------------
Commit: 51bf5c2195
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2016-07-29 (Fri, 29 Jul 2016)
This commit is contained in:
@@ -1849,11 +1849,33 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg)
|
|||||||
else if (msg == (neutrino_msg_t) g_settings.mbkey_cover)
|
else if (msg == (neutrino_msg_t) g_settings.mbkey_cover)
|
||||||
{
|
{
|
||||||
if (m_movieSelectionHandler != NULL) {
|
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));
|
||||||
std::string fname = getScreenshotName(m_movieSelectionHandler->file.Name, S_ISDIR(m_movieSelectionHandler->file.Mode));
|
if (!fname.empty()){
|
||||||
if (!fname.empty())
|
//delete Cover
|
||||||
unlink(fname.c_str());
|
if (ShowMsg(LOCALE_MESSAGEBOX_INFO, LOCALE_MOVIEBROWSER_DELETE_SCREENSHOT, CMessageBox::mbrNo, CMessageBox:: mbYes | CMessageBox::mbNo) == CMessageBox::mbrYes) {
|
||||||
refresh();
|
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();
|
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
|
else
|
||||||
{
|
{
|
||||||
//TRACE("[mb]->onButtonPressMainFrame none\n");
|
//TRACE("[mb]->onButtonPressMainFrame none\n");
|
||||||
|
Reference in New Issue
Block a user