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
= "") : m_url(std::move(url
)) {}
38 std::string m_preview
;
39 UrlType m_type
= UrlType::General
;
46 explicit CScraperUrl(const std::string
& strUrl
);
47 explicit CScraperUrl(const TiXmlElement
* element
);
52 bool HasData() const { return !m_data
.empty(); }
53 const std::string
& GetData() const { return m_data
; }
54 void SetData(std::string data
);
56 const std::string
& GetTitle() const { return m_title
; }
57 void SetTitle(std::string title
) { m_title
= std::move(title
); }
59 const std::string
& GetId() const { return m_id
; }
60 void SetId(std::string id
) { m_id
= std::move(id
); }
62 double GetRelevance() const { return m_relevance
; }
63 void SetRelevance(double relevance
) { m_relevance
= relevance
; }
65 bool HasUrls() const { return !m_urls
.empty(); }
66 const std::vector
<SUrlEntry
>& GetUrls() const { return m_urls
; }
67 void SetUrls(std::vector
<SUrlEntry
> urls
) { m_urls
= std::move(urls
); }
68 void AppendUrl(SUrlEntry url
) { m_urls
.push_back(std::move(url
)); }
70 const SUrlEntry
GetFirstUrlByType(const std::string
& type
= "") const;
71 const SUrlEntry
GetSeasonUrl(int season
, const std::string
& type
= "") const;
72 unsigned int GetMaxSeasonUrl() const;
74 std::string
GetFirstThumbUrl() const;
76 /*! \brief fetch the full URLs (including referrer) of thumbs
77 \param thumbs [out] vector of thumb URLs to fill
78 \param type the type of thumb URLs to fetch, if empty (the default) picks any
79 \param season number of season that we want thumbs for, -1 indicates no season (the default)
80 \param unique avoid adding duplicate URLs when adding to a thumbs vector with existing items
82 void GetThumbUrls(std::vector
<std::string
>& thumbs
,
83 const std::string
& type
= "",
85 bool unique
= false) const;
88 bool ParseFromData(const std::string
& data
); // copies by intention
89 bool ParseAndAppendUrl(const TiXmlElement
* element
);
90 bool ParseAndAppendUrlsFromEpisodeGuide(const std::string
& episodeGuide
); // copies by intention
91 void AddParsedUrl(const std::string
& url
,
92 const std::string
& aspect
= "",
93 const std::string
& preview
= "",
94 const std::string
& referrer
= "",
95 const std::string
& cache
= "",
100 /*! \brief fetch the full URL (including referrer) of a thumb
101 \param URL entry to use to create the full URL
102 \return the full URL, including referrer
104 static std::string
GetThumbUrl(const CScraperUrl::SUrlEntry
& entry
);
106 static bool Get(const SUrlEntry
& scrURL
,
107 std::string
& strHTML
,
108 XFILE::CCurlFile
& http
,
109 const std::string
& cacheContext
);
111 // ATTENTION: this member MUST NOT be used directly except from databases
118 std::vector
<SUrlEntry
> m_urls
;