Documentation
¶
Index ¶
- Constants
- func CloseBadgerDB(db *badger.DB)
- func ComputeFileHash(filePath string, useFastHash bool) (string, error)
- func ExtractHeicExif(r io.ReaderAt) ([]byte, error)
- func GetBadgerDBValue(db *badger.DB, hashKey string) (string, error)
- func IterateWithPrefix(db *badger.DB, prefix string) ([]string, error)
- func Md5Sum(filePath string) (string, error)
- func OpenBadgerDB(path string) (*badger.DB, error)
- func PutBadgerDB(db *badger.DB, hashKey string, fileNameValue string) error
- func ReadJpegDate(ctx context.Context, db *badger.DB, src_dirname string, options ScanOptions) ([]FileObject, []ErroredFileObject)
- func ReadVideoCreationTimeMetadata(ctx context.Context, db *badger.DB, src_dirname string, options ScanOptions) ([]FileObject, []ErroredFileObject)
- func ScanAndGenerateMd5sumFiles(ctx context.Context, db *badger.DB, dirname string, prefix string, ...)
- func ScanFiles(ctx context.Context, src_dirname string, dst_dirname string, ...)
- func SortFilesByDate(files []FileObject)
- type ErroredFileObject
- type FileObject
- type FileProcessor
- type MatchObject
- type ScanOptions
Constants ¶
View Source
const ( // FastHashThreshold is the file size limit (50 MB) above which we switch to partial hashing FastHashThreshold = 50 * 1024 * 1024 // ChunkSize is the size of the chunks to read for partial hashing (1 MB) ChunkSize = 1 * 1024 * 1024 )
Variables ¶
This section is empty.
Functions ¶
func CloseBadgerDB ¶
func ComputeFileHash ¶
ComputeFileHash calculates a hash for the file. If useFastHash is true and the file is larger than FastHashThreshold, it computes a partial hash based on the beginning, middle, and end of the file. Otherwise, it computes the full MD5.
func ExtractHeicExif ¶
ExtractHeicExif parses a HEIC file (ISOBMFF) and extracts the raw EXIF data block.
func ReadJpegDate ¶
func ReadJpegDate(ctx context.Context, db *badger.DB, src_dirname string, options ScanOptions) ([]FileObject, []ErroredFileObject)
func ReadVideoCreationTimeMetadata ¶
func ReadVideoCreationTimeMetadata(ctx context.Context, db *badger.DB, src_dirname string, options ScanOptions) ([]FileObject, []ErroredFileObject)
func ScanFiles ¶
func ScanFiles(ctx context.Context, src_dirname string, dst_dirname string, options ScanOptions)
func SortFilesByDate ¶
func SortFilesByDate(files []FileObject)
Types ¶
type ErroredFileObject ¶
type FileObject ¶
type FileObject struct {
Name string `json:"name"`
Path string `json:"path"`
DateTime time.Time `json:"date_time"`
Md5Sum string `json:"md5sum"`
}
func RemoveSourceFile ¶
func RemoveSourceFile(src_dirname string) []FileObject
type FileProcessor ¶
type FileProcessor struct {
Overwrite string
ForceCopy bool
Recursive bool
DateFmt string
UseFastHash bool
NumWorkers int
ProgressChan chan string
}
func (*FileProcessor) CopyImageFiles ¶
func (fp *FileProcessor) CopyImageFiles(ctx context.Context, srcdir string, destdir string) ([]FileObject, []ErroredFileObject, []FileObject)
func (*FileProcessor) CopyVideoFiles ¶
func (fp *FileProcessor) CopyVideoFiles(ctx context.Context, srcdir string, destdir string) ([]FileObject, []ErroredFileObject, []FileObject)
type MatchObject ¶
type MatchObject struct {
SrcFileName string `json:"src_file_name"`
DstFileName string `json:"dst_file_name"`
}
func ValidateMd5sumFiles ¶
func ValidateMd5sumFiles(ctx context.Context, src_prefix string, dst_prefix string) []MatchObject
Click to show internal directories.
Click to hide internal directories.