courgette

package
v0.0.0-...-c07e436 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2016 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package courgette contains everything necessary to manage a bunch of photos using their metadata. Useful if you organize your picture with a different folder for each month.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

type Collection struct {
	Config
	Contents []SubDirectory
}

Collection represents a collection of Pictures

func (*Collection) AnalyzeContents

func (c *Collection) AnalyzeContents(subdir string) (numFiles int, err error)

AnalyzeContents of a given subdirectory.

func (*Collection) GetSubDir

func (c *Collection) GetSubDir(subdir string) (SubDirectory, error)

GetSubDir returns the SubDirectory from its name

func (*Collection) Import

func (c *Collection) Import(from string) (numImported int, err error)

Import from card.

func (*Collection) Refresh

func (c *Collection) Refresh(subdir string) (numRenamed int, err error)

Refresh filenames in a given subdirectory.

func (*Collection) SortNew

func (c *Collection) SortNew() (numSorted int, err error)

SortNew Pictures in the incoming directory.

type Config

type Config struct {
	Root       string
	Incoming   string
	Cameras    map[string]string
	Lenses     map[string]string
	NameFormat string
	GroupBy    string // month, year, other??
}

Config holds all input necessary to deal with a Collection

func (*Config) Check

func (c *Config) Check() (err error)

Check the configuration.

func (*Config) CheckValidCardReader

func (c *Config) CheckValidCardReader(cardName string) (fullPath string, err error)

CheckValidCardReader makes sure the card is mounted and exists.

func (*Config) Load

func (c *Config) Load(configPath string) (err error)

Load the configuration.

func (*Config) String

func (c *Config) String() (desc string)

String displays Config information.

type Picture

type Picture struct {
	goexiftool.MediaFile
	// TODO instead of Parent, subdir ie filepath.Rel(root, parent(filename))
	Parent        string
	NewFilename   string
	Hash          string
	IsBW          bool
	Number        int
	Version       int
	FormattedDate string
	ID            string
	Camera        string
	Lens          string
	Extension     string
	Analyzed      bool
}

Picture can manipulate a picture file.

func NewPicture

func NewPicture(filename string, isBW bool, number int, version int, id string, extension string) (p *Picture, err error)

NewPicture initializes a Picture and parses its metadata with exiftool.

func (*Picture) Analyze

func (p *Picture) Analyze(c Collection) (err error)

Analyze a Picture to get its metadata and filename information.

func (*Picture) ComputeHash

func (p *Picture) ComputeHash() (err error)

ComputeHash calculates the hash of the Picture file.

func (*Picture) ConvertToBW

func (p *Picture) ConvertToBW() (err error)

ConvertToBW a color Picture.

func (*Picture) Diff

func (p *Picture) Diff(otherP Picture) (isSame bool, diffText string, err error)

Diff compares two Pictures.

func (*Picture) IsNew

func (p *Picture) IsNew(c Config) (isNew bool)

IsNew is true if it is.

func (*Picture) Rename

func (p *Picture) Rename(c Collection) (wasRenamed bool, err error)

Rename a Picture from metadata.

func (*Picture) Rotate

func (p *Picture) Rotate() (err error)

Rotate losslessly the Picture.

type Pictures

type Pictures []Picture

Pictures is a list of Pictures.

func (*Pictures) HasID

func (p *Pictures) HasID(id string) (hasID bool)

HasID checks if a list of Pictures contains one with a specific ID.

func (Pictures) Len

func (p Pictures) Len() int

func (Pictures) Less

func (p Pictures) Less(i, j int) bool

func (Pictures) Swap

func (p Pictures) Swap(i, j int)

type SubDirectory

type SubDirectory struct {
	Name     string
	Jpgs     Pictures
	BwJpgs   Pictures
	RawFiles Pictures
	Analyzed bool
}

SubDirectory contains JPGs, B/W JPGs, and raw files.

func (*SubDirectory) Analyze

func (s *SubDirectory) Analyze(c Collection) (numFiles int, err error)

Analyze of a given subdirectory.

func (*SubDirectory) FindOrphans

func (s *SubDirectory) FindOrphans(c Collection) (orphans Pictures, err error)

FindOrphans in a given subdirectory

Jump to

Keyboard shortcuts

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