INNER CODE UNIT · Python
get_checksums
mdeff/fma · creation.py:169
def get_checksums(base_dir, filepaths):
"""Checksums are assumed to be stored in order for efficiency."""
checksums = []
with open(os.path.join(dst_dir, base_dir, 'checksums')) as f:
for filepath in filepaths:
exist = False
for line in f:
if filepath == line[42:-1]:
exist = True
break
if not exist:
raise ValueError('checksum not found: {}'.format(filepath))
checksums.append(line)
return checksums
def create_zip(zip_filename, base_dir, filepaths):
# Audio: all compressions are the same.