Documentation ¶
Index ¶
- Variables
- func Api(apiValue string) func(*Exiftool) error
- func BackupOriginal() func(*Exiftool) error
- func Buffer(buf []byte, max int) func(*Exiftool) error
- func Charset(charset string) func(*Exiftool) error
- func ClearFieldsBeforeWriting() func(*Exiftool) error
- func CoordFormant(format string) func(*Exiftool) error
- func DateFormant(format string) func(*Exiftool) error
- func ExtractAllBinaryMetadata() func(*Exiftool) error
- func ExtractEmbedded() func(*Exiftool) error
- func NoPrintConversion() func(*Exiftool) error
- func PrintGroupNames(groupNumbers string) func(*Exiftool) error
- func SetExiftoolBinaryPath(p string) func(*Exiftool) error
- type Exiftool
- type FileMetadata
- func (fm FileMetadata) Clear(k string)
- func (fm FileMetadata) ClearAll()
- func (fm FileMetadata) GetFloat(k string) (float64, error)
- func (fm FileMetadata) GetInt(k string) (int64, error)
- func (fm FileMetadata) GetString(k string) (string, error)
- func (fm FileMetadata) GetStrings(k string) ([]string, error)
- func (fm FileMetadata) SetFloat(k string, v float64)
- func (fm FileMetadata) SetInt(k string, v int64)
- func (fm FileMetadata) SetString(k string, v string)
- func (fm FileMetadata) SetStrings(k string, v []string)
Constants ¶
This section is empty.
Variables ¶
var ErrBufferTooSmall = errors.New("exiftool's buffer too small (see Buffer init option)")
ErrBufferTooSmall is a sentinel error that is returned when the buffer used to store Exiftool's output is too small.
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
var ErrNotFile = errors.New("can't extract metadata from folder")
ErrNotFile is a sentinel error that is returned when a folder is provided instead of a rerular file
var WaitTimeout = time.Second
WaitTimeout specifies the duration to wait for exiftool to exit when closing before timing out
Functions ¶
func Api ¶ added in v1.9.0
Api defines an -api value to pass to Exiftool, see https://www.exiftool.org/exiftool_pod.html#Advanced-options Sample :
e, err := NewExiftool(Api("QuickTimeUTC"))
func BackupOriginal ¶ added in v1.7.0
BackupOriginal backs up the original file when writing the file metadata instead of overwriting the original (activates Exiftool's '-overwrite_original' parameter) Sample :
e, err := NewExiftool(BackupOriginal())
func Buffer ¶ added in v1.1.2
Buffer defines the buffer used to read from stdout and stderr, see https://golang.org/pkg/bufio/#Scanner.Buffer Sample :
buf := make([]byte, 128*1000) e, err := NewExiftool(Buffer(buf, 64*1000))
func Charset ¶ added in v1.1.2
Charset defines the -charset value to pass to Exiftool, see https://exiftool.org/faq.html#Q10 and https://exiftool.org/faq.html#Q18 Sample :
e, err := NewExiftool(Charset("filename=utf8"))
func ClearFieldsBeforeWriting ¶ added in v1.7.0
ClearFieldsBeforeWriting will clear existing fields (e.g. tags) in the file before writing any new tags Sample :
e, err := NewExiftool(ClearFieldsBeforeWriting())
func CoordFormant ¶ added in v1.8.0
CoordFormant defines the -coordFormat value to pass to Exiftool, see https://exiftool.org/ExifTool.html#CoordFormat Sample :
e, err := NewExiftool(CoordFormant("%+f"))
func DateFormant ¶ added in v1.8.0
DateFormant defines the -dateFormat value to pass to Exiftool, see https://exiftool.org/ExifTool.html#DateFormat Sample :
e, err := NewExiftool(DateFormant("%s"))
func ExtractAllBinaryMetadata ¶ added in v1.6.0
ExtractAllBinaryMetadata extracts all binary metadata (activates Exiftool's '-b' paramater) Sample :
e, err := NewExiftool(ExtractAllBinaryMetadata())
func ExtractEmbedded ¶ added in v1.5.0
ExtractEmbedded extracts embedded metadata from files (activates Exiftool's '-ee' paramater) Sample :
e, err := NewExiftool(ExtractEmbedded())
func NoPrintConversion ¶ added in v1.4.0
NoPrintConversion enables 'No print conversion' mode, see https://exiftool.org/exiftool_pod.html. Sample :
e, err := NewExiftool(NoPrintConversion())
func PrintGroupNames ¶ added in v1.10.0
PrintGroupNames prints the group names for each tag based on the pass group number(s), (activates Exiftool's '-G' paramater) Sample :
e, err := NewExiftool(PrintGroupNames("0"))
func SetExiftoolBinaryPath ¶ added in v1.6.1
SetExiftoolBinaryPath sets exiftool's binary path. When not specified, the binary will have to be in $PATH Sample :
e, err := NewExiftool(SetExiftoolBinaryPath("/usr/bin/exiftool"))
Types ¶
type Exiftool ¶
type Exiftool struct {
// contains filtered or unexported fields
}
Exiftool is the exiftool utility wrapper
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
func (*Exiftool) WriteMetadata ¶ added in v1.7.0
func (e *Exiftool) WriteMetadata(fileMetadata []FileMetadata)
WriteMetadata writes the given metadata for each file. Any errors will be saved to FileMetadata.Err Note: If you're reusing an existing FileMetadata instance,
you should nil the Err before passing it to WriteMetadata
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 EmptyFileMetadata ¶ added in v1.7.0
func EmptyFileMetadata() FileMetadata
EmptyFileMetadata creates an empty FileMetadata struct
func (FileMetadata) Clear ¶ added in v1.7.0
func (fm FileMetadata) Clear(k string)
Clear removes value for a specific metadata field
func (FileMetadata) ClearAll ¶ added in v1.7.0
func (fm FileMetadata) ClearAll()
ClearAll removes all medatadata
func (FileMetadata) GetFloat ¶ added in v1.1.1
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 ¶ added in v1.1.1
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 ¶ added in v1.1.1
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 ¶ added in v1.1.1
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.
func (FileMetadata) SetFloat ¶ added in v1.7.0
func (fm FileMetadata) SetFloat(k string, v float64)
SetFloat sets a float value for a specific field
func (FileMetadata) SetInt ¶ added in v1.7.0
func (fm FileMetadata) SetInt(k string, v int64)
SetInt sets a int value for a specific field
func (FileMetadata) SetString ¶ added in v1.7.0
func (fm FileMetadata) SetString(k string, v string)
SetString sets a string value for a specific field
func (FileMetadata) SetStrings ¶ added in v1.7.0
func (fm FileMetadata) SetStrings(k string, v []string)
SetStrings sets a []String value for a specific field