cache

package
v0.0.0-...-a2ed315 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Target     string  `json:"target"`
	LastUpdate int64   `json:"last_update"`
	Photos     []Photo `json:"photos"`
}

Cache is the struct that represents a Photo cache JSON file.

func Create

func Create(target *config.Target) *Cache

Create returns an empty Cache.

func Load

func Load(conf *config.Config, target *config.Target) (*Cache, error)

Load loads a cache from a cache file. If the cache file doesn't exist exist or if the cache is too old, the cache will be updated.

func (*Cache) AnalyzeDir

func (myCache *Cache) AnalyzeDir(dir string, numWorkers int, et *exiftool.Exiftool, ignores []string) error

AnalyzeDir fills the cache with data about the JPEG images contained in the specified directory.

type Photo

type Photo struct {
	Path      string `json:"path"`
	Size      int64  `json:"size"`
	Timestamp int64  `json:"tstamp"`
	Camera    string `json:"camera"`
	Hash      string `json:"hash"`
}

Photo represents a JPEG file entry of a JSON cache "photos" property.

func AnalyzePhoto

func AnalyzePhoto(path string, info os.FileInfo, et *exiftool.Exiftool) (Photo, error)

AnalyzePhoto analyizes a JPEG files, including the Exif metadata.

func (*Photo) HasExif

func (photo *Photo) HasExif() bool

HasExif checks whether the photo has Exif metadata.

func (*Photo) HeicToJPEG

func (photo *Photo) HeicToJPEG(et *exiftool.Exiftool) error

HeicToJPEG converts an HEIC photo to the JPEG format. If the photo is not an HEIC file or if there is already a file with the same name but .jpg extension this function does nothing.

func (*Photo) RenameToExif

func (photo *Photo) RenameToExif() error

RenameToExif renames the photo according to the Exif timestamp in the YYYY-MM-DD_HH-MM-SS.jpg format.

Jump to

Keyboard shortcuts

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