[pitivi: 4/12] discoverer: generate shorter filenames for thumbnails.



commit 83fab35c8c7fc599f2804c85632138b88d79a8d3
Author: Alessandro Decina <alessandro d gmail com>
Date:   Sat Mar 6 00:52:54 2010 +0100

    discoverer: generate shorter filenames for thumbnails.
    
    Fixes some weird bugs due to file operations failing with too long filenames.

 pitivi/discoverer.py |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/pitivi/discoverer.py b/pitivi/discoverer.py
index b4894e2..e407f4e 100644
--- a/pitivi/discoverer.py
+++ b/pitivi/discoverer.py
@@ -35,7 +35,7 @@ from gst.pbutils import INSTALL_PLUGINS_SUCCESS, \
         INSTALL_PLUGINS_PARTIAL_SUCCESS, INSTALL_PLUGINS_USER_ABORT, \
         INSTALL_PLUGINS_STARTED_OK
 import tempfile
-from base64 import urlsafe_b64encode
+import hashlib
 
 from pitivi.log.loggable import Loggable
 from pitivi.factories.file import FileSourceFactory, PictureFileSourceFactory
@@ -515,8 +515,10 @@ class Discoverer(Signallable, Loggable):
 
     def _getThumbnailFilenameFromPad(self, pad):
         base = xdg_cache_home()
-        name = '%s.%s' % (self.current_uri, pad.get_name())
-        name = urlsafe_b64encode(name) + '.png'
+        name = self.current_uri
+        md5sum = hashlib.md5()
+        md5sum.update(self.current_uri)
+        name = md5sum.hexdigest() + '.png'
         directory = os.path.join(base, "pitivi")
         try:
             os.makedirs(directory)



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