diff options
author | spiff_ <spiff_@svn> | 2010-01-25 20:28:45 +0000 |
---|---|---|
committer | spiff_ <spiff_@svn> | 2010-01-25 20:28:45 +0000 |
commit | 3080d7acf6272453162bf525d28e8073a2ed0852 (patch) | |
tree | d108abe529b079f514454386f02b37e4bbd5a6e5 | |
parent | 1a5a2c2146b9d496a814dfbe3f13fefdf6432e1d (diff) |
added: error handling if scraper backends are down
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@27170 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r-- | language/English/strings.xml | 3 | ||||
-rw-r--r-- | xbmc/GUIDialogContentSettings.cpp | 4 | ||||
-rw-r--r-- | xbmc/GUIWindowVideoBase.cpp | 2 | ||||
-rw-r--r-- | xbmc/ScraperSettings.cpp | 3 | ||||
-rw-r--r-- | xbmc/VideoInfoScanner.cpp | 28 | ||||
-rw-r--r-- | xbmc/VideoInfoScanner.h | 1 | ||||
-rw-r--r-- | xbmc/utils/IMDB.cpp | 3 |
7 files changed, 34 insertions, 10 deletions
diff --git a/language/English/strings.xml b/language/English/strings.xml index a4dade953b..ac8edcd20a 100644 --- a/language/English/strings.xml +++ b/language/English/strings.xml @@ -1851,6 +1851,9 @@ <string id="20445">Fanart</string> <string id="20446">Locally stored information found.</string> <string id="20447">Ignore and refresh from internet?</string> + <string id="20448">Could not download information</string> + <string id="20449">Server is most likely unavailable.</string> + <string id="20450">Would you like to continue scanning?</string> <!-- up to 21329 is reserved for the video db !! !--> <string id="21330">Show hidden files and directories</string> diff --git a/xbmc/GUIDialogContentSettings.cpp b/xbmc/GUIDialogContentSettings.cpp index 4ccdaabdb4..45a97770cc 100644 --- a/xbmc/GUIDialogContentSettings.cpp +++ b/xbmc/GUIDialogContentSettings.cpp @@ -538,8 +538,8 @@ bool CGUIDialogContentSettings::Show(SScraperInfo& scraper, VIDEO::SScanSettings CStdString baseDir = GetScraperDirectory(scraper); if (!baseDir.IsEmpty() && (!scraper.settings.GetPluginRoot() || scraper.settings.GetSettings().IsEmpty())) { // load default scraper settings - scraper.settings.LoadSettingsXML(baseDir + scraper.strPath); - scraper.settings.SaveFromDefault(); + if (scraper.settings.LoadSettingsXML(baseDir + scraper.strPath)) + scraper.settings.SaveFromDefault(); } return true; diff --git a/xbmc/GUIWindowVideoBase.cpp b/xbmc/GUIWindowVideoBase.cpp index b8fe9e6ce6..c144ed2c00 100644 --- a/xbmc/GUIWindowVideoBase.cpp +++ b/xbmc/GUIWindowVideoBase.cpp @@ -602,7 +602,7 @@ bool CGUIWindowVideoBase::ShowIMDB(CFileItem *item, const SScraperInfo& info2) } } } - if (returncode == -1) + else if (returncode == -1 || !CVideoInfoScanner::DownloadFailed(pDlgProgress)) { pDlgProgress->Close(); return false; diff --git a/xbmc/ScraperSettings.cpp b/xbmc/ScraperSettings.cpp index 7a47ab916e..630b5406d1 100644 --- a/xbmc/ScraperSettings.cpp +++ b/xbmc/ScraperSettings.cpp @@ -133,7 +133,8 @@ bool CScraperSettings::LoadSettingsXML(const CStdString& strScraper, const CStdS if (szFunction) { CScraperUrl scrURL(xurl); - LoadSettingsXML(strScraper,szFunction,&scrURL); + if (!LoadSettingsXML(strScraper,szFunction,&scrURL)) + return false; } xurl = xurl->NextSiblingElement("url"); } diff --git a/xbmc/VideoInfoScanner.cpp b/xbmc/VideoInfoScanner.cpp index 4cc5eee486..b2674a1974 100644 --- a/xbmc/VideoInfoScanner.cpp +++ b/xbmc/VideoInfoScanner.cpp @@ -32,6 +32,8 @@ #include "utils/GUIInfoManager.h" #include "FileSystem/File.h" #include "GUIDialogProgress.h" +#include "GUIDialogYesNo.h" +#include "GUIDialogOK.h" #include "AdvancedSettings.h" #include "GUISettings.h" #include "Settings.h" @@ -307,8 +309,8 @@ namespace VIDEO strPath = "special://xbmc/system/scrapers/video/" + m_info.strPath; if (!strPath.IsEmpty() && parser.Load(strPath) && parser.HasFunction("GetSettings")) { - m_info.settings.LoadSettingsXML("special://xbmc/system/scrapers/video/" + m_info.strPath); - m_info.settings.SaveFromDefault(); + if (m_info.settings.LoadSettingsXML("special://xbmc/system/scrapers/video/" + m_info.strPath)) + m_info.settings.SaveFromDefault(); } } @@ -419,8 +421,12 @@ namespace VIDEO CScraperParser parser; if (parser.Load("special://xbmc/system/scrapers/video/"+info2.strPath) && parser.HasFunction("GetSettings")) { - info2.settings.LoadSettingsXML("special://xbmc/system/scrapers/video/" + info2.strPath); - info2.settings.SaveFromDefault(); + if (info2.settings.LoadSettingsXML("special://xbmc/system/scrapers/video/" + info2.strPath)) + info2.settings.SaveFromDefault(); + else if (!DownloadFailed(pDlgProgress)) + return false; + else + continue; } } @@ -631,11 +637,13 @@ namespace VIDEO Return = true; } } - else if (returncode == -1) + else if (returncode == -1 || !DownloadFailed(pDlgProgress)) { m_bStop = true; return false; } + else + continue; } } pURL = NULL; @@ -1477,4 +1485,14 @@ namespace VIDEO return result; } + + bool CVideoInfoScanner::DownloadFailed(CGUIDialogProgress* pDialog) + { + if (pDialog) + { + CGUIDialogOK::ShowAndGetInput(20448,20449,20022,20022); + return false; + } + return CGUIDialogYesNo::ShowAndGetInput(20448,20449,20450,20022); + } } diff --git a/xbmc/VideoInfoScanner.h b/xbmc/VideoInfoScanner.h index a6582b7eec..d8205907e2 100644 --- a/xbmc/VideoInfoScanner.h +++ b/xbmc/VideoInfoScanner.h @@ -83,6 +83,7 @@ namespace VIDEO bool RetrieveVideoInfo(CFileItemList& items, bool bDirNames, const SScraperInfo& info, bool bRefresh=false, CScraperUrl *pURL=NULL, CGUIDialogProgress* pDlgProgress = NULL, bool ignoreNfo=false); static void ApplyIMDBThumbToFolder(const CStdString &folder, const CStdString &imdbThumb); static int GetPathHash(const CFileItemList &items, CStdString &hash); + static bool DownloadFailed(CGUIDialogProgress* pDlgProgress); CNfoFile::NFOResult CheckForNFOFile(CFileItem* pItem, bool bGrabAny, SScraperInfo& info, CScraperUrl& scrUrl); CIMDB m_IMDB; protected: diff --git a/xbmc/utils/IMDB.cpp b/xbmc/utils/IMDB.cpp index a3076cab09..b980dbd33a 100644 --- a/xbmc/utils/IMDB.cpp +++ b/xbmc/utils/IMDB.cpp @@ -147,10 +147,11 @@ int CIMDB::InternalFindMovie(const CStdString &strMovie, IMDB_MOVIELIST& movieli xurl = xurl->NextSiblingElement("url"); } - TiXmlElement *movie = docHandle.FirstChild( "results" ).FirstChild( "entity" ).Element(); + TiXmlElement *movie = docHandle.FirstChild("results").Element(); if (!movie) return 0; + movie = docHandle.FirstChild( "results" ).FirstChild( "entity" ).Element(); while (movie) { // is our result already sorted correctly when handed over from scraper? if so, do not let xbmc sort it |