#------------------------------------------------------------------------------
# File:         Guano.config
#
# Description:  User-defined Composite tag definitions to extract individual entries
#               from the RIFF:Guano text block.
#
#               Requires exiftool version 12.63+
#
#               See GUANO - Grand Unified Acoustic Notation Ontology
#               https://github.com/riggsd/guano-spec/blob/master/guano_specification.md
#
#               The code itself is simply a regex match.  If other entries are needed,
#               then all that needs to be done is to copy/paste one of the blocks, change
#               the name and edit the regex
#
# Examples:
#               This will list the Make and Model from the Guano text block, if they exist
#               exiftool -config Guano.config -GuanoModel -GuanoMake /path/to/files/
#
#               Lists all the Guano entries in the Guano text block
#               exiftool -config Guano.config -Guano* /path/to/files/
#
# Revisions:    2023/06/09 - Bryan K. Williams (aka StarGeek) Created
#------------------------------------------------------------------------------

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        GuanoVersion => {
            Require => 'Guano',
            ValueConv => '$val =~ /GUANO\|Version:\s+(.*)/m ? $1 : undef',
        },
        GuanoMake => {
            Require => 'Guano',
            ValueConv => '$val =~ /Make:\s+(.*)/m ? $1 : undef',
        },
        GuanoModel => {
            Require => 'Guano',
            ValueConv => '$val =~ /Model:\s+(.*)/m ? $1 : undef',
        },
        GuanoFirmwareVersion => {
            Require => 'Guano',
            ValueConv => '$val =~ /Firmware Version:\s+(.*)/m ? $1 : undef',
        },
        GuanoSerial => {
            Require => 'Guano',
            ValueConv => '$val =~ /Serial:\s+(.*)/m ? $1 : undef',
        },
        GuanoTimestamp => {
            Require => 'Guano',
            Groups => { 2 => 'Time' },
            ValueConv => '$val =~ /Timestamp:\s+(.*)/m ? $1 : undef',
            PrintConv => '$self->ConvertDateTime($val)',
        },
        GuanoLocPosition => {
            Require => 'Guano',
            Groups => { 2 => 'Location' },
            ValueConv => '$val =~ /Loc Position:\s+(.*)/m ? $1 : undef',
            PrintConv => q{
                require Image::ExifTool::GPS;
                my @v = split ' ', $val;
                return Image::ExifTool::GPS::ToDMS($self, $v[0], 1, "N") . ', ' .
                       Image::ExifTool::GPS::ToDMS($self, $v[1], 1, "E");
            },
        },
        GuanoLocElevation => {
            Require => 'Guano',
            Groups => { 2 => 'Location' },
            ValueConv => '$val =~ /Loc Elevation:\s+(.*)/m ? $1 : undef',
        },
        GuanoTemperatureInt => {
            Require => 'Guano',
            ValueConv => '$val =~ /Temperature Int:\s+(.*)/m ? $1 : undef',
        },
        GuanoFilterHP => {
            Require => 'Guano',
            ValueConv => '$val =~ /^Filter HP:\s+(.*)/m ? $1 : undef',
        },
        GuanoAnabatBatteryVoltage => {
            Require => 'Guano',
            ValueConv => '$val =~ /Anabat\|Battery voltage:\s+(.*)/m ? $1 : undef',
        },
        GuanoAnabatMicrophone => {
            Require => 'Guano',
            ValueConv => '$val =~ /Anabat\|Microphone:\s+(.*)/m ? $1 : undef',
        },
        GuanoAnabatActivation => {
            Require => 'Guano',
            ValueConv => '$val =~ /Anabat\|Activation:\s+(.*)/m ? $1 : undef',
        },
        GuanoAnabatZcSensitivity => {
            Require => 'Guano',
            ValueConv => '$val =~ /Anabat\|Zc Sensitivity:\s+(.*)/m ? $1 : undef',
        },
        GuanoAnabatTriggerMinFreq => {
            Require => 'Guano',
            ValueConv => '$val =~ /Anabat\|Trigger min freq:\s+(.*)/m ? $1 : undef',
        },
        GuanoAnabatTriggerMaxFreq => {
            Require => 'Guano',
            ValueConv => '$val =~ /Anabat\|Trigger max freq:\s+(.*)/m ? $1 : undef',
        },
        GuanoAnabatMinEvent => {
            Require => 'Guano',
            ValueConv => '$val =~ /Anabat\|Min event:\s+(.*)/m ? $1 : undef',
        },
        GuanoAnabatTriggerWindow => {
            Require => 'Guano',
            ValueConv => '$val =~ /Anabat\|Trigger Window:\s+(.*)/m ? $1 : undef',
        },
        GuanoAnabatMaximumFileDuration => {
            Require => 'Guano',
            ValueConv => '$val =~ /Anabat\|Maximum File Duration:\s+(.*)/m ? $1 : undef',
        },
        GuanoSBVersion => {
            Require => 'Guano',
            ValueConv => '$val =~ /SB\|Version:\s+(.*)/m ? $1 : undef',
        },
        GuanoSBSpeciesAutoID => {
            Require => 'Guano',
            ValueConv => '$val =~ /SB\|Species Auto ID:\s+(.*)/m ? $1 : undef',
        },
        GuanoSpeciesAutoID => {
            Require => 'Guano',
            ValueConv => '$val =~ /Species Auto ID:\s+(.*)/m ? $1 : undef',
        },
        GuanoSpeciesManualID => {
            Require => 'Guano',
            ValueConv => '$val =~ /Species Manual ID:\s+(.*)/m ? $1 : undef',
        },
        GuanoSampleRate => {
            Require => 'Guano',
            ValueConv => '$val =~ /Samplerate:\s+(.*)/m ? $1 : undef',
        },
        GuanoLength => {
            Require => 'Guano',
            ValueConv => '$val =~ /Length:\s+(.*)/m ? $1 : undef',
        },
        GuanoTE => {
            Require => 'Guano',
            ValueConv => '$val =~ /TE:\s+(.*)/m ? $1 : undef',
        },
        GuanoSBFilterHP => {
            Require => 'Guano',
            ValueConv => '$val =~ /SB\|Filter HP:\s+(.*)/m ? $1 : undef',
        },
        GuanoNote => {
            Require => 'Guano',
            ValueConv => '$val =~ /Note:\s+(.*)/m ? $1 : undef',
        },
        GuanoSBRegion => {
            Require => 'Guano',
            ValueConv => '$val =~ /SB\|Region:\s+(.*)/m ? $1 : undef',
        },
        GuanoSBClassifier => {
            Require => 'Guano',
            ValueConv => '$val =~ /SB\|Classifier:\s+(.*)/m ? $1 : undef',
        },
    },
);
#------------------------------------------------------------------------------
1;  #end
