Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RelativePath ¶
RelativePath returns a path relative to the base. If a relative path could not be calculated or it contains ' ../`, returns the original path.
Types ¶
type FileItem ¶
FileItem represents a local file.
func NewFileItem ¶
type FileTracker ¶
type FileTracker interface { CacheAsAlreadyUploaded(filePath string) error IsAlreadyUploaded(filePath string) (bool, error) RemoveAsAlreadyUploaded(filePath string) error }
FileTracker represents a service to track already uploaded files.
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter is a Filter for file uploading
func (*Filter) IsAllowed ¶
IsAllowed returns if an item should be uploaded. That means:
- item is in the include pattern
- item is not in the exclude pattern
func (*Filter) IsExcluded ¶
IsExcluded return if an item should be excluded. It's useful for skipping directories that match with an exclusion.
type UploadFolderJob ¶
type UploadFolderJob struct { FileTracker FileTracker SourceFolder string CreateAlbum bool CreateAlbumBasedOn string Filter *Filter }
UploadFolderJob represents a job to upload all photos from the specified folder
func (*UploadFolderJob) ScanFolder ¶
func (job *UploadFolderJob) ScanFolder(logger log.Logger) ([]FileItem, error)
ScanFolder return the list of Items{} to be uploaded. It scans the folder and skip non allowed files (includePatterns & excludePattens).