Skip to content

Commit

Permalink
Merge pull request #1753 from koying/fixmissinggenthumb
Browse files Browse the repository at this point in the history
FIX: regenerate auto-thumb if not present
  • Loading branch information
jmarshallnz committed Nov 19, 2012
2 parents 0562c11 + 79178e5 commit e035ef7
Showing 1 changed file with 28 additions and 20 deletions.
48 changes: 28 additions & 20 deletions xbmc/video/VideoThumbLoader.cpp
Expand Up @@ -250,30 +250,38 @@ bool CVideoThumbLoader::LoadItem(CFileItem* pItem)
}

// thumbnails are special-cased due to auto-generation
if (!pItem->HasArt("thumb") && !pItem->m_bIsFolder && pItem->IsVideo())
if (!pItem->m_bIsFolder && pItem->IsVideo())
{
// create unique thumb for auto generated thumbs
CStdString thumbURL = GetEmbeddedThumbURL(*pItem);
if (CTextureCache::Get().HasCachedImage(thumbURL))
{
CTextureCache::Get().BackgroundCacheImage(thumbURL);
pItem->SetProperty("HasAutoThumb", true);
pItem->SetProperty("AutoThumbImage", thumbURL);
pItem->SetArt("thumb", thumbURL);
}
else if (g_guiSettings.GetBool("myvideos.extractthumb") &&
g_guiSettings.GetBool("myvideos.extractflags"))
// An auto-generated thumb may have been cached on a different device - check we have it here
CStdString url = pItem->GetArt("thumb");
if (url.compare(0, 14, "image://video@") == 0 && !CTextureCache::Get().HasCachedImage(url))
pItem->SetArt("thumb", "");

if (!pItem->HasArt("thumb"))
{
CFileItem item(*pItem);
CStdString path(item.GetPath());
if (URIUtils::IsInRAR(item.GetPath()))
SetupRarOptions(item,path);
// create unique thumb for auto generated thumbs
CStdString thumbURL = GetEmbeddedThumbURL(*pItem);
if (CTextureCache::Get().HasCachedImage(thumbURL))
{
CTextureCache::Get().BackgroundCacheImage(thumbURL);
pItem->SetProperty("HasAutoThumb", true);
pItem->SetProperty("AutoThumbImage", thumbURL);
pItem->SetArt("thumb", thumbURL);
}
else if (g_guiSettings.GetBool("myvideos.extractthumb") &&
g_guiSettings.GetBool("myvideos.extractflags"))
{
CFileItem item(*pItem);
CStdString path(item.GetPath());
if (URIUtils::IsInRAR(item.GetPath()))
SetupRarOptions(item,path);

CThumbExtractor* extract = new CThumbExtractor(item, path, true, thumbURL);
AddJob(extract);
CThumbExtractor* extract = new CThumbExtractor(item, path, true, thumbURL);
AddJob(extract);

m_database->Close();
return true;
m_database->Close();
return true;
}
}
}

Expand Down

0 comments on commit e035ef7

Please sign in to comment.