def GetMD5Hashes(fname, force=False):
 new_encoding = True
 table = {}
 if (force or (not flag_file(os.path.split(fname)[0], QCHECK_FILE))):
  try:
   f = open(fname, 'rb')
  except:
   return (table, new_encoding)
  new_encoding = False
  try:
   header = f.read(8)
   while header:
    (name, hash) = ParseFilePacket(f, header)
    new_encoding |= is_utf8(name)
    if name:
     table[name] = hash
    header = f.read(8)
  except (struct.error, IndexError):
   logging.info('Cannot use corrupt par2 file for QuickCheck, "%s"', fname)
   table = {}
  except:
   logging.debug('QuickCheck parser crashed in file %s', fname)
   logging.info('Traceback: ', exc_info=True)
   table = {}
  f.close()
 return (table, new_encoding)

def GetMD5Hashes ( fname , force = False ) : new_encoding = True table = { } if ( force or ( not flag_file ( os . path . split ( fname ) [ 0 ] , QCHECK_FILE ) ) ) : try : f = open ( fname , 'rb' ) except : return ( table , new_encoding ) new_encoding = False try : header = f . read ( 8 ) while header : ( name , hash ) = ParseFilePacket ( f , header ) new_encoding |= is_utf8 ( name ) if name : table [ name ] = hash header = f . read ( 8 ) except ( struct . error , IndexError ) : logging . info ( 'Cannot use corrupt par2 file for QuickCheck, "%s"' , fname ) table = { } except : logging . debug ( 'QuickCheck parser crashed in file %s' , fname ) logging . info ( 'Traceback: ' , exc_info = True ) table = { } f . close ( ) return ( table , new_encoding )
get the hash table from a par2 file return as dictionary .