~osomon/moovida/upicek_release_scripts

« back to all changes in this revision

Viewing changes to elisa-plugins/elisa/plugins/youtube/controller.py

  • Committer: Olivier Tilloy
  • Date: 2008-10-06 11:21:47 UTC
  • mfrom: (771.1.2 upicek_hashlib)
  • Revision ID: olivier@fluendo.com-20081006112147-key4lrmtc0f95hd0
 Fallback to md5 when hashlib is not available (python < 2.5).

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
from twisted.internet import defer
38
38
 
39
39
import os
40
 
import hashlib
 
40
 
 
41
try:
 
42
    from hashlib import md5
 
43
except ImportError:
 
44
    # hashlib is new in Python 2.5
 
45
    from md5 import md5
41
46
 
42
47
 
43
48
_ = install_translation('youtube')
64
69
def _thumbnail_file(thumbnail_uri):
65
70
    if not os.path.exists(PICTURES_CACHE):
66
71
        os.makedirs(PICTURES_CACHE, 0755)
67
 
    thumbnail = hashlib.md5(str(thumbnail_uri)).hexdigest() + '.jpg'
 
72
    thumbnail = md5(str(thumbnail_uri)).hexdigest() + '.jpg'
68
73
    return os.path.join(PICTURES_CACHE, thumbnail)
69
74
 
70
75