#include "utils/log.h"
#include "utils/Variant.h"
#include "music/karaoke/karaokelyricsfactory.h"
+#include "ThumbnailCache.h"
using namespace std;
using namespace XFILE;
CStdString CFileItem::GetCachedArtistThumb() const
{
- return GetCachedThumb("artist"+GetLabel(),g_settings.GetMusicArtistThumbFolder());
+ return CThumbnailCache::GetArtistThumb(*this);
}
CStdString CFileItem::GetCachedSeasonThumb() const
{
- CStdString seasonPath;
- if (HasVideoInfoTag())
- seasonPath = GetVideoInfoTag()->m_strPath;
-
- return GetCachedThumb("season"+seasonPath+GetLabel(),g_settings.GetVideoThumbFolder(),true);
+ return CThumbnailCache::GetSeasonThumb(*this);
}
CStdString CFileItem::GetCachedActorThumb() const
{
- return GetCachedThumb("actor"+GetLabel(),g_settings.GetVideoThumbFolder(),true);
+ return CThumbnailCache::GetActorThumb(*this);
}
void CFileItem::SetCachedArtistThumb()
if (!strAlbum.IsEmpty() && !strArtist.IsEmpty())
{
// try permanent album thumb using "album name + artist name"
- CStdString thumb(CUtil::GetCachedAlbumThumb(strAlbum, strArtist));
+ CStdString thumb(CThumbnailCache::GetAlbumThumb(strAlbum, strArtist));
if (CFile::Exists(thumb))
return thumb;
}
if (!m_bIsFolder)
{
// look for locally cached tbn
- CStdString thumb(CUtil::GetCachedMusicThumb(m_strPath));
+ CStdString thumb(CThumbnailCache::GetMusicThumb(m_strPath));
if (CFile::Exists(thumb))
return thumb;
}
// music thumbs are cached without slash at end
URIUtils::RemoveSlashAtEnd(strPath);
- CStdString thumb(CUtil::GetCachedMusicThumb(strPath));
+ CStdString thumb(CThumbnailCache::GetMusicThumb(strPath));
if (CFile::Exists(thumb))
return thumb;
CStdString thumb(GetUserMusicThumb(alwaysCheckRemote));
if (!thumb.IsEmpty())
{
- CStdString cachedThumb(CUtil::GetCachedMusicThumb(m_strPath));
+ CStdString cachedThumb(CThumbnailCache::GetMusicThumb(m_strPath));
CPicture::CreateThumbnail(thumb, cachedThumb);
}
CStdString CFileItem::GetCachedVideoThumb() const
{
- if (IsStack())
- return GetCachedThumb(CStackDirectory::GetFirstStackedFile(m_strPath),g_settings.GetVideoThumbFolder(),true);
- else if (IsVideoDb() && HasVideoInfoTag())
- {
- if (m_bIsFolder && !GetVideoInfoTag()->m_strPath.IsEmpty())
- return GetCachedThumb(GetVideoInfoTag()->m_strPath, g_settings.GetVideoThumbFolder(), true);
- else if (!GetVideoInfoTag()->m_strFileNameAndPath.IsEmpty())
- return GetCachedThumb(GetVideoInfoTag()->m_strFileNameAndPath, g_settings.GetVideoThumbFolder(), true);
- }
- return GetCachedThumb(m_strPath,g_settings.GetVideoThumbFolder(),true);
+ return CThumbnailCache::GetVideoThumb(*this);
}
CStdString CFileItem::GetCachedEpisodeThumb() const
{
- // get the locally cached thumb
- CStdString strCRC;
- strCRC.Format("%sepisode%i",GetVideoInfoTag()->m_strFileNameAndPath.c_str(),GetVideoInfoTag()->m_iEpisode);
- return GetCachedThumb(strCRC,g_settings.GetVideoThumbFolder(),true);
+ return CThumbnailCache::GetEpisodeThumb(*this);
}
void CFileItem::SetCachedVideoThumb()
CStdString CFileItem::GetCachedFanart() const
{
- // get the locally cached thumb
- if (IsVideoDb())
- {
- if (!HasVideoInfoTag())
- return "";
- if (!GetVideoInfoTag()->m_strArtist.IsEmpty())
- return GetCachedThumb(GetVideoInfoTag()->m_strArtist,g_settings.GetMusicFanartFolder());
- if (!m_bIsFolder && !GetVideoInfoTag()->m_strShowTitle.IsEmpty())
- {
- CVideoDatabase database;
- database.Open();
- int iShowId = database.GetTvShowId(GetVideoInfoTag()->m_strPath);
- CStdString showPath;
- database.GetFilePathById(iShowId,showPath,VIDEODB_CONTENT_TVSHOWS);
- return GetCachedThumb(showPath,g_settings.GetVideoFanartFolder());
- }
- return GetCachedThumb(m_bIsFolder ? GetVideoInfoTag()->m_strPath : GetVideoInfoTag()->m_strFileNameAndPath,g_settings.GetVideoFanartFolder());
- }
- if (HasMusicInfoTag())
- return GetCachedThumb(GetMusicInfoTag()->GetArtist(),g_settings.GetMusicFanartFolder());
-
- return GetCachedThumb(m_strPath,g_settings.GetVideoFanartFolder());
+ return CThumbnailCache::GetFanart(*this);
}
CStdString CFileItem::GetCachedThumb(const CStdString &path, const CStdString &path2, bool split)
{
- // get the locally cached thumb
- Crc32 crc;
- crc.ComputeFromLowerCase(path);
-
- CStdString thumb;
- if (split)
- {
- CStdString hex;
- hex.Format("%08x", (__int32)crc);
- thumb.Format("%c\\%08x.tbn", hex[0], (unsigned __int32)crc);
- }
- else
- thumb.Format("%08x.tbn", (unsigned __int32)crc);
-
- return URIUtils::AddFileToFolder(path2, thumb);
+ return CThumbnailCache::GetThumb(path, path2, split);
}
/*void CFileItem::SetThumb()
#include "filesystem/File.h"
#include "threads/SingleLock.h"
+#include "FileItem.h"
+#include "video/VideoInfoTag.h"
+#include "video/VideoDatabase.h"
+#include "music/tags/MusicInfoTag.h"
+#include "music/Album.h"
+#include "music/Artist.h"
+#include "settings/Settings.h"
+#include "URIUtils.h"
+#include "Crc32.h"
+#include "filesystem/StackDirectory.h"
+
using namespace std;
using namespace XFILE;
+using namespace MUSIC_INFO;
CThumbnailCache* CThumbnailCache::m_pCacheInstance = NULL;
else
m_Cache.insert(pair<CStdString, bool>(strFileName, bExists));
}
+
+CStdString CThumbnailCache::GetAlbumThumb(const CFileItem &item)
+{
+ return GetAlbumThumb(item.GetMusicInfoTag());
+}
+
+CStdString CThumbnailCache::GetAlbumThumb(const CMusicInfoTag *musicInfo)
+{
+ if (!musicInfo)
+ return CStdString();
+
+ return GetAlbumThumb(musicInfo->GetAlbum(), !musicInfo->GetArtist().empty() ? musicInfo->GetArtist() : musicInfo->GetAlbumArtist());
+}
+
+CStdString CThumbnailCache::GetAlbumThumb(const CAlbum &album)
+{
+ return GetAlbumThumb(album.strAlbum, album.strArtist);
+}
+
+CStdString CThumbnailCache::GetAlbumThumb(const CStdString& album, const CStdString& artist)
+{
+ if (album.IsEmpty())
+ return GetMusicThumb("unknown" + artist);
+ if (artist.IsEmpty())
+ return GetMusicThumb(album + "unknown");
+ return GetMusicThumb(album + artist);
+}
+
+CStdString CThumbnailCache::GetArtistThumb(const CFileItem &item)
+{
+ return GetArtistThumb(item.GetLabel());
+}
+
+CStdString CThumbnailCache::GetArtistThumb(const CArtist &artist)
+{
+ return GetArtistThumb(artist.strArtist);
+}
+
+CStdString CThumbnailCache::GetArtistThumb(const CStdString &label)
+{
+ return GetThumb("artist" + label, g_settings.GetMusicArtistThumbFolder());
+}
+
+CStdString CThumbnailCache::GetActorThumb(const CFileItem &item)
+{
+ return GetActorThumb(item.GetLabel());
+}
+
+CStdString CThumbnailCache::GetActorThumb(const CStdString &label)
+{
+ return GetThumb("actor" + label, g_settings.GetVideoThumbFolder(), true);
+}
+
+CStdString CThumbnailCache::GetSeasonThumb(const CFileItem &item)
+{
+ return GetSeasonThumb(item.GetLabel(), item.GetVideoInfoTag());
+}
+
+CStdString CThumbnailCache::GetSeasonThumb(const CStdString &label, const CVideoInfoTag *videoInfo /* = NULL */)
+{
+ CStdString seasonPath;
+ if (videoInfo)
+ seasonPath = videoInfo->m_strPath;
+
+ return GetThumb("season" + seasonPath + label, g_settings.GetVideoThumbFolder(), true);
+}
+
+CStdString CThumbnailCache::GetEpisodeThumb(const CFileItem &item)
+{
+ if (!item.HasVideoInfoTag())
+ return CStdString();
+
+ return GetEpisodeThumb(item.GetVideoInfoTag());
+}
+
+CStdString CThumbnailCache::GetEpisodeThumb(const CVideoInfoTag* videoInfo)
+{
+ // get the locally cached thumb
+ CStdString strCRC;
+ strCRC.Format("%sepisode%i", videoInfo->m_strFileNameAndPath.c_str(), videoInfo->m_iEpisode);
+ return GetThumb(strCRC, g_settings.GetVideoThumbFolder(), true);
+}
+
+CStdString CThumbnailCache::GetVideoThumb(const CFileItem &item)
+{
+ if (item.IsStack())
+ return GetThumb(CStackDirectory::GetFirstStackedFile(item.m_strPath), g_settings.GetVideoThumbFolder(), true);
+ else if (item.IsVideoDb() && item.HasVideoInfoTag())
+ {
+ if (item.m_bIsFolder && !item.GetVideoInfoTag()->m_strPath.IsEmpty())
+ return GetThumb(item.GetVideoInfoTag()->m_strPath, g_settings.GetVideoThumbFolder(), true);
+ else if (!item.GetVideoInfoTag()->m_strFileNameAndPath.IsEmpty())
+ return GetThumb(item.GetVideoInfoTag()->m_strFileNameAndPath, g_settings.GetVideoThumbFolder(), true);
+ }
+ return GetThumb(item.m_strPath, g_settings.GetVideoThumbFolder(), true);
+}
+
+CStdString CThumbnailCache::GetFanart(const CFileItem &item)
+{
+ // get the locally cached thumb
+ if (item.IsVideoDb())
+ {
+ if (!item.HasVideoInfoTag())
+ return "";
+ if (!item.GetVideoInfoTag()->m_strArtist.IsEmpty())
+ return GetThumb(item.GetVideoInfoTag()->m_strArtist,g_settings.GetMusicFanartFolder());
+ if (!item.m_bIsFolder && !item.GetVideoInfoTag()->m_strShowTitle.IsEmpty())
+ {
+ CVideoDatabase database;
+ database.Open();
+ int iShowId = database.GetTvShowId(item.GetVideoInfoTag()->m_strPath);
+ CStdString showPath;
+ database.GetFilePathById(iShowId,showPath,VIDEODB_CONTENT_TVSHOWS);
+ return GetThumb(showPath,g_settings.GetVideoFanartFolder());
+ }
+ return GetThumb(item.m_bIsFolder ? item.GetVideoInfoTag()->m_strPath : item.GetVideoInfoTag()->m_strFileNameAndPath,g_settings.GetVideoFanartFolder());
+ }
+ if (item.HasMusicInfoTag())
+ return GetThumb(item.GetMusicInfoTag()->GetArtist(),g_settings.GetMusicFanartFolder());
+
+ return GetThumb(item.m_strPath,g_settings.GetVideoFanartFolder());
+}
+
+CStdString CThumbnailCache::GetThumb(const CStdString &path, const CStdString &path2, bool split /* = false */)
+{
+ // get the locally cached thumb
+ Crc32 crc;
+ crc.ComputeFromLowerCase(path);
+
+ CStdString thumb;
+ if (split)
+ {
+ CStdString hex;
+ hex.Format("%08x", (__int32)crc);
+ thumb.Format("%c\\%08x.tbn", hex[0], (unsigned __int32)crc);
+ }
+ else
+ thumb.Format("%08x.tbn", (unsigned __int32)crc);
+
+ return URIUtils::AddFileToFolder(path2, thumb);
+}
+
+CStdString CThumbnailCache::GetMusicThumb(const CStdString& path)
+{
+ Crc32 crc;
+ CStdString noSlashPath(path);
+ URIUtils::RemoveSlashAtEnd(noSlashPath);
+ crc.ComputeFromLowerCase(noSlashPath);
+ CStdString hex;
+ hex.Format("%08x", (unsigned __int32) crc);
+ CStdString thumb;
+ thumb.Format("%c/%s.tbn", hex[0], hex.c_str());
+ return URIUtils::AddFileToFolder(g_settings.GetMusicThumbFolder(), thumb);
+}
#include <map>
class CCriticalSection;
+class CVideoInfoTag;
+namespace MUSIC_INFO
+{
+ class CMusicInfoTag;
+}
+class CAlbum;
+class CArtist;
+class CFileItem;
class CThumbnailCache
{
void Add(const CStdString& strFileName, bool bExists);
void Clear();
bool IsCached(const CStdString& strFileName);
+
+ static CStdString GetMusicThumb(const CStdString &path);
+ static CStdString GetAlbumThumb(const CFileItem &item);
+ static CStdString GetAlbumThumb(const MUSIC_INFO::CMusicInfoTag *musicInfo);
+ static CStdString GetAlbumThumb(const CAlbum &album);
+ static CStdString GetAlbumThumb(const CStdString &album, const CStdString &artist);
+ static CStdString GetArtistThumb(const CArtist &artist);
+ static CStdString GetArtistThumb(const CFileItem &item);
+ static CStdString GetArtistThumb(const CStdString &label);
+ static CStdString GetActorThumb(const CFileItem &item);
+ static CStdString GetActorThumb(const CStdString &label);
+ static CStdString GetSeasonThumb(const CFileItem &item);
+ static CStdString GetSeasonThumb(const CStdString &label, const CVideoInfoTag *videoInfo = NULL);
+ static CStdString GetEpisodeThumb(const CFileItem &item);
+ static CStdString GetEpisodeThumb(const CVideoInfoTag *videoInfo);
+ static CStdString GetVideoThumb(const CFileItem &item);
+ static CStdString GetFanart(const CFileItem &item);
+ static CStdString GetThumb(const CStdString &path, const CStdString &path2, bool split = false);
protected:
static CThumbnailCache* m_pCacheInstance;
return false;
}
-CStdString CUtil::GetCachedAlbumThumb(const CStdString& album, const CStdString& artist)
-{
- if (album.IsEmpty())
- return GetCachedMusicThumb("unknown"+artist);
- if (artist.IsEmpty())
- return GetCachedMusicThumb(album+"unknown");
- return GetCachedMusicThumb(album+artist);
-}
-
-CStdString CUtil::GetCachedMusicThumb(const CStdString& path)
-{
- Crc32 crc;
- CStdString noSlashPath(path);
- URIUtils::RemoveSlashAtEnd(noSlashPath);
- crc.ComputeFromLowerCase(noSlashPath);
- CStdString hex;
- hex.Format("%08x", (unsigned __int32) crc);
- CStdString thumb;
- thumb.Format("%c/%s.tbn", hex[0], hex.c_str());
- return URIUtils::AddFileToFolder(g_settings.GetMusicThumbFolder(), thumb);
-}
-
CStdString CUtil::GetDefaultFolderThumb(const CStdString &folderThumb)
{
if (g_TextureManager.HasTexture(folderThumb))
static double AlbumRelevance(const CStdString& strAlbumTemp1, const CStdString& strAlbum1, const CStdString& strArtistTemp1, const CStdString& strArtist1);
static bool MakeShortenPath(CStdString StrInput, CStdString& StrOutput, int iTextMaxLength);
static bool SupportsFileOperations(const CStdString& strPath);
-
- static CStdString GetCachedMusicThumb(const CStdString &path);
- static CStdString GetCachedAlbumThumb(const CStdString &album, const CStdString &artist);
static CStdString GetDefaultFolderThumb(const CStdString &folderThumb);
#ifdef UNIT_TESTING
#include "guilib/LocalizeStrings.h"
#include "TextureCache.h"
#include "video/windows/GUIWindowVideoBase.h"
+#include "ThumbnailCache.h"
#ifdef _WIN32
#include "WIN32Util.h"
{
cachedThumb = item->m_strPath;
URIUtils::RemoveSlashAtEnd(cachedThumb);
- cachedThumb = CUtil::GetCachedMusicThumb(cachedThumb);
+ cachedThumb = CThumbnailCache::GetMusicThumb(cachedThumb);
}
else if (type == "video")
cachedThumb = item->GetCachedVideoThumb();
#include "utils/URIUtils.h"
#include "utils/log.h"
#include "TextureCache.h"
+#include "ThumbnailCache.h"
#ifdef _WIN32
extern "C" FILE *fopen_utf8(const char *_Filename, const char *_Mode);
if (numParas>1)
{
- thumbFilename = CUtil::GetCachedAlbumThumb(paras[0], paras[1]);
+ thumbFilename = CThumbnailCache::GetAlbumThumb(paras[0], paras[1]);
return SetResponse(openTag+thumbFilename ) ;
}
else
m_artistItem->GetMusicInfoTag()->SetArtist(m_artistItem->GetLabel());
m_artistItem->GetMusicInfoTag()->SetDatabaseId(artistID);
CMusicDatabase::SetPropertiesFromArtist(*m_artistItem, artist);
- if (CFile::Exists(m_artistItem->GetCachedArtistThumb()))
- m_artistItem->SetThumbnailImage(m_artistItem->GetCachedArtistThumb());
+ m_artistItem->SetCachedArtistThumb();
HandleFileItem("artistid", false, "artistdetails", m_artistItem, parameterObject, parameterObject["fields"], result, false);
musicdatabase.Close();
#include "utils/log.h"
#include "utils/URIUtils.h"
#include "TextureCache.h"
+#include "ThumbnailCache.h"
using namespace std;
using namespace XFILE;
if (m_bArtistInfo)
thumbImage = m_albumItem->GetCachedArtistThumb();
else
- thumbImage = CUtil::GetCachedAlbumThumb(m_album.strAlbum, m_album.strArtist);
+ thumbImage = CThumbnailCache::GetAlbumThumb(m_album);
if (!CFile::Exists(thumbImage))
{
if (m_bArtistInfo)
cachedThumb = m_albumItem->GetCachedArtistThumb();
else
- cachedThumb = CUtil::GetCachedAlbumThumb(m_album.strAlbum, m_album.strArtist);
+ cachedThumb = CThumbnailCache::GetAlbumThumb(m_album);
CTextureCache::Get().ClearCachedImage(cachedThumb, true);
if (result.Left(14) == "thumb://Remote")
{
CFileItemList items;
- CStdString cachedThumb(CFileItem::GetCachedThumb(m_artist.strArtist,g_settings.GetMusicFanartFolder()));
+ CStdString cachedThumb(CThumbnailCache::GetThumb(m_artist.strArtist,g_settings.GetMusicFanartFolder()));
if (CFile::Exists(cachedThumb))
{
CFileItemPtr itemCurrent(new CFileItem("fanart://Current",false));
#include "guilib/LocalizeStrings.h"
#include "TextureCache.h"
#include "music/Album.h"
+#include "ThumbnailCache.h"
using namespace XFILE;
// delete the thumbnail if that's what the user wants, else overwrite with the
// new thumbnail
- CStdString cachedThumb(CUtil::GetCachedAlbumThumb(m_song->GetMusicInfoTag()->GetAlbum(), m_song->GetMusicInfoTag()->GetArtist()));
+ CStdString cachedThumb(CThumbnailCache::GetAlbumThumb(m_song->GetMusicInfoTag()));
CTextureCache::Get().ClearCachedImage(cachedThumb, true);
if (result == "thumb://None")
#include "utils/TimeUtils.h"
#include "utils/log.h"
#include "utils/URIUtils.h"
+#include "ThumbnailCache.h"
#include <algorithm>
CStdString album, artist;
if (!HasSingleAlbum(songs, album, artist)) return;
// Was the album art of this album read during scan?
- CStdString albumCoverArt(CUtil::GetCachedAlbumThumb(album, artist));
+ CStdString albumCoverArt(CThumbnailCache::GetAlbumThumb(album, artist));
if (CUtil::ThumbExists(albumCoverArt))
{
CStdString folderPath1(folderPath);
// Folder art is cached without the slash at end
URIUtils::RemoveSlashAtEnd(folderPath1);
- CStdString folderCoverArt(CUtil::GetCachedMusicThumb(folderPath1));
+ CStdString folderCoverArt(CThumbnailCache::GetMusicThumb(folderPath1));
// copy as directory thumb as well
if (CFile::Cache(albumCoverArt, folderCoverArt))
CUtil::ThumbCacheAdd(folderCoverArt, true);
CStdString thumb;
if (!m_musicDatabase.GetAlbumThumb(id, thumb) || thumb.IsEmpty() || !XFILE::CFile::Exists(thumb))
{
- thumb = CUtil::GetCachedAlbumThumb(album.strAlbum,album.strArtist);
+ thumb = CThumbnailCache::GetAlbumThumb(album);
CScraperUrl::DownloadThumbnail(thumb,album.thumbURL.m_url[0]);
m_musicDatabase.SaveAlbumThumb(id, thumb);
}
#include "filesystem/File.h"
#include "utils/log.h"
#include "utils/EndianSwap.h"
+#include "ThumbnailCache.h"
#define BYTES_TO_CHECK_FOR_BAD_TAGS 16384
CStdString strCoverArt;
if (!m_musicInfoTag.GetAlbum().IsEmpty() && (!m_musicInfoTag.GetAlbumArtist().IsEmpty() || !m_musicInfoTag.GetArtist().IsEmpty()))
- strCoverArt = CUtil::GetCachedAlbumThumb(m_musicInfoTag.GetAlbum(), m_musicInfoTag.GetAlbumArtist().IsEmpty() ? m_musicInfoTag.GetArtist() : m_musicInfoTag.GetAlbumArtist());
+ strCoverArt = CThumbnailCache::GetAlbumThumb(&m_musicInfoTag);
else
- strCoverArt = CUtil::GetCachedMusicThumb(m_musicInfoTag.GetURL());
+ strCoverArt = CThumbnailCache::GetMusicThumb(m_musicInfoTag.GetURL());
if (cover && !CUtil::ThumbExists(strCoverArt))
{
#include "guilib/LocalizeStrings.h"
#include "utils/CharsetConverter.h"
#include "utils/log.h"
+#include "ThumbnailCache.h"
#include <set>
// other non-tagged files don't get this album image
CStdString strCoverArt;
if (!tag.GetAlbum().IsEmpty() && (!tag.GetAlbumArtist().IsEmpty() || !tag.GetArtist().IsEmpty()))
- strCoverArt = CUtil::GetCachedAlbumThumb(tag.GetAlbum(), tag.GetAlbumArtist().IsEmpty() ? tag.GetArtist() : tag.GetAlbumArtist());
+ strCoverArt = CThumbnailCache::GetAlbumThumb(&tag);
else
- strCoverArt = CUtil::GetCachedMusicThumb(tag.GetURL());
+ strCoverArt = CThumbnailCache::GetMusicThumb(tag.GetURL());
if (bFound && !CUtil::ThumbExists(strCoverArt))
{
CStdString strExtension=GetPictureMimeType(pictype);
#include "guilib/LocalizeStrings.h"
#include "utils/AutoPtrHandle.h"
#include "utils/log.h"
+#include "ThumbnailCache.h"
using namespace XFILE;
using namespace AUTOPTR;
// other non-tagged files don't get this album image
CStdString strCoverArt;
if (!tag.GetAlbum().IsEmpty() && (!tag.GetAlbumArtist().IsEmpty() || !tag.GetArtist().IsEmpty()))
- strCoverArt = CUtil::GetCachedAlbumThumb(tag.GetAlbum(), tag.GetAlbumArtist().IsEmpty() ? tag.GetArtist() : tag.GetAlbumArtist());
+ strCoverArt = CThumbnailCache::GetAlbumThumb(&tag);
else
- strCoverArt = CUtil::GetCachedMusicThumb(tag.GetURL());
+ strCoverArt = CThumbnailCache::GetMusicThumb(tag.GetURL());
if (!CUtil::ThumbExists(strCoverArt))
{
if (CPicture::CreateThumbnailFromMemory( m_thumbData, m_thumbSize, "", strCoverArt ) )
#include "utils/AutoPtrHandle.h"
#include "utils/CharsetConverter.h"
#include "utils/log.h"
+#include "ThumbnailCache.h"
using namespace AUTOPTR;
using namespace XFILE;
// other non-tagged files don't get this album image
CStdString strCoverArt;
if (!tag.GetAlbum().IsEmpty() && (!tag.GetAlbumArtist().IsEmpty() || !tag.GetArtist().IsEmpty()))
- strCoverArt = CUtil::GetCachedAlbumThumb(tag.GetAlbum(), tag.GetAlbumArtist().IsEmpty() ? tag.GetArtist() : tag.GetAlbumArtist());
+ strCoverArt = CThumbnailCache::GetAlbumThumb(&tag);
else
- strCoverArt = CUtil::GetCachedMusicThumb(tag.GetURL());
+ strCoverArt = CThumbnailCache::GetMusicThumb(tag.GetURL());
if (!CUtil::ThumbExists(strCoverArt))
{
int nPos = strExtension.Find('/');
#include "utils/TimeUtils.h"
#include "utils/log.h"
#include "utils/URIUtils.h"
+#include "ThumbnailCache.h"
using namespace std;
using namespace XFILE;
saveDirThumb = false;
}
- CStdString albumThumb(CUtil::GetCachedAlbumThumb(album.strAlbum, album.strArtist));
+ CStdString albumThumb(CThumbnailCache::GetAlbumThumb(album));
// Update the thumb in the music database (songs + albums)
CStdString albumPath(path);
CStdString album, artist;
if (CMusicInfoScanner::HasSingleAlbum(songs, album, artist))
{ // can cache as the folder thumb
- CStdString folderThumb(CUtil::GetCachedMusicThumb(albumPath));
+ CStdString folderThumb(CThumbnailCache::GetMusicThumb(albumPath));
CFile::Cache(albumThumb, folderThumb);
}
}
#include "addons/AddonInstaller.h"
#include "interfaces/AnnouncementManager.h"
#include "dbwrappers/dataset.h"
+#include "ThumbnailCache.h"
using namespace std;
using namespace dbiplus;
if (!items.Contains(pItem->m_strPath))
{
pItem->GetVideoInfoTag()->m_strArtist = m_pDS->fv(2).get_asString();
- CStdString strThumb = CUtil::GetCachedAlbumThumb(pItem->GetLabel(),pItem->GetVideoInfoTag()->m_strArtist);
+ CStdString strThumb = CThumbnailCache::GetAlbumThumb(*pItem);
if (CFile::Exists(strThumb))
pItem->SetThumbnailImage(strThumb);
items.Add(pItem);
if (!items.Contains(pItem->m_strPath))
{
pItem->GetVideoInfoTag()->m_strArtist = m_pDS->fv(2).get_asString();
- CStdString strThumb = CUtil::GetCachedAlbumThumb(pItem->GetLabel(),m_pDS->fv(2).get_asString());
+ CStdString strThumb = CThumbnailCache::GetAlbumThumb(pItem->GetLabel(), m_pDS->fv(2).get_asString());
if (CFile::Exists(strThumb))
pItem->SetThumbnailImage(strThumb);
items.Add(pItem);