[pitivi] previewers: Use the new binary_search method



commit b5a0c7631091bc4721f4711b0f0bdd70384dc9af
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Sun Dec 8 10:57:59 2013 +0100

    previewers: Use the new binary_search method

 pitivi/timeline/previewers.py |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/pitivi/timeline/previewers.py b/pitivi/timeline/previewers.py
index ef04dec..92691b5 100644
--- a/pitivi/timeline/previewers.py
+++ b/pitivi/timeline/previewers.py
@@ -30,7 +30,6 @@ import os
 import pickle
 import resource
 import sqlite3
-import bisect
 
 # Our C module optimizing waveforms rendering
 import renderer
@@ -38,10 +37,10 @@ import renderer
 from pitivi.settings import get_dir, xdg_cache_home
 from pitivi.utils.signal import Signallable
 from pitivi.utils.loggable import Loggable
+from pitivi.utils.misc import binary_search, filename_from_uri, quantize, quote_uri, hash_file, print_ns
 from pitivi.utils.timeline import Zoomable
-from pitivi.utils.ui import EXPANDED_SIZE
-from pitivi.utils.misc import filename_from_uri, quantize, quote_uri, hash_file, print_ns
 from pitivi.utils.ui import CONTROL_WIDTH
+from pitivi.utils.ui import EXPANDED_SIZE
 
 
 WAVEFORMS_CPU_USAGE = 30 * multiprocessing.cpu_count()
@@ -396,9 +395,9 @@ class VideoPreviewer(Clutter.ScrollActor, PreviewGenerator, Zoomable, Loggable):
         else:
             sorted_times = self.thumbs.keys()
             sorted_times.sort()
-            index = bisect.bisect(sorted_times, time)
+            index = binary_search(sorted_times, time)
             time = sorted_times[index]
-            thumb = self.thumbs[sorted_times[index]]
+            thumb = self.thumbs[time]
             if thumb.has_pixel_data and len(sorted_times) > index + 1:
                 # It might actually be the follwoing thumbnail we were
                 time = sorted_times[index + 1]


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