Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[art] adds a param to AppendArt to specify the prefix, and utilise fo…

…r setting art for children of tvshows, seasons + albums
  • Loading branch information...
commit 93a2523d786f1688ceb931b6f4ad5204433c5a29 1 parent 49a3662
Jonathan Marshall authored
View
4 xbmc/guilib/GUIListItem.cpp
@@ -136,10 +136,10 @@ void CGUIListItem::ClearArt()
m_artFallbacks.clear();
}
-void CGUIListItem::AppendArt(const ArtMap &art)
+void CGUIListItem::AppendArt(const ArtMap &art, const std::string &prefix)
{
for (ArtMap::const_iterator i = art.begin(); i != art.end(); ++i)
- SetArt(i->first, i->second);
+ SetArt(prefix.empty() ? i->first : prefix + '.' + i->first, i->second);
}
std::string CGUIListItem::GetArt(const std::string &type) const
View
3  xbmc/guilib/GUIListItem.h
@@ -91,9 +91,10 @@ class CGUIListItem
/*! \brief append artwork to an item
\param art a type:url map for artwork
+ \param prefix a prefix for the art, if applicable.
\sa GetArt
*/
- void AppendArt(const ArtMap &art);
+ void AppendArt(const ArtMap &art, const std::string &prefix = "");
/*! \brief set a fallback image for art
\param from the type to fallback from
View
11 xbmc/music/MusicThumbLoader.cpp
@@ -119,13 +119,14 @@ bool CMusicThumbLoader::FillLibraryArt(CFileItem &item)
else if (tag.GetType() == "song")
{ // no art for the song, try the album
ArtCache::const_iterator i = m_albumArt.find(tag.GetAlbumId());
+ if (i == m_albumArt.end())
+ {
+ m_database->GetArtForItem(tag.GetAlbumId(), "album", artwork);
+ i = m_albumArt.insert(make_pair(tag.GetAlbumId(), artwork)).first;
+ }
if (i != m_albumArt.end())
- item.SetArt(i->second);
- else
{
- if (m_database->GetArtForItem(tag.GetAlbumId(), "album", artwork))
- item.SetArt(artwork);
- m_albumArt.insert(make_pair(tag.GetAlbumId(), artwork));
+ item.AppendArt(i->second, "album");
}
}
if (tag.GetType() == "song" || tag.GetType() == "album")
View
22 xbmc/video/VideoThumbLoader.cpp
@@ -339,23 +339,15 @@ bool CVideoThumbLoader::FillLibraryArt(CFileItem &item)
if (!item.HasArt("fanart") && tag.m_iIdShow >= 0)
{
ArtCache::const_iterator i = m_showArt.find(tag.m_iIdShow);
+ if (i == m_showArt.end())
+ {
+ map<string, string> showArt;
+ m_database->GetArtForItem(tag.m_iIdShow, "tvshow", showArt);
+ i = m_showArt.insert(make_pair(tag.m_iIdShow, showArt)).first;
+ }
if (i != m_showArt.end())
- item.AppendArt(i->second);
- else
{
- map<string, string> showArt, cacheArt;
- if (m_database->GetArtForItem(tag.m_iIdShow, "tvshow", showArt))
- {
- for (CGUIListItem::ArtMap::iterator i = showArt.begin(); i != showArt.end(); ++i)
- {
- if (i->first == "fanart")
- cacheArt.insert(*i);
- else
- cacheArt.insert(make_pair("tvshow." + i->first, i->second));
- }
- item.AppendArt(cacheArt);
- }
- m_showArt.insert(make_pair(tag.m_iIdShow, cacheArt));
+ item.AppendArt(i->second, "tvshow");
}
}
m_database->Close();
View
11 xbmc/video/windows/GUIWindowVideoNav.cpp
@@ -293,13 +293,7 @@ bool CGUIWindowVideoNav::GetDirectory(const CStdString &strDirectory, CFileItemL
map<string, string> art;
if (m_database.GetArtForItem(details.m_iDbId, details.m_type, art))
{
- for (CGUIListItem::ArtMap::iterator i = art.begin(); i != art.end(); ++i)
- {
- if (i->first == "fanart")
- items.SetArt(i->first, i->second);
- else
- items.SetArt("tvshow." + i->first, i->second);
- }
+ items.AppendArt(art, "tvshow");
if (node == NODE_TYPE_SEASONS)
{
CFileItem showItem;
@@ -325,8 +319,7 @@ bool CGUIWindowVideoNav::GetDirectory(const CStdString &strDirectory, CFileItemL
CGUIListItem::ArtMap seasonArt;
if (m_database.GetArtForItem(seasonID, "season", seasonArt))
{
- for (CGUIListItem::ArtMap::iterator i = art.begin(); i != art.end(); ++i)
- items.SetArt("season." + i->first, i->second);
+ items.AppendArt(seasonArt, "season");
CFileItem seasonItem;
seasonItem.SetArt(seasonArt);
items.SetArt("thumb", seasonItem.GetArt("thumb"));
Please sign in to comment.
Something went wrong with that request. Please try again.