Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrKeyNotFound = errors.New("key not found")
ErrKeyNotFound is a sentinel error used when a queried key does not exist
var ErrNotExist = errors.New("file does not exist")
ErrNotExist is a sentinel error for non existing file
Functions ¶
This section is empty.
Types ¶
type Exiftool ¶
type Exiftool struct {
// contains filtered or unexported fields
}
Exiftool is the exiftool utility wrapper
Example ¶
et, err := exiftool.NewExiftool() if err != nil { fmt.Printf("Error when intializing: %v\n", err) return } defer et.Close() fileInfos := et.ExtractMetadata("testdata/20190404_131804.jpg") for _, fileInfo := range fileInfos { if fileInfo.Err != nil { fmt.Printf("Error concerning %v: %v\n", fileInfo.File, fileInfo.Err) continue } for k, v := range fileInfo.Fields { fmt.Printf("[%v] %v\n", k, v) } }
Output:
func NewExiftool ¶
NewExiftool instanciates a new Exiftool with configuration functions. If anything went wrong, a non empty error will be returned.
func (*Exiftool) Close ¶
Close closes exiftool. If anything went wrong, a non empty error will be returned
func (*Exiftool) ExtractMetadata ¶
func (e *Exiftool) ExtractMetadata(files ...string) []FileMetadata
ExtractMetadata extracts metadata from files
type FileMetadata ¶
FileMetadata is a structure that represents an exiftool extraction. File contains the filename that had to be extracted. If anything went wrong, Err will not be nil. Fields stores extracted fields.
func (FileMetadata) GetFloat ¶
func (fm FileMetadata) GetFloat(k string) (float64, error)
GetFloat returns a field value as float64 and an error if one occurred. KeyNotFoundError will be returned if the key can't be found.
func (FileMetadata) GetInt ¶
func (fm FileMetadata) GetInt(k string) (int64, error)
GetInt returns a field value as int64 and an error if one occurred. KeyNotFoundError will be returned if the key can't be found, ParseError if a parsing error occurs.
func (FileMetadata) GetString ¶
func (fm FileMetadata) GetString(k string) (string, error)
GetString returns a field value as string and an error if one occurred. KeyNotFoundError will be returned if the key can't be found
func (FileMetadata) GetStrings ¶
func (fm FileMetadata) GetStrings(k string) ([]string, error)
GetStrings returns a field value as []string and an error if one occurred. KeyNotFoundError will be returned if the key can't be found.