def hash_opensubtitles(video_path):
 bytesize = struct.calcsize('<q')
 with open(video_path, 'rb') as f:
  filesize = os.path.getsize(video_path)
  filehash = filesize
  if (filesize < (65536 * 2)):
   return
  for _ in range((65536 // bytesize)):
   filebuffer = f.read(bytesize)
   (l_value,) = struct.unpack('<q', filebuffer)
   filehash += l_value
   filehash &= 18446744073709551615L
  f.seek(max(0, (filesize - 65536)), 0)
  for _ in range((65536 // bytesize)):
   filebuffer = f.read(bytesize)
   (l_value,) = struct.unpack('<q', filebuffer)
   filehash += l_value
   filehash &= 18446744073709551615L
 returnedhash = ('%016x' % filehash)
 return returnedhash

def hash_opensubtitles ( video_path ) : bytesize = struct . calcsize ( '<q' ) with open ( video_path , 'rb' ) as f : filesize = os . path . getsize ( video_path ) filehash = filesize if ( filesize < ( 65536 * 2 ) ) : return for _ in range ( ( 65536 // bytesize ) ) : filebuffer = f . read ( bytesize ) ( l_value , ) = struct . unpack ( '<q' , filebuffer ) filehash += l_value filehash &= 18446744073709551615 L f . seek ( max ( 0 , ( filesize - 65536 ) ) , 0 ) for _ in range ( ( 65536 // bytesize ) ) : filebuffer = f . read ( bytesize ) ( l_value , ) = struct . unpack ( '<q' , filebuffer ) filehash += l_value filehash &= 18446744073709551615 L returnedhash = ( '%016x' % filehash ) return returnedhash
compute a hash using opensubtitles algorithm .