/*
* Copyright (C) 2012-2013 Team XBMC
- * http://www.xbmc.org
+ * http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "MusicThumbLoader.h"
#include "FileItem.h"
-#include "TextureCache.h"
+#include "TextureDatabase.h"
#include "music/tags/MusicInfoTag.h"
#include "music/tags/MusicInfoTagLoaderFactory.h"
#include "music/infoscanner/MusicInfoScanner.h"
pItem->SetArt("artist.fanart", fanart);
pItem->SetArtFallback("fanart", "artist.fanart");
}
+ else if (!pItem->GetMusicInfoTag()->GetAlbumArtist().empty() &&
+ pItem->GetMusicInfoTag()->GetAlbumArtist()[0] != artist)
+ {
+ // If no artist fanart and the album artist is different to the artist,
+ // try to get fanart from the album artist
+ artist = pItem->GetMusicInfoTag()->GetAlbumArtist()[0];
+ idArtist = m_musicDatabase->GetArtistByName(artist);
+ if (idArtist >= 0)
+ {
+ fanart = m_musicDatabase->GetArtForItem(idArtist, "artist", "fanart");
+ if (!fanart.empty())
+ {
+ pItem->SetArt("albumartist.fanart", fanart);
+ pItem->SetArtFallback("fanart", "albumartist.fanart");
+ }
+ }
+ }
}
m_musicDatabase->Close();
}
if (!FillThumb(*pItem, false)) // Check for user thumbs but ignore folder thumbs
{
// No user thumb, use embedded art
- CStdString thumb = CTextureCache::GetWrappedImageURL(pItem->GetPath(), "music");
+ CStdString thumb = CTextureUtils::GetWrappedImageURL(pItem->GetPath(), "music");
pItem->SetArt("thumb", thumb);
}
}
if (item.HasArt("thumb"))
return true;
CStdString thumb = GetCachedImage(item, "thumb");
- if (thumb.IsEmpty())
+ if (thumb.empty())
{
thumb = item.GetUserMusicThumb(false, folderThumbs);
- if (!thumb.IsEmpty())
+ if (!thumb.empty())
SetCachedImage(item, "thumb", thumb);
}
- item.SetArt("thumb", thumb);
- return !thumb.IsEmpty();
+ if (!thumb.empty())
+ item.SetArt("thumb", thumb);
+ return !thumb.empty();
}
bool CMusicThumbLoader::FillLibraryArt(CFileItem &item)
item.SetArt("artist.fanart", fanart);
item.SetArtFallback("fanart", "artist.fanart");
}
+ else if (tag.GetType() == "song")
+ {
+ // If no artist fanart, try for album artist fanart
+ fanart = m_musicDatabase->GetArtistArtForItem(tag.GetAlbumId(), "album", "fanart");
+ if (!fanart.empty())
+ {
+ item.SetArt("albumartist.fanart", fanart);
+ item.SetArtFallback("fanart", "albumartist.fanart");
+ }
+ }
}
m_musicDatabase->Close();
}