Esempio n. 1
0
 def id_by_sha1(self, file):
     sha1 = sha1_by_file(file)
     print 'SHA1: %s' % sha1
     try:
         return Media.objects.filter(master_sha1=sha1)[0].pk
     except:
         return None
Esempio n. 2
0
 def id_by_sha1(self, file):
     sha1 = sha1_by_file(file)
     print 'SHA1: %s' % sha1
     try:
         return Media.objects.filter(master_sha1=sha1)[0].pk
     except:
         return None
Esempio n. 3
0
 def id_by_sha1(self, file):
     sha1 = sha1_by_file(file)
     print 'SHA1: %s' % sha1
     try:
         from alibrary.models import Media
         return Media.objects.filter(master_sha1=sha1)[0].pk
     except Exception, e:
         print "SHA1 EXCEPTION:"
         print e
         return None
Esempio n. 4
0
    def id_by_sha1(self, file):

        sha1 = sha1_by_file(file)
        log.debug(u'generated SHA1 %s for %s' % (sha1, file))

        from alibrary.models import Media
        duplicates = Media.objects.filter(master_sha1=sha1)
        if duplicates.exists():
            log.info(u'detected duplicate by SHA1 hash. pk is: %s' % duplicates[0].pk)
            return duplicates[0].pk
        else:
            log.debug(u'no duplicate by SHA1 hash.')
            return None
Esempio n. 5
0
    def id_by_sha1(self, file):

        sha1 = sha1_by_file(file)
        log.debug(u'generated SHA1 %s for %s' % (sha1, file))

        from alibrary.models import Media
        duplicates = Media.objects.filter(master_sha1=sha1)
        if duplicates.exists():
            log.info(u'detected duplicate by SHA1 hash. pk is: %s' %
                     duplicates[0].pk)
            return duplicates[0].pk
        else:
            log.debug(u'no duplicate by SHA1 hash.')
            return None
Esempio n. 6
0
 def generate_sha1(self):
     return sha1_by_file(self.master)
Esempio n. 7
0
 def generate_sha1(self):
     return sha1_by_file(self.master)