xbmc
Fanart.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 // Fanart.h
13 
14 #include <string>
15 #include <vector>
16 
30 class CFanart
31 {
32 public:
35  CFanart();
39  void Pack();
44  bool Unpack();
49  std::string GetImageURL(unsigned int index = 0) const;
54  std::string GetPreviewURL(unsigned int index = 0) const;
58  const std::string GetColor(unsigned int index) const;
65  bool SetPrimaryFanart(unsigned int index);
69  unsigned int GetNumFanarts() const;
71  void AddFanart(const std::string& image, const std::string& preview, const std::string& colors);
73  void Clear();
80  std::string m_xml;
81 private:
82  static const unsigned int max_fanart_colors;
94  static bool ParseColors(const std::string&colorsIn, std::string&colorsOut);
95 
96  struct SFanartData
97  {
98  std::string strImage;
99  std::string strColors;
100  std::string strPreview;
101  };
102 
105  std::vector<SFanartData> m_fanart;
106 };
107 
void Clear()
Clear all internal fanart data.
Definition: Fanart.cpp:54
std::string GetImageURL(unsigned int index=0) const
Retrieves the fanart full res image URL.
Definition: Fanart.cpp:98
bool Unpack()
Takes the XML formatted string m_xml and unpacks the fanart data contained into the internal data...
Definition: Fanart.cpp:60
/brief CFanart is the core of fanart support and contains all fanart data for a specific show ...
Definition: Fanart.h:30
void Pack()
Takes the internal fanart data and packs it into an XML formatted string in m_xml.
Definition: Fanart.cpp:28
bool SetPrimaryFanart(unsigned int index)
Sets a particular fanart to be the "primary" fanart, or in other words, sets which fanart is actually...
Definition: Fanart.cpp:124
unsigned int GetNumFanarts() const
Returns how many fanarts are stored.
Definition: Fanart.cpp:137
std::string GetPreviewURL(unsigned int index=0) const
Retrieves the fanart preview image URL, or full res image URL if that doesn&#39;t exist.
Definition: Fanart.cpp:106
void AddFanart(const std::string &image, const std::string &preview, const std::string &colors)
Adds an image to internal fanart data.
Definition: Fanart.cpp:45
const std::string GetColor(unsigned int index) const
Used to return a specified fanart theme color value.
Definition: Fanart.cpp:114
std::string m_xml
m_xml contains an XML formatted string which is all fanart packed into one string.
Definition: Fanart.h:80
CFanart()
Standard constructor doesn&#39;t need to do anything.