reader

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FileTypeOther is an unkown file format.
	FileTypeOther = "unknown"
	// FileTypeYaml is a yaml file format.
	// FileTypeYaml = "yml"
	// FileTypeJpeg is a jpeg file format.
	FileTypeJpeg = "jpg"
	// FileTypePng is a png file format.
	FileTypePng = "png"
	// FileTypeRaw is a raw file format.
	FileTypeRaw = "raw"
	// FileTypeXmp is an xmp file format.
	FileTypeXmp = "xmp"
	// FileTypeAae is an aae file format.
	FileTypeAae = "aae"
	// FileTypeMovie is a movie file format.
	FileTypeMovie = "mov"
	// FileTypeHEIF High Efficiency Image File Format
	FileTypeHEIF = "heif" // High Efficiency Image File Format
)
View Source
const (
	// MimeTypeJpeg is jpeg image type
	MimeTypeJpeg = "image/jpeg"
)

Variables

View Source
var FileExtensions = map[string]string{
	".crw": FileTypeRaw,
	".cr2": FileTypeRaw,
	".nef": FileTypeRaw,
	".arw": FileTypeRaw,
	".dng": FileTypeRaw,
	".mov": FileTypeMovie,
	".avi": FileTypeMovie,

	".jpg":  FileTypeJpeg,
	".thm":  FileTypeJpeg,
	".jpeg": FileTypeJpeg,
	".xmp":  FileTypeXmp,
	".aae":  FileTypeAae,
	".heif": FileTypeHEIF,
	".heic": FileTypeHEIF,
	".3fr":  FileTypeRaw,
	".ari":  FileTypeRaw,
	".bay":  FileTypeRaw,
	".cr3":  FileTypeRaw,
	".cap":  FileTypeRaw,
	".data": FileTypeRaw,
	".dcs":  FileTypeRaw,
	".dcr":  FileTypeRaw,
	".drf":  FileTypeRaw,
	".eip":  FileTypeRaw,
	".erf":  FileTypeRaw,
	".fff":  FileTypeRaw,
	".gpr":  FileTypeRaw,
	".iiq":  FileTypeRaw,
	".k25":  FileTypeRaw,
	".kdc":  FileTypeRaw,
	".mdc":  FileTypeRaw,
	".mef":  FileTypeRaw,
	".mos":  FileTypeRaw,
	".mrw":  FileTypeRaw,
	".nrw":  FileTypeRaw,
	".obm":  FileTypeRaw,
	".orf":  FileTypeRaw,
	".pef":  FileTypeRaw,
	".ptx":  FileTypeRaw,
	".pxn":  FileTypeRaw,
	".r3d":  FileTypeRaw,
	".raf":  FileTypeRaw,
	".raw":  FileTypeRaw,
	".rwl":  FileTypeRaw,
	".rw2":  FileTypeRaw,
	".rwz":  FileTypeRaw,
	".sr2":  FileTypeRaw,
	".srf":  FileTypeRaw,
	".srw":  FileTypeRaw,
	".tif":  FileTypeRaw,
	".x3f":  FileTypeRaw,
}

FileExtensions lists all the available and supported image file formats.

Functions

func ExecuteConfigTemplate

func ExecuteConfigTemplate(data Result, pathTemplate string) (string, error)

Types

type Config

type Config struct {
	Template    string `default:"{{.Time | year}}/{{.Time | year}}-{{.Time | month}}/{{.Geo}}"`
	Destination string
}

type FilePath

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

type LatLng

type LatLng struct {
	X  float64
	Y  float64
	ID int
}

LatLng ...

func (*LatLng) Dimension

func (p *LatLng) Dimension(i int) float64

Dimension ...

func (*LatLng) Dimensions

func (p *LatLng) Dimensions() int

Dimensions ...

func (*LatLng) String

func (p *LatLng) String() string

String ...

type Locator

type Locator struct {
	Locations []string
	// contains filtered or unexported fields
}

Locator ...

func CreateLocatorFromCSV

func CreateLocatorFromCSV(csvReader io.Reader) *Locator

CreateLocatorFromCSV ...

func (*Locator) FindNearest

func (l *Locator) FindNearest(loc *LatLng) string

FindNearest finds nearest town given some coordinates

type MetaData

type MetaData struct {
	CreationDate time.Time
	Location     string
}

func NewMetaData

func NewMetaData(f *os.File, meta *FilePath, loc *Locator) (MetaData, error)

type Processor

type Processor struct {
	DB *cache.Cache
	// contains filtered or unexported fields
}

func New

func New(folders []string, l *Locator, c *Config) Processor

func (Processor) DuplicateFiles

func (p Processor) DuplicateFiles() int

func (Processor) ProcessAll

func (p Processor) ProcessAll(folders []string, loc *Locator) (map[string]Result, error)

ProcessAll reads all the files in the file tree rooted at root and returns a map from file path to the MD5 sum of the file's contents. If the directory walk fails or any read operation fails, ProcessAll returns an error. In that case, ProcessAll does not wait for inflight read operations to complete.

func (Processor) ProcessedFiles

func (p Processor) ProcessedFiles() int

func (Processor) Reset

func (p Processor) Reset()

func (Processor) Start

func (p Processor) Start() map[string]Result

Start here

func (Processor) VisitFolders

func (p Processor) VisitFolders(folders []string, done <-chan struct{}) (<-chan FilePath, <-chan error)

type Result

type Result struct {
	Path     string
	Time     time.Time
	Geo      string
	Checksum []byte
	// contains filtered or unexported fields
}

Result is the product of processing a file

Jump to

Keyboard shortcuts

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