4 * Copyright (C) 2005-2013 Team XBMC
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with XBMC; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
23 #include "threads/Thread.h"
24 #include "VideoInfoTag.h"
25 #include "addons/Scraper.h"
27 #include "XBDateTime.h"
28 #include "filesystem/CurlFile.h"
30 // forward declarations
32 class CGUIDialogProgress;
39 typedef std::vector<CScraperUrl> MOVIELIST;
41 class CVideoInfoDownloader : public CThread
44 CVideoInfoDownloader(const ADDON::ScraperPtr &scraper);
45 virtual ~CVideoInfoDownloader();
47 // threaded lookup functions
49 /*! \brief Do a search for matching media items (possibly asynchronously) with our scraper
50 \param strMovie name of the media item to look for
51 \param movielist [out] list of results to fill. May be empty on success.
52 \param pProgress progress bar to update as we go. If NULL we run on thread, if non-NULL we run off thread.
53 \return 1 on success, -1 on a scraper-specific error, 0 on some other error
55 int FindMovie(const CStdString& strMovie, MOVIELIST& movielist, CGUIDialogProgress *pProgress = NULL);
56 bool GetDetails(const CScraperUrl& url, CVideoInfoTag &movieDetails, CGUIDialogProgress *pProgress = NULL);
57 bool GetEpisodeDetails(const CScraperUrl& url, CVideoInfoTag &movieDetails, CGUIDialogProgress *pProgress = NULL);
58 bool GetEpisodeList(const CScraperUrl& url, VIDEO::EPISODELIST& details, CGUIDialogProgress *pProgress = NULL);
60 static void ShowErrorDialog(const ADDON::CScraperError &sce);
63 enum LOOKUP_STATE { DO_NOTHING = 0,
67 GET_EPISODE_DETAILS = 4 };
69 XFILE::CCurlFile* m_http;
70 CStdString m_strMovie;
71 MOVIELIST m_movieList;
72 CVideoInfoTag m_movieDetails;
74 VIDEO::EPISODELIST m_episode;
77 ADDON::ScraperPtr m_info;
83 int InternalFindMovie(const CStdString& strMovie, MOVIELIST& movielist, bool cleanChars = true);