[pitivi] Fix the Thumbnails if a clip is used more than once



commit 7812310559fc1bed85efa08775c399dc334cbb71
Author: Daniel Thul <daniel thul gmail com>
Date:   Wed Apr 17 19:10:46 2013 +0200

    Fix the Thumbnails if a clip is used more than once

 pitivi/timeline/previewers.py |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/timeline/previewers.py b/pitivi/timeline/previewers.py
index ea6a3f0..d01011c 100644
--- a/pitivi/timeline/previewers.py
+++ b/pitivi/timeline/previewers.py
@@ -51,7 +51,7 @@ class VideoPreviewer(Clutter.ScrollActor, Zoomable):
         # maps (quantized) times to Thumbnail objects
         self.thumbs = {}
 
-        self.thumb_cache = ThumbnailCache(uri=self.uri)
+        self.thumb_cache = get_cache_for_uri(self.uri)
 
         self.wishlist = []
 
@@ -341,6 +341,18 @@ def get_dir(path, autocreate=True):
     return path
 
 
+caches = {}
+
+
+def get_cache_for_uri(uri):
+    if uri in caches:
+        return caches[uri]
+    else:
+        cache = ThumbnailCache(uri)
+        caches[uri] = cache
+        return cache
+
+
 class ThumbnailCache(object):
 
     """Caches thumbnails by key using LRU policy, implemented with heapq.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]