~cben/subdownloader/upload

« back to all changes in this revision

Viewing changes to modules/subtitlefile.py

  • Committer: Beni Cherniavsky
  • Date: 2009-06-08 20:55:53 UTC
  • Revision ID: cben@users.sf.net-20090608205553-cvs39izrv6713gc1
Fix AttributeError on python 2.6.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
import platform
23
23
if platform.python_version_tuple()[:2] == ['2','5']:
24
24
    #this is deprecated since python 2.6
25
 
    import md5
 
25
    from md5 import md5
26
26
else:
27
27
    from hashlib import md5
28
28
 
53
53
        self.rating = 0
54
54
        if not online:
55
55
            self._size = os.path.getsize(self._path)
56
 
            self._hash = md5.new(file(self._path,mode='rb').read()).hexdigest()
 
56
            self._hash = md5(file(self._path,mode='rb').read()).hexdigest()
57
57
 
58
58
#    def __repr__(self):
59
59
#        return "<SubtitleFile online: %s, local: %s, path: %s, file: %s, size: %s, uploader: %s, onlineId: %s, hash: %s, language: %s, rating: %f>"% (self.isOnline(), self.isLocal(), self.getFilePath(), self.getFileName(), self.getSize(), self.getUploader(), self.getIdOnline(), self.getHash(), self.getLanguageXXX(), self.getRating())