diff --git a/src/ipod_nano7_db.py b/src/ipod_nano7_db.py index 2b7ef8f..d9d7d10 100644 --- a/src/ipod_nano7_db.py +++ b/src/ipod_nano7_db.py @@ -1103,47 +1103,19 @@ class Nano7Database: # Compute new SHA1 hash new_hash = hashlib.sha1(lib_data).hexdigest() - # Read existing iTunesCDB to extract the header (first bytes before zlib) - if not os.path.exists(self.cdb_path): - header = b"\x00" * 244 - header = b"mhfd" + struct.pack("= 0: - break - if zlib_offset == -1: - logger.error("Could not find zlib header in iTunesCDB") - return + # Build proper mhfd header + header = bytearray(244) + header[0:4] = b"mhfd" + struct.pack_into("