Documentation
¶
Index ¶
Constants ¶
const ( NotCached CacheStatus = false Cached CacheStatus = true ExtEnabled ExtState = true ExtDisabled ExtState = false )
Variables ¶
var ( ErrNoImages = errors.New("no images found in directory") ErrHashPrefixTooShort = errors.New("hash prefix must be at least 3 characters") ErrHashInfoNil = errors.New("hash info is nil; it must be initialized") ErrHashLengthTooShort = errors.New("hash length must be at least 10 characters") )
Functions ¶
func GetGoVersion ¶
func GetGoVersion() string
func GetVersion ¶
func GetVersion() string
GetVersion returns the application version set by the build process. If the binary is a dev build, then it returns a truncated version of the latest commit hash.
Types ¶
type CacheStatus ¶
type CacheStatus bool
type HashResult ¶
type HashResult struct {
// contains filtered or unexported fields
}
type Hasher ¶
type Hasher struct {
// contains filtered or unexported fields
}
func NewHasher ¶
func NewHasher(cfg HasherConfig) (*Hasher, error)
NewHasher creates a Hasher which takes a HasherConfig.
🟡 The HashConfig.Prefix should be a unique string, because it identifies which images have been renamed.
func (*Hasher) Hash ¶
func (h *Hasher) Hash( fileName string, cs CacheStatus, filePath string, callBack func(cs CacheStatus), )
type HasherConfig ¶
type HasherConfig struct {
// The smaller this is, the higher chance of collisions
Length int
// How many goroutines should be in pool
Threads int
// Queue channel minimum size
QueueSize int
// Container for hash results
HashResult *HashResult
// Should be a unique string
Prefix string
BufferSize int64
}
type ImageExtMap ¶
type ImageMap ¶
type ImageMap map[string]CacheStatus
type ImageProcessor ¶
type ImageProcessor struct {
Status *models.ProcessStatus
WorkingDir string
HasDupes bool
OpenReviewFolder bool
NovelDupePaths []string
ProcessTime time.Duration
// contains filtered or unexported fields
}
func NewImageProcessor ¶
func NewImageProcessor(cfg ImageProcessorConfig) *ImageProcessor
func (*ImageProcessor) ProcessImages ¶
func (ip *ImageProcessor) ProcessImages(useBuffer bool) error
ProcessImages calculates the hash of all images in the image map and separates out the duplicates from the new images.
func (*ImageProcessor) ProcessImagesForReview ¶
func (ip *ImageProcessor) ProcessImagesForReview(useBuffer bool) error
ProcessImagesForReview processes the images, but also moves duplicate images to a temporary "dupe review folder," for the user to review. The folder is automatically opened after the dupes are moved.
func (*ImageProcessor) RestoreFromReview ¶
func (ip *ImageProcessor) RestoreFromReview() error
RestoreFromReview restores all novel dupes back to the working directory, then deletes the dupe review folder and all its contents (the remaining dupes).
func (*ImageProcessor) UpdateImages ¶
func (ip *ImageProcessor) UpdateImages() error
UpdateImages handles renaming and deleting images that have had their hashes processed. If the type of process was a "review", then it ONLY renames the images.