Documentation ¶
Index ¶
- func AppendCsv(fpath, line string) error
- func CheckExtensions(checkvideo, checkother bool, pathcfg *config.PathsConfig, ext string) (bool, bool)
- func CheckFileExist(fpath string) bool
- func CheckFileSizeRecent(fpath string, sourcepathCfg *config.PathsConfig) bool
- func CleanUpFolder(folder string, cleanupsizeMB int) error
- func Filterfile(pathv string, useother bool, setpathcfg *config.PathsConfig) bool
- func Filterfiles(pathv *string, filedata *NewFileData) bool
- func MoveFileDriveBuffer(sourcePath, destPath string, chmod fs.FileMode) error
- func RemoveFile(file string) (bool, error)
- type MoveResponse
- type NewFileData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendCsv ¶
AppendCsv appends a line to the CSV file at fpath. It opens the file for appending, creating it if needed, with permissions 0777. It writes the line to the file with a newline separator. It handles logging and returning any errors.
func CheckExtensions ¶
func CheckExtensions(checkvideo, checkother bool, pathcfg *config.PathsConfig, ext string) (bool, bool)
CheckExtensions checks if the given file extension is allowed for the provided checkvideo and checkother booleans. It returns a bool for if the extension is allowed, and a bool for if renaming should be skipped.
func CheckFileExist ¶
CheckFileExist checks if the file exists at the given file path. It returns true if the file exists, and false if there is an error indicating the file does not exist.
func CheckFileSizeRecent ¶
func CheckFileSizeRecent(fpath string, sourcepathCfg *config.PathsConfig) bool
CheckFileSizeRecent checks if the file at fpath is recent and meets the minimum size requirements from the PathsConfig. It returns true if the file is too small or older than 2 minutes, which indicates it should be skipped.
func CleanUpFolder ¶
CleanUpFolder walks the given folder path to calculate total size. It then compares total size to given cleanup threshold in MB. If folder size is less than threshold, folder is deleted. Returns any error encountered.
func Filterfile ¶
func Filterfile(pathv string, useother bool, setpathcfg *config.PathsConfig) bool
Filterfile checks if a file path matches the allowed extensions and is not in the blocked paths. It takes the file path, a bool indicating if it is an "other" non-video file, and a PathsConfig struct containing the allowed/blocked extensions and paths. It returns a bool indicating if the path is allowed.
func Filterfiles ¶
func Filterfiles(pathv *string, filedata *NewFileData) bool
Filterfiles checks if the given path should be filtered based on the provided media type config and paths config. It checks the useseries lists in the config to see if the path is in the allowed files or unmatched files lists. It also calls Filterfile to check the ignore/filter rules if checkfiles is true. Returns true if the path should be filtered/ignored.
func MoveFileDriveBuffer ¶
MoveFileDriveBuffer moves the file at sourcePath to destPath using a buffer, sets the file permissions to chmod, and deletes the original source file after a successful copy. Returns any error.
func RemoveFile ¶
RemoveFile removes the file at the given path if it exists. It checks if the file exists first before removing. Returns a bool indicating if the file was removed, and an error if one occurred.
Types ¶
type MoveResponse ¶
type MoveResponse struct { // NewPath is the new path of the moved file NewPath string // Err contains any error that occurred during the move Err error // MoveDone indicates if the move was successful MoveDone bool }
MoveResponse represents the response from moving a file It contains the new path of the moved file, any error that occurred, and a bool indicating if the move was successful
func MoveFile ¶
func MoveFile(file string, setpathcfg *config.PathsConfig, target, newname string, useother, usenil, usebuffercopy bool, chmodfolder, chmod string) MoveResponse
MoveFile moves a file from one path to another. It handles checking extensions, renaming, setting permissions etc. It returns a bool indicating if the move was successful, and an error.
type NewFileData ¶
type NewFileData struct { Cfgp *config.MediaTypeConfig PathCfg *config.PathsConfig Listid int Checkfiles bool AddFound bool }