"""Read and write Gtkpod extended info files.""" import sha import os import types # This file is originally stolen from pypod-0.5.0 # http://superduper.net/index.py?page=pypod # and reworked significantly since then. class ParseError(Exception): """Exception for parse errors.""" pass class SyncError(Exception): """Exception for sync errors.""" pass def sha1_hash(filename): """Return an SHA1 hash on the first 16k of a file.""" import struct # only hash the first 16k hash_len = 4*4096 hash = sha.sha() size = os.path.getsize(filename) hash.update(struct.pack("