yt download fixes

Conflicts:
	src/gui/moviebrowser.cpp


Origin commit data
------------------
Branch: ni/coolstream
Commit: f6ae1796f2
Author: martii <m4rtii@gmx.de>
Date: 2013-06-13 (Thu, 13 Jun 2013)



------------------
This commit was generated by Migit
This commit is contained in:
martii
2013-06-13 21:51:59 +02:00
committed by [CST] Focus
parent 9c87251620
commit 3aca178cb0
2 changed files with 6 additions and 10 deletions

View File

@@ -3774,15 +3774,15 @@ int CYTCacheSelectorTarget::exec(CMenuTarget* /*parent*/, const std::string & ac
} else if (actionKey == "rc_spkr" && selected >= movieBrowser->yt_completed_offset && selected < movieBrowser->yt_failed_offset) {
cYTCache::getInstance()->remove(&movieBrowser->yt_completed[selected - movieBrowser->yt_completed_offset]);
} else if (actionKey == "") {
if (selected >= movieBrowser->yt_pending_offset && selected < movieBrowser->yt_completed_offset) {
if (movieBrowser->yt_pending_offset && selected >= movieBrowser->yt_pending_offset && selected < movieBrowser->yt_completed_offset) {
if(ShowMsg (LOCALE_MOVIEBROWSER_YT_CACHE, g_Locale->getText(LOCALE_MOVIEBROWSER_YT_CANCEL_TRANSFER), CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo) == CMessageBox::mbrYes)
cYTCache::getInstance()->cancel(&movieBrowser->yt_pending[selected - movieBrowser->yt_pending_offset]);
else
return menu_return::RETURN_NONE;
} else if (selected >= movieBrowser->yt_completed_offset && selected < movieBrowser->yt_failed_offset) {
} else if (movieBrowser->yt_completed_offset && selected >= movieBrowser->yt_completed_offset && selected < movieBrowser->yt_failed_offset) {
// FIXME -- anything sensible to do here?
return menu_return::RETURN_NONE;
} else if (selected >= movieBrowser->yt_failed_offset && selected < movieBrowser->yt_menue->getItemsCount()){
} else if (movieBrowser->yt_failed_offset && selected >= movieBrowser->yt_failed_offset && selected < movieBrowser->yt_menue->getItemsCount()){
cYTCache::getInstance()->clearFailed(&movieBrowser->yt_failed[selected - movieBrowser->yt_failed_offset]);
cYTCache::getInstance()->addToCache(&movieBrowser->yt_failed[selected - movieBrowser->yt_failed_offset]);
const char *format = g_Locale->getText(LOCALE_MOVIEBROWSER_YT_CACHE_ADD);
@@ -3804,11 +3804,10 @@ void CMovieBrowser::refreshYTMenu()
{
for (u_int item_id = (u_int) yt_menue->getItemsCount() - 1; item_id > yt_menue_end - 1; item_id--) {
CMenuItem* m = yt_menue->getItem(item_id);
if (m && !m->isStatic) {
if (m && !m->isStatic)
delete m;
yt_menue->removeItem(item_id);
}
}
yt_pending = cYTCache::getInstance()->getPending();
yt_completed = cYTCache::getInstance()->getCompleted();
yt_failed = cYTCache::getInstance()->getFailed();

View File

@@ -67,14 +67,11 @@ std::string cYTCache::getName(MI_MOVIE_INFO *mi, std::string ext)
bool cYTCache::useCachedCopy(MI_MOVIE_INFO *mi)
{
std::string file = getName(mi);
fprintf(stderr, "checking %s\n", file.c_str());
if (access(file.c_str(), R_OK))
return false;
std::string xml = getName(mi, "xml");
fprintf(stderr, "checking %s\n", xml.c_str());
if (!access(xml.c_str(), R_OK)) {
mi->file.Url = file;
fprintf(stderr, "using cached copy: %s\n", file.c_str());
return true;
}
{
@@ -104,7 +101,7 @@ bool cYTCache::download(MI_MOVIE_INFO *mi)
std::string file = getName(mi);
std::string xml = getName(mi, "xml");
if (!access(file.c_str(), R_OK) && !access(xml.c_str(), R_OK)) {
fprintf(stderr, "%s: %s already present an valid\n", __func__, file.c_str());
fprintf(stderr, "%s: %s already present and valid\n", __func__, file.c_str());
return true;
}