superg / redumper

Low level CD dumper utility
GNU General Public License v3.0
200 stars 18 forks source link

[Request] Machine-Parseable Outputs #38

Open mnadareski opened 1 year ago

mnadareski commented 1 year ago

Machine-parseable outputs would be a great feature for tools to process the information that is output by Redumper. For example, MPF can parse the existing outputs, though it has to rely on some tricks in order to do so consistently.

The minimum request is to separate out the track hash data into a separate file. Preferably, in order to not break backward compatibility, this could be enabled via a feature flag. The most minimal file would be exactly what is output currently under the dat section of the log. A less minimal example would be following the Logiqx XML definition, which would look like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE datafile PUBLIC "-//Logiqx//DTD ROM Management Datafile//EN" "http://www.logiqx.com/Dats/datafile.dtd">
  <header>
    <name>--</name>
    <description>--</description>
  </header>
  <game name="track">
    <rom name="track.bin" size="0" crc="00000000" md5="d41d8cd98f00b204e9800998ecf8427e" sha1="da39a3ee5e6b4b0d3255bfef95601890afd80709" />
  </game>
</datafile>

The format of the rom above is already what is output. Given that the header and everything except the individual rom items can be statically defined, it doesn't seem like any external dependencies would be required in order to write this consistently.

If this idea were to be extended to all output image information, then a good example of another project that already does something similar would be Aaru. The outputs from an Aaru dump include a log for all messages and then a separate file called the "CICM Sidecar" that is an XML document containing basically all image metadata. The structure can be seen here (written in C#): https://github.com/aaru-dps/Aaru.CommonTypes/blob/devel/Metadata/cicm.cs

This is just an example of an output that is tailored for Aaru's uses, however. Any custom output, whether it be in XML, JSON, or even something like YAML or INI syntax would be useful for parsing.