importer

package
v0.0.0-...-5b89c12 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: MIT Imports: 9 Imported by: 0

README

importer

Importer module is in charge of importing new media in the database.

It primaraly:

  • extract media creation date
  • move file in date base file tree
  • insert entry in the database

TODO:

  • Importer ignore RAW files
  • JPG importer move RAW files at the same location
  • delete RAW files when jpg do not exist anymore in the same folder

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCreationDate

func GetCreationDate(fs afero.Fs, fname string) (time.Time, error)

GetCreationDate extract creation date from exif infos

Types

type Importer

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

func New

func New(fs afero.Fs, src string, processor Processor) (importer Importer)

func (Importer) Import

func (i Importer) Import() error

Start importing files from source in go routines. Import should be called only once, after having build a chain of processors using WrapedIn() and Then().

func (Importer) ImportFiles

func (i Importer) ImportFiles(fileNames []string)

ImportFiles get a list of files and run processor on them.

func (Importer) Logger

func (i Importer) Logger() *log.Logger

func (Importer) Then

func (i Importer) Then(processor Processor) Importer

Then creates a new Importer that will execute this importer processor on the result of the processor passed as argument.

type Processor

type Processor func(ctx context.Context, importer Importer, filename string) (processedFilename string, err error)

Processor is a function that process an image read from disk

func PLogFilename

func PLogFilename(beforeString string, afterString string) Processor

PLogFilename print to the importer logger the beforeString filename and afterString

func PMoveToDateFolder

func PMoveToDateFolder(destPath string) Processor

PMoveToDateFolder move file to destination directory, into a folder correspoding to the photo creation date.

Jump to

Keyboard shortcuts

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