Vendored 5 packages from iOpenPod (TheRealSavi/iOpenPod): iTunesDB_Writer/ — binary iTunesDB generation iTunesDB_Shared/ — field defs, constants, album identity SQLiteDB_Writer/ — SQLite databases for Nano 6G/7G iTunesDB_Parser/ — play stats reading from iPod ipod_device/ — device detection, FireWire ID, capabilities Rationale: iOpenPod is a standalone iPod manager app, not a library. Pulling it as a pip dependency is heavy and confusing for users. Changes: + src/vendor/ — 77 .py files + calcHashAB.wasm (506 KB) ~ ipod_nano7_db.py — _find_iop_root() now returns src/vendor/ ~ requirements.txt — iopenpod replaced with wasmtime + pycryptodome ~ .gitignore — removed iOpenPod/ exclusion (setup.py reads requirements.txt automatically)
31 lines
935 B
Python
31 lines
935 B
Python
"""MHSD (DataSet) parser.
|
|
|
|
An MHSD contains exactly one child chunk whose type is determined by the
|
|
dataset type field at offset 0x0C (see ``constants.chunk_type_map``).
|
|
|
|
Dataset types: 1=TrackList, 2=PlaylistList, 3=PodcastList, 4=AlbumList,
|
|
5=SmartPlaylistList, 6/10=empty stubs, 8=ArtistList, 9=Genius CUID.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
import iTunesDB_Shared as idb
|
|
|
|
from ._parsing import ParseResult
|
|
from .chunk_parser import parse_children
|
|
|
|
|
|
def parse_dataset(
|
|
data: bytes | bytearray,
|
|
offset: int,
|
|
header_length: int,
|
|
chunk_length: int,
|
|
) -> ParseResult:
|
|
"""Parse an MHSD (DataSet) chunk and its single child."""
|
|
mhsd: dict[str, Any] = idb.read_fields(data, offset, "mhsd", header_length)
|
|
# MHSD always has exactly one child.
|
|
mhsd["children"], _ = parse_children(data, offset + header_length, 1)
|
|
return {"next_offset": offset + chunk_length, "data": mhsd}
|