diff options
author | jmarshallnz <jmarshallnz@svn> | 2010-06-20 01:03:55 +0000 |
---|---|---|
committer | jmarshallnz <jmarshallnz@svn> | 2010-06-20 01:03:55 +0000 |
commit | e569b94756a79e327dfc0e86c1d7b8a83c12bfcf (patch) | |
tree | d8640b3bf1840eccddc1047647341d607e2de760 | |
parent | d6cad342fe0938b0da997e54feacc7d8a8100579 (diff) |
fixed: Ensure that we only prompt the user about a scraper error if we actually got a scraper error. Should fix #9436
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@31221 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r-- | xbmc/VideoInfoScanner.cpp | 4 | ||||
-rw-r--r-- | xbmc/utils/IMDB.cpp | 13 | ||||
-rw-r--r-- | xbmc/utils/IMDB.h | 8 |
3 files changed, 17 insertions, 8 deletions
diff --git a/xbmc/VideoInfoScanner.cpp b/xbmc/VideoInfoScanner.cpp index f65b9aa12f..b2a3eb4b9a 100644 --- a/xbmc/VideoInfoScanner.cpp +++ b/xbmc/VideoInfoScanner.cpp @@ -1546,8 +1546,8 @@ namespace VIDEO IMDB_MOVIELIST movielist; CIMDB imdb(scraper); int returncode = imdb.FindMovie(videoName, movielist, progress); - if (returncode == -1 || (returncode == 0 && !DownloadFailed(progress))) - { + if (returncode < 0 || (returncode == 0 && !DownloadFailed(progress))) + { // scraper reported an error, or we had an error and user wants to cancel the scan m_bStop = true; return -1; // cancelled } diff --git a/xbmc/utils/IMDB.cpp b/xbmc/utils/IMDB.cpp index 5e88045f1c..c2dc6ac1e6 100644 --- a/xbmc/utils/IMDB.cpp +++ b/xbmc/utils/IMDB.cpp @@ -80,7 +80,7 @@ int CIMDB::InternalFindMovie(const CStdString &strMovie, else if (m_info->Content() == CONTENT_MUSICVIDEOS) { if (!m_info->GetParser().HasFunction("FileNameScrape")) - return false; + return 0; CScraperUrl scrURL("filenamescrape"); CUtil::RemoveExtension(strName); @@ -96,6 +96,7 @@ int CIMDB::InternalFindMovie(const CStdString &strMovie, vector<CStdString> xml = m_info->Run("GetSearchResults",scrURL,m_http,&extras); + bool haveValidResults = false; for (vector<CStdString>::iterator it = xml.begin(); it != xml.end(); ++it) { @@ -105,19 +106,21 @@ int CIMDB::InternalFindMovie(const CStdString &strMovie, if (!doc.RootElement()) { CLog::Log(LOGERROR, "%s: Unable to parse xml",__FUNCTION__); - return 0; + continue; // might have more valid results later } if (stricmp(doc.RootElement()->Value(),"error")==0) { ShowErrorDialog(doc.RootElement()); - return -1; + return -1; // scraper has reported an error } TiXmlHandle docHandle( &doc ); TiXmlElement *movie = docHandle.FirstChild("results").Element(); if (!movie) - return 0; + continue; + + haveValidResults = true; movie = docHandle.FirstChild( "results" ).FirstChild( "entity" ).Element(); while (movie) @@ -187,7 +190,7 @@ int CIMDB::InternalFindMovie(const CStdString &strMovie, movie = movie->NextSiblingElement(); } } - return movielist.empty()?0:1; + return haveValidResults ? 1 : 0; } bool CIMDB::RelevanceSortFunction(const CScraperUrl &left, const CScraperUrl &right) diff --git a/xbmc/utils/IMDB.h b/xbmc/utils/IMDB.h index 4daced270d..9716b22f6b 100644 --- a/xbmc/utils/IMDB.h +++ b/xbmc/utils/IMDB.h @@ -58,7 +58,13 @@ public: virtual ~CIMDB(); // threaded lookup functions - // returns -1 if we had an error + + /*! \brief Do a search for matching media items (possibly asynchronously) with our scraper + \param strMovie name of the media item to look for + \param movielist [out] list of results to fill. May be empty on success. + \param pProgress progress bar to update as we go. If NULL we run on thread, if non-NULL we run off thread. + \return 1 on success, -1 on a scraper-specific error, 0 on some other error + */ int FindMovie(const CStdString& strMovie, IMDB_MOVIELIST& movielist, CGUIDialogProgress *pProgress = NULL); bool GetDetails(const CScraperUrl& url, CVideoInfoTag &movieDetails, CGUIDialogProgress *pProgress = NULL); bool GetEpisodeDetails(const CScraperUrl& url, CVideoInfoTag &movieDetails, CGUIDialogProgress *pProgress = NULL); |