Created
April 9, 2009 00:56
-
-
Save torarnv/92155 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From d37adf30582fae207037d5128d9c13acd2d6bac7 Mon Sep 17 00:00:00 2001 | |
From: =?utf-8?q?Tor=20Arne=20Vestb=F8?= <torarnv@gmail.com> | |
Date: Wed, 8 Apr 2009 11:53:33 +0200 | |
Subject: [PATCH 1/3] Make sure fan-art is cached on first load regarless of where it came from | |
Previously fan-art was only cached when added as part of a library scan, | |
which did not work when setting the 'fanart_image' property from a video | |
plugin, resulting in exessive downloads of fan-art when navigating the | |
plugin. | |
--- | |
XBMC/xbmc/ThumbLoader.cpp | 25 +++++++++++++++++++++++++ | |
XBMC/xbmc/ThumbLoader.h | 1 + | |
2 files changed, 26 insertions(+), 0 deletions(-) | |
diff --git a/XBMC/xbmc/ThumbLoader.cpp b/XBMC/xbmc/ThumbLoader.cpp | |
index 3ddf43c..3be9655 100644 | |
--- a/XBMC/xbmc/ThumbLoader.cpp | |
+++ b/XBMC/xbmc/ThumbLoader.cpp | |
@@ -65,6 +65,27 @@ bool CThumbLoader::LoadRemoteThumb(CFileItem *pItem) | |
return pItem->HasThumbnail(); | |
} | |
+bool CThumbLoader::LoadRemoteFanart(CFileItem *pItem) | |
+{ | |
+ // look for remote fan art | |
+ CStdString thumb(pItem->GetProperty("fanart_image")); | |
+ if (!g_TextureManager.CanLoad(thumb)) | |
+ { | |
+ CStdString cachedThumb(pItem->GetCachedFanart()); | |
+ if (CFile::Exists(cachedThumb)) | |
+ pItem->SetProperty("fanart_image", cachedThumb); | |
+ else | |
+ { | |
+ CPicture pic; | |
+ if(pic.DoCreateThumbnail(thumb, cachedThumb)) | |
+ pItem->SetProperty("fanart_image", cachedThumb); | |
+ else | |
+ pItem->ClearProperty("fanart_image"); | |
+ } | |
+ } | |
+ return pItem->HasProperty("fanart_image"); | |
+} | |
+ | |
CVideoThumbLoader::CVideoThumbLoader() | |
{ | |
} | |
@@ -158,6 +179,10 @@ bool CVideoThumbLoader::LoadItem(CFileItem* pItem) | |
if (CFile::Exists(pItem->GetCachedFanart())) | |
pItem->SetProperty("fanart_image",pItem->GetCachedFanart()); | |
} | |
+ else | |
+ { | |
+ LoadRemoteFanart(pItem); | |
+ } | |
// if (pItem->IsVideo() && !pItem->IsInternetStream()) | |
// CDVDPlayer::GetFileMetaData(pItem->m_strPath, pItem); | |
diff --git a/XBMC/xbmc/ThumbLoader.h b/XBMC/xbmc/ThumbLoader.h | |
index 4785d8a..12b880d 100644 | |
--- a/XBMC/xbmc/ThumbLoader.h | |
+++ b/XBMC/xbmc/ThumbLoader.h | |
@@ -30,6 +30,7 @@ public: | |
virtual ~CThumbLoader(); | |
bool LoadRemoteThumb(CFileItem *pItem); | |
+ bool LoadRemoteFanart(CFileItem *pItem); | |
}; | |
class CVideoThumbLoader : public CThumbLoader | |
-- | |
1.6.1.9.g97c34 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment