[cosmetics] update date in GPL header
[vuplus_xbmc] / xbmc / utils / ScraperUrl.h
1 #ifndef SCRAPER_URL_H
2 #define SCRAPER_URL_H
3
4 /*
5  *      Copyright (C) 2005-2013 Team XBMC
6  *      http://www.xbmc.org
7  *
8  *  This Program is free software; you can redistribute it and/or modify
9  *  it under the terms of the GNU General Public License as published by
10  *  the Free Software Foundation; either version 2, or (at your option)
11  *  any later version.
12  *
13  *  This Program is distributed in the hope that it will be useful,
14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  *  GNU General Public License for more details.
17  *
18  *  You should have received a copy of the GNU General Public License
19  *  along with XBMC; see the file COPYING.  If not, see
20  *  <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #include <vector>
25 #include <map>
26 #include "StdString.h"
27
28 class TiXmlElement;
29 namespace XFILE { class CCurlFile; }
30
31 class CScraperUrl
32 {
33 public:
34   CScraperUrl(const CStdString&);
35   CScraperUrl(const TiXmlElement*);
36   CScraperUrl();
37   ~CScraperUrl();
38
39   enum URLTYPES
40   {
41     URL_TYPE_GENERAL = 1,
42     URL_TYPE_SEASON = 2
43   };
44
45   struct SUrlEntry
46   {
47     CStdString m_spoof;
48     CStdString m_url;
49     CStdString m_cache;
50     std::string m_aspect;
51     URLTYPES m_type;
52     bool m_post;
53     bool m_isgz;
54     int m_season;
55   };
56
57   bool Parse();
58   bool ParseString(CStdString); // copies by intention
59   bool ParseElement(const TiXmlElement*);
60   bool ParseEpisodeGuide(CStdString strUrls); // copies by intention
61
62   const SUrlEntry GetFirstThumb(const std::string &type = "") const;
63   const SUrlEntry GetSeasonThumb(int season, const std::string &type = "") const;
64   unsigned int GetMaxSeasonThumb() const;
65
66   /*! \brief fetch the full URL (including referrer) of a thumb
67    \param URL entry to use to create the full URL
68    \return the full URL, including referrer
69    */
70   static CStdString GetThumbURL(const CScraperUrl::SUrlEntry &entry);
71
72   /*! \brief fetch the full URL (including referrer) of thumbs
73    \param thumbs [out] vector of thumb URLs to fill
74    \param type the type of thumb URLs to fetch, if empty (the default) picks any
75    \param season number of season that we want thumbs for, -1 indicates no season (the default)
76    */
77   void GetThumbURLs(std::vector<CStdString> &thumbs, const std::string &type = "", int season = -1) const;
78   void Clear();
79   static bool Get(const SUrlEntry&, std::string&, XFILE::CCurlFile& http,
80                  const CStdString& cacheContext);
81
82   CStdString m_xml;
83   CStdString m_spoof; // for backwards compatibility only!
84   CStdString strTitle;
85   CStdString strId;
86   double relevance;
87   std::vector<SUrlEntry> m_url;
88 };
89
90 #endif
91
92