bool CThumbLoader::CheckAndCacheThumb(CFileItem &item) { if (item.HasThumbnail() && !g_TextureManager.CanLoad(item.GetThumbnailImage())) { CStdString thumb = CTextureCache::Get().CheckAndCacheImage(item.GetThumbnailImage()); item.SetThumbnailImage(thumb); return !thumb.IsEmpty(); } return false; }
bool CVideoThumbLoader::FillThumb(CFileItem &item) { if (item.HasThumbnail()) return true; CStdString thumb = GetCachedImage(item, "thumb"); if (thumb.IsEmpty()) { thumb = item.GetUserVideoThumb(); if (!thumb.IsEmpty()) SetCachedImage(item, "thumb", thumb); } item.SetThumbnailImage(thumb); return !thumb.IsEmpty(); }
bool CProgramThumbLoader::FillThumb(CFileItem &item) { // no need to do anything if we already have a thumb set if (CheckAndCacheThumb(item) || item.HasThumbnail()) return true; // see whether we have a cached image for this item CStdString thumb = GetCachedThumb(item); if (!thumb.IsEmpty()) { item.SetThumbnailImage(CTextureCache::Get().CheckAndCacheImage(thumb)); return true; } thumb = GetLocalThumb(item); if (!thumb.IsEmpty()) { CTextureDatabase db; if (db.Open()) db.SetTextureForPath(item.GetPath(), thumb); thumb = CTextureCache::Get().CheckAndCacheImage(thumb); } item.SetThumbnailImage(thumb); return true; }