Documentation ¶
Index ¶
- Variables
- type Option
- func WithDestinationDirectory(d string) Option
- func WithDetectDuplicates() Option
- func WithDryRun() Option
- func WithFileTypes(t []string) Option
- func WithInputFileMagicSignature() Option
- func WithLastModifiedFallback() Option
- func WithOutputFileMagicSignature() Option
- func WithOverwriteExisting() Option
- func WithRegexBlocklist(d []string) Option
- func WithSourceDirectory(s string) Option
- func WithStopOnError() Option
- func WithTimestampAsFilename() Option
- type Sorter
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultFileTypes are the default media types handled by the sorter if none are specified. // NOTE: This default list should match the known mediatypes in the ./internal/mediatype package. DefaultFileTypes = []string{ mediatype.JPEG{}.String(), mediatype.PNG{}.String(), mediatype.HEIF{}.String(), mediatype.TIFF{}.String(), mediatype.QTFF{}.String(), mediatype.MP4{}.String(), } // DefaultBlocklist are default regexes that are ignored by the sorter. DefaultBlocklist = []*regexp.Regexp{ regexp.MustCompile(`(\/)?\d{4}\/(\d{2}\/){2}`), } )
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option is a param that can be used to configure the media metadata sorter.
func WithDestinationDirectory ¶
WithDestinationDirectory is an absolute or relative filepath where sorted media will be saved to.
func WithDetectDuplicates ¶
func WithDetectDuplicates() Option
WithDetectDuplicates will use perception hash algorithm of each file to determine whether to images with the same EXIF metadata are duplicate files.
func WithFileTypes ¶
WithFileTypes is an array of filetypes that we intend to locate. Extensions are matched case-insensitive. *.jpg is treated the same as *.JPG, etc. Can handle any file type; not just EXIF-enabled file types when used in conjunction with WithUseLastModifiedDate().
func WithInputFileMagicSignature ¶
func WithInputFileMagicSignature() Option
WithInputFileMagicSignature instructs the sorter to idenitify media files using the file's magic signature ignoring the exisiting file extension on the media. See the manual page for file(1) to understand how this works.
func WithLastModifiedFallback ¶
func WithLastModifiedFallback() Option
WithLastModifiedFallback instructs the sorter to fallback to using the file's last modified date if there is no media metadata. If false, images without media metadata data are ignored
func WithOutputFileMagicSignature ¶
func WithOutputFileMagicSignature() Option
WithOutputFileMagicSignature instructs the sorter to use the known file signature when saving the output file. See the manual page for file(1) to understand how this works.
func WithOverwriteExisting ¶
func WithOverwriteExisting() Option
WithOverwriteExisting instructs the sorter to overwrite any existing files that may already exist with the same desired destination file name Warning: Can be useful for removing duplicates by ensuring no two files with the same timestamp can exist, however, can cause data loss if not careful
func WithRegexBlocklist ¶
WithRegexBlocklist is an array of regular expressions for matching on paths to ignore when finding folders. Directory are matched case-insensitive
func WithSourceDirectory ¶
WithSourceDirectory is an absolute or relative filepath where sorted media will looked for.
func WithStopOnError ¶
func WithStopOnError() Option
WithStopOnError instructs the sorter to exit quickly when any error occurs during walking the directory tree
func WithTimestampAsFilename ¶
func WithTimestampAsFilename() Option
WithTimestampAsFilename instructs the sorter to rename the source file using it's timestamp and file extension. Note: This option can help eliminate duplicate images during sorting.