Skip to content
This repository
Browse code

Merge pull request #1753 from koying/fixmissinggenthumb

FIX: regenerate auto-thumb if not present
  • Loading branch information...
commit e035ef79b202cef7c1a29eba82c428db66b15f49 2 parents 0562c11 + 79178e5
jmarshallnz authored November 19, 2012

Showing 1 changed file with 28 additions and 20 deletions. Show diff stats Hide diff stats

  1. 48  xbmc/video/VideoThumbLoader.cpp
48  xbmc/video/VideoThumbLoader.cpp
@@ -250,30 +250,38 @@ bool CVideoThumbLoader::LoadItem(CFileItem* pItem)
250 250
   }
251 251
 
252 252
   // thumbnails are special-cased due to auto-generation
253  
-  if (!pItem->HasArt("thumb") && !pItem->m_bIsFolder && pItem->IsVideo())
  253
+  if (!pItem->m_bIsFolder && pItem->IsVideo())
254 254
   {
255  
-    // create unique thumb for auto generated thumbs
256  
-    CStdString thumbURL = GetEmbeddedThumbURL(*pItem);
257  
-    if (CTextureCache::Get().HasCachedImage(thumbURL))
258  
-    {
259  
-      CTextureCache::Get().BackgroundCacheImage(thumbURL);
260  
-      pItem->SetProperty("HasAutoThumb", true);
261  
-      pItem->SetProperty("AutoThumbImage", thumbURL);
262  
-      pItem->SetArt("thumb", thumbURL);
263  
-    }
264  
-    else if (g_guiSettings.GetBool("myvideos.extractthumb") &&
265  
-             g_guiSettings.GetBool("myvideos.extractflags"))
  255
+    // An auto-generated thumb may have been cached on a different device - check we have it here 
  256
+    CStdString url = pItem->GetArt("thumb");
  257
+    if (url.compare(0, 14, "image://video@") == 0 && !CTextureCache::Get().HasCachedImage(url))
  258
+      pItem->SetArt("thumb", "");
  259
+
  260
+    if (!pItem->HasArt("thumb"))
266 261
     {
267  
-      CFileItem item(*pItem);
268  
-      CStdString path(item.GetPath());
269  
-      if (URIUtils::IsInRAR(item.GetPath()))
270  
-        SetupRarOptions(item,path);
  262
+      // create unique thumb for auto generated thumbs
  263
+      CStdString thumbURL = GetEmbeddedThumbURL(*pItem);
  264
+      if (CTextureCache::Get().HasCachedImage(thumbURL))
  265
+      {
  266
+        CTextureCache::Get().BackgroundCacheImage(thumbURL);
  267
+        pItem->SetProperty("HasAutoThumb", true);
  268
+        pItem->SetProperty("AutoThumbImage", thumbURL);
  269
+        pItem->SetArt("thumb", thumbURL);
  270
+      }
  271
+      else if (g_guiSettings.GetBool("myvideos.extractthumb") &&
  272
+        g_guiSettings.GetBool("myvideos.extractflags"))
  273
+      {
  274
+        CFileItem item(*pItem);
  275
+        CStdString path(item.GetPath());
  276
+        if (URIUtils::IsInRAR(item.GetPath()))
  277
+          SetupRarOptions(item,path);
271 278
 
272  
-      CThumbExtractor* extract = new CThumbExtractor(item, path, true, thumbURL);
273  
-      AddJob(extract);
  279
+        CThumbExtractor* extract = new CThumbExtractor(item, path, true, thumbURL);
  280
+        AddJob(extract);
274 281
 
275  
-      m_database->Close();
276  
-      return true;
  282
+        m_database->Close();
  283
+        return true;
  284
+      }
277 285
     }
278 286
   }
279 287
 

0 notes on commit e035ef7

Please sign in to comment.
Something went wrong with that request. Please try again.