photo

package
v0.0.0-...-3fb3620 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunCopier

func RunCopier(cfg *config.Config)

Types

type Copier

type Copier struct {
	Config *config.Config
	Photos []*Photo
	Stats  struct {
		Count   int
		Skipped int
		Size    int64
	}
	StatsMutex  sync.Mutex
	Workers     []*Worker
	CopyQueue   chan *Photo
	Context     context.Context
	CancelFunc  context.CancelFunc
	Wg          sync.WaitGroup
	ProgressBar *progressbar.ProgressBar
}

func NewCopier

func NewCopier(config *config.Config, pctx context.Context) *Copier

func (*Copier) CreateDestDirs

func (c *Copier) CreateDestDirs()

func (*Copier) IncrementSkipped

func (c *Copier) IncrementSkipped()

func (*Copier) IncrementStats

func (c *Copier) IncrementStats(size int64)

func (*Copier) InitProgressBar

func (c *Copier) InitProgressBar()

func (*Copier) Search

func (c *Copier) Search()

func (*Copier) Start

func (c *Copier) Start() error

func (*Copier) Stop

func (c *Copier) Stop()

func (*Copier) Wait

func (c *Copier) Wait()

type Photo

type Photo struct {
	Path      string
	FileName  string
	DateTaken time.Time
	Copier    *Copier
	Atime     time.Time
	Ctime     time.Time
	Mtime     time.Time
	Md5       []byte
	File      *os.File
}

func (*Photo) GetDateTaken

func (p *Photo) GetDateTaken() error

func (*Photo) GetHash

func (p *Photo) GetHash() error

func (*Photo) GetTargetPath

func (p *Photo) GetTargetPath() string

func (*Photo) Open

func (p *Photo) Open() error

type Worker

type Worker struct {
	ID     int
	Copier *Copier
}

func NewWorker

func NewWorker(id int, copier *Copier) *Worker

func (*Worker) CheckSameContents

func (w *Worker) CheckSameContents(p *Photo) bool

func (*Worker) Copy

func (w *Worker) Copy(p *Photo)

func (*Worker) Start

func (w *Worker) Start() error

Jump to

Keyboard shortcuts

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