Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • The file(1) program has a magic(5) database that talks about byte offsets and bit positions. You could probably start with that format and add in more semantic hooks about what to do when you get there.

    Or, a more perlish solution would be to define "unpack" values for byte offsets and bit positions.

    --
    • Randal L. Schwartz
    • Stonehenge
    • You mean a more C-ish solution? :)

      magic(5) looks for specific things at specific places, and I need a little bit of logic. For instance, in the iTunes file, the first 100 bytes or so may have fixed meaning, but after that there are variable length blocks, so the offsets now have offsets. I will have to think about that.

      I might be able to describe things in terms of pseudo-pack type things, but that would require a lot of byte-fiddling I think since some of the values are odd numbers of bytes. That may seem strange at first, but when you save a handful of bytes for every one of the thousands of songs in the database, it adds up.

      I think a couple of the values within the variable length blocks also have variable length---actually, I know they do. I cannot really create an unpack string without parsing the block, can I?