2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
32 explicit SUrlEntry(std::string url
= "")
33 : m_url(std::move(url
)), m_type(UrlType::General
), m_post(false), m_isgz(false), m_season(-1)
41 std::string m_preview
;
49 explicit CScraperUrl(const std::string
& strUrl
);
50 explicit CScraperUrl(const TiXmlElement
* element
);
55 bool HasData() const { return !m_data
.empty(); }
56 const std::string
& GetData() const { return m_data
; }
57 void SetData(std::string data
);
59 const std::string
& GetTitle() const { return m_title
; }
60 void SetTitle(std::string title
) { m_title
= std::move(title
); }
62 const std::string
& GetId() const { return m_id
; }
63 void SetId(std::string id
) { m_id
= std::move(id
); }
65 double GetRelevance() const { return m_relevance
; }
66 void SetRelevance(double relevance
) { m_relevance
= relevance
; }
68 bool HasUrls() const { return !m_urls
.empty(); }
69 const std::vector
<SUrlEntry
>& GetUrls() const { return m_urls
; }
70 void SetUrls(std::vector
<SUrlEntry
> urls
) { m_urls
= std::move(urls
); }
71 void AppendUrl(SUrlEntry url
) { m_urls
.push_back(std::move(url
)); }
73 const SUrlEntry
GetFirstUrlByType(const std::string
& type
= "") const;
74 const SUrlEntry
GetSeasonUrl(int season
, const std::string
& type
= "") const;
75 unsigned int GetMaxSeasonUrl() const;
77 std::string
GetFirstThumbUrl() const;
79 /*! \brief fetch the full URLs (including referrer) of thumbs
80 \param thumbs [out] vector of thumb URLs to fill
81 \param type the type of thumb URLs to fetch, if empty (the default) picks any
82 \param season number of season that we want thumbs for, -1 indicates no season (the default)
83 \param unique avoid adding duplicate URLs when adding to a thumbs vector with existing items
85 void GetThumbUrls(std::vector
<std::string
>& thumbs
,
86 const std::string
& type
= "",
88 bool unique
= false) const;
91 bool ParseFromData(const std::string
& data
); // copies by intention
92 bool ParseAndAppendUrl(const TiXmlElement
* element
);
93 bool ParseAndAppendUrlsFromEpisodeGuide(const std::string
& episodeGuide
); // copies by intention
94 void AddParsedUrl(const std::string
& url
,
95 const std::string
& aspect
= "",
96 const std::string
& preview
= "",
97 const std::string
& referrer
= "",
98 const std::string
& cache
= "",
103 /*! \brief fetch the full URL (including referrer) of a thumb
104 \param URL entry to use to create the full URL
105 \return the full URL, including referrer
107 static std::string
GetThumbUrl(const CScraperUrl::SUrlEntry
& entry
);
109 static bool Get(const SUrlEntry
& scrURL
,
110 std::string
& strHTML
,
111 XFILE::CCurlFile
& http
,
112 const std::string
& cacheContext
);
114 // ATTENTION: this member MUST NOT be used directly except from databases
121 std::vector
<SUrlEntry
> m_urls
;