linkedimage

package
v0.0.0-...-5357ecf Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindFilesWithExt

func FindFilesWithExt(folder, extension string) []string

FindFilesWithExt recursively scans a directory for files with the specified extension

func FindImages

func FindImages(sourcesDir, exportsDir string, extensions []string) ([]*Raw, []*Xmp, []*Jpg)

List all raws, xmps, and jpgs found in the sources and exports dir Each returned object includes any linked objects that were detected

func IsDir

func IsDir(path string) (bool, error)

IsDir checks whether a path is a directory This implementation is naive, assuming anything not matching "*.*" is a directory

Types

type ImagePath

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

ImagePath provides convenience methods to access various properties of an image file's path Works for raw files, jpg files, and xmp files that follow the convention <ParentDir>/<RelativeDir>/<ImageBase>_<VSequence>.<RawExt>.xmp

func (*ImagePath) Exists

func (i *ImagePath) Exists() bool

func (*ImagePath) GetBaseDir

func (i *ImagePath) GetBaseDir() string

GetBaseDir returns the directory where image files are found

func (*ImagePath) GetBasename

func (i *ImagePath) GetBasename() string

GetBasename strips the directories and suffixes some/dir/subdir/DSC1234_01.ARW.xmp => DSC1234_01

func (*ImagePath) GetFullDir

func (i *ImagePath) GetFullDir() string

func (*ImagePath) GetFullPath

func (i *ImagePath) GetFullPath() string

func (*ImagePath) GetImageBase

func (i *ImagePath) GetImageBase() string

GetImageBase gets the base image name, without extensions or virtual copy sequences _DSc1234_01.ARW.xmp => _DSC1234

func (*ImagePath) GetRelativeDir

func (i *ImagePath) GetRelativeDir() string

GetRelativeDir returns the directory of fullPath relative to baseDir E.g. GetRelativeDir("/mnt/some/dir/filename.txt", "/mnt") -> "some/dir"

func (*ImagePath) GetRelativePath

func (i *ImagePath) GetRelativePath() string

GetRelativePath returns the value of fullPath relative to baseDir E.g. GetRelativePath("/mnt/some/dir/filename.txt", "/mnt") -> "some/dir/filename.txt"

func (*ImagePath) GetVSequence

func (i *ImagePath) GetVSequence() string

Get the base image name, without extensions or virtual copy sequences _DSc1234_01.ARW.xmp => _DSC1234

type Jpg

type Jpg struct {
	Path ImagePath
	Raw  *Raw
	Xmp  *Xmp
}

func NewJpg

func NewJpg(path ImagePath) *Jpg

func (*Jpg) Delete

func (jpg *Jpg) Delete(dryRun bool) error

func (*Jpg) GetPath

func (i *Jpg) GetPath() string

func (*Jpg) IsVirtualCopy

func (jpg *Jpg) IsVirtualCopy() bool

func (*Jpg) LinkRaw

func (jpg *Jpg) LinkRaw(raw *Raw)

func (*Jpg) LinkXmp

func (jpg *Jpg) LinkXmp(xmp *Xmp)

func (Jpg) String

func (jpg Jpg) String() string

type LinkedImage

type LinkedImage interface {
	GetPath() string
	String() string
}

type Raw

type Raw struct {
	Path ImagePath
	Xmps map[string]*Xmp
	Jpgs map[string]*Jpg
	// contains filtered or unexported fields
}

func FindRaw

func FindRaw(path, sourcesDir, exportsDir string) (*Raw, error)

FindRaw looks for a raw file at the specified path The returned object includes any linked objects that were detected

func NewRaw

func NewRaw(path ImagePath) *Raw

func (*Raw) AddJpg

func (raw *Raw) AddJpg(jpg *Jpg)

func (*Raw) AddXmp

func (raw *Raw) AddXmp(xmp *Xmp)

func (*Raw) Delete

func (raw *Raw) Delete(dryRun bool) error

func (*Raw) GetJpgPath

func (raw *Raw) GetJpgPath(jpgDir string) string

GetJpgPath gets the jpg filename for a raw file

func (*Raw) GetPath

func (i *Raw) GetPath() string

func (*Raw) GetRawExt

func (raw *Raw) GetRawExt() string

func (*Raw) StageForDeletion

func (raw *Raw) StageForDeletion(dryRun bool) error

func (Raw) String

func (raw Raw) String() string

func (*Raw) Sync

func (raw *Raw) Sync(exportParams darktable.ExportParams, dstDir string) error

Sync finds any related xmps and exports jpgs Internally, it also links the jpgs to the xmps and raws

type Xmp

type Xmp struct {
	Path ImagePath
	Raw  *Raw
	Jpg  *Jpg
}

func FindXmp

func FindXmp(path, sourcesDir, exportsDir string, extensions []string) (*Xmp, error)

FindXmp looks for an xmp file at the specified path The returned object includes any linked objects that were detected

func NewXmp

func NewXmp(path ImagePath) *Xmp

func (*Xmp) Delete

func (xmp *Xmp) Delete(dryRun bool) error

func (*Xmp) GetBasename

func (xmp *Xmp) GetBasename() string

Gets file name without directory or extension(s)

func (*Xmp) GetJpgPath

func (xmp *Xmp) GetJpgPath(jpgDir string) string

GetJpgPath gets the jpg filename for an xmp file This implementation assumes the only thing after the first "." is 'xmp' or '<raw-ext>.xmp'

func (*Xmp) GetPath

func (i *Xmp) GetPath() string

func (*Xmp) GetRawExt

func (xmp *Xmp) GetRawExt() string

GetRawExt gets the extension of the linked raw file Does not work for Adobe style xmps where raw extension is missing

func (*Xmp) IsVirtualCopy

func (xmp *Xmp) IsVirtualCopy() bool

func (*Xmp) LinkJpg

func (xmp *Xmp) LinkJpg(jpg *Jpg)

func (*Xmp) LinkRaw

func (xmp *Xmp) LinkRaw(raw *Raw)

func (*Xmp) StageForDeletion

func (xmp *Xmp) StageForDeletion(dryRun bool) error

func (Xmp) String

func (xmp Xmp) String() string

func (*Xmp) Sync

func (xmp *Xmp) Sync(exportParams darktable.ExportParams, dstDir string) error

Sync finds any relate raw and exports jpgs Internally, it also links the jpgs to the xmp and raw

Jump to

Keyboard shortcuts

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