exif

package
v0.0.0-...-aee3247 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package exif wraps the exiftool

Index

Constants

View Source
const (
	// AnyVersion is used to indicate that the caller doesn't care about
	// which version of exiftool is installed
	AnyVersion = ""
)

Variables

View Source
var (
	// ErrStop is used by TagFunc implementations to indicate that
	// the Walk process is completed
	ErrStop = errors.New("stop")
)

Functions

This section is empty.

Types

type Description

type Description struct {
	Lang string `xml:"lang,attr"`
	Text string `xml:",innerxml"`
}

Description of a given tag

type ErrToolNotFound

type ErrToolNotFound struct {
	// contains filtered or unexported fields
}

ErrToolNotFound is returned if the system doesn't have the exif tool installed of if the tool is installed but the version is not valid.

type TableInfo

type TableInfo struct {
	// Name of this table
	Name string `xml:"name,attr"`
}

TableInfo contains information about an ExIF tag table

type Tag

type Tag struct {
	Table       TableInfo     `xml:"-"`
	Writable    bool          `xml:"writable,attr"`
	Type        string        `xml:"type,attr"`
	Name        string        `xml:"name,attr"`
	Description []Description `xml:"desc"`
}

Tag contains details about an ExIF Tag

type TagFunc

type TagFunc func(Tag) error

TagFunc is used by WalkTags to iterate over all tags, users can return ErrStop error to indicate that they don't want to process further tags.

type Tool

type Tool struct {
	// contains filtered or unexported fields
}

Tool is the wrapper for exif

func Open

func Open(expectedVersion string) (*Tool, error)

Open the tool, the tool must be available in the OS PATH.

expectedVersion will control which version of the tool is used, callers can use AnyVersion to indicate that version information is not relevant

func (*Tool) WalkTags

func (t *Tool) WalkTags(ctx context.Context, handler TagFunc) error

WalkTags from -listx calling handler for each tag processed. See TagFunc for more information.

The function will abort as soon as the first error is found, if the first error is ErrStop the error is silenced, otherwise it is passed as-is, to callers.

The operation works as a stream, so it is possible that a mal-formed XML document is partially decoded, usually this is not a concern since the underlying tool will always generate valid XMLs, but if the Context is Done before the whole XML is streamed, partial data might have been processed by handler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL