Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
CFanart Class Reference

#include <Fanart.h>

Public Member Functions

 CFanart ()
 Standard constructor doesn't need to do anything.
 
void Pack ()
 
bool Unpack ()
 
std::string GetImageURL (unsigned int index=0) const
 
std::string GetPreviewURL (unsigned int index=0) const
 
const std::string GetColor (unsigned int index) const
 
bool SetPrimaryFanart (unsigned int index)
 
unsigned int GetNumFanarts () const
 
void AddFanart (const std::string &image, const std::string &preview, const std::string &colors)
 Adds an image to internal fanart data.
 
void Clear ()
 Clear all internal fanart data.
 

Public Attributes

std::string m_xml
 

Detailed Description

/brief CFanart is the core of fanart support and contains all fanart data for a specific show

CFanart stores all data related to all available fanarts for a given TV show and provides functions required to manipulate and access that data. In order to provide an interface between the fanart data and the XBMC database, all data is stored internally it its own form, as well as packed into an XML formatted string stored in the member variable m_xml. Information on multiple fanarts for a given show is stored, but XBMC only cares about the very first fanart stored. These interfaces provide a means to access the data in that first fanart record, as well as to set which fanart is the first record. Externally, all XBMC needs to care about is getting and setting that first record. Everything else is maintained internally by CFanart. This point is key to using the interface properly.

Constructor & Destructor Documentation

◆ CFanart()

CFanart::CFanart ( )
default

Standard constructor doesn't need to do anything.

CFanart Functions.

Member Function Documentation

◆ AddFanart()

void CFanart::AddFanart ( const std::string & image,
const std::string & preview,
const std::string & colors )

Adds an image to internal fanart data.

◆ Clear()

void CFanart::Clear ( )

Clear all internal fanart data.

◆ GetColor()

const std::string CFanart::GetColor ( unsigned int index) const

Used to return a specified fanart theme color value

Parameters
index0 based index of the color to retrieve. A fanart theme contains 3 colors, indices 0-2, arranged from darkest to lightest.

◆ GetImageURL()

std::string CFanart::GetImageURL ( unsigned int index = 0) const

Retrieves the fanart full res image URL

Parameters
index- index of image to retrieve (defaults to 0)
Returns
A string containing the full URL to the full resolution fanart image

◆ GetNumFanarts()

unsigned int CFanart::GetNumFanarts ( ) const

Returns how many fanarts are stored

Returns
An integer indicating how many fanarts are stored in the class. Fanart indices are 0 to (GetNumFanarts() - 1)

◆ GetPreviewURL()

std::string CFanart::GetPreviewURL ( unsigned int index = 0) const

Retrieves the fanart preview image URL, or full res image URL if that doesn't exist

Parameters
index- index of image to retrieve (defaults to 0)
Returns
A string containing the full URL to the full resolution fanart image

◆ Pack()

void CFanart::Pack ( )

Takes the internal fanart data and packs it into an XML formatted string in m_xml

See also
m_xml

◆ SetPrimaryFanart()

bool CFanart::SetPrimaryFanart ( unsigned int index)

Sets a particular fanart to be the "primary" fanart, or in other words, sets which fanart is actually used by XBMC

This is the one of the only instances in the public interface where there is any hint that more than one fanart exists, but its by necessity.

Parameters
index0 based index of which fanart to set as the primary fanart
Returns
A boolean value indicating success or failure. This should only return false if the specified index is not a valid fanart

◆ Unpack()

bool CFanart::Unpack ( )

Takes the XML formatted string m_xml and unpacks the fanart data contained into the internal data

Returns
A boolean indicating success or failure
See also
m_xml

Member Data Documentation

◆ m_xml

std::string CFanart::m_xml

m_xml contains an XML formatted string which is all fanart packed into one string.

This string is the "interface" as it were to the XBMC database, and MUST be kept in sync with the rest of the class. Therefore anytime this string is changed, the change should be followed up by a call to CFanart::UnPack(). This XML formatted string is also the interface used to pass the fanart data from the scraper to CFanart.


The documentation for this class was generated from the following files: