Documentation
¶
Index ¶
- Constants
- Variables
- func CloseDatabase() error
- func CloseLoggers() error
- func FetchKeys(limit int) []string
- func Ftoa(num float64) string
- func Hash(data []byte) string
- func Hostname() string
- func InitMagic() error
- func InitializeConsole() error
- func InitializeDatabase() error
- func InitializeLoggers(level LogLevel) error
- func JSONStamp(t time.Time) string
- func Log(msg string, level LogLevel, args ...interface{})
- func MimeType(path string) (string, error)
- func PathExists(path string) (bool, error)
- type Console
- type CrateService
- type Dir
- type DirPath
- type ExifHandler
- type FileMeta
- type FilePath
- type ImageMeta
- type LogLevel
- type Logger
- func (logger *Logger) Close() error
- func (logger *Logger) Debug(msg string, args ...interface{})
- func (logger *Logger) Error(msg string, args ...interface{})
- func (logger *Logger) Fatal(msg string, args ...interface{})
- func (logger *Logger) Info(msg string, args ...interface{})
- func (logger *Logger) Log(layout string, level LogLevel, args ...interface{})
- func (logger *Logger) SetOutputPath(path string) error
- func (logger *Logger) Warn(msg string, args ...interface{})
- type Node
- type Path
- type WalkFunc
Constants ¶
const ( UnknownHost = "unknown" JSONLayout = "2006-01-02T15:04:05-07:00" )
const Anonymous = "anonymous"
const (
ExifTimeLayout = "2006:01:02 15:04:05" // Time layout for EXIF data type
)
Variables ¶
var (
GPSTimePattern = regexp.MustCompile("\"(\\d+)/\\d+\"")
)
var (
Magic *magicmime.Magic
)
Functions ¶
func CloseLoggers ¶
func CloseLoggers() error
Close the loggers (and the open file handle) useful for defering close
func InitializeConsole ¶
func InitializeConsole() error
func InitializeDatabase ¶
func InitializeDatabase() error
Initialize the database in the config location
func InitializeLoggers ¶
Initialize the Logger objects for logging to config location
func PathExists ¶
Check if a string pathname exists (prerequsite to NewPath)
Types ¶
type Console ¶
type Console struct {
// contains filtered or unexported fields
}
Handles the writing to the console
type CrateService ¶
type CrateService struct {
// contains filtered or unexported fields
}
func (*CrateService) Backup ¶
func (service *CrateService) Backup(dirPath string)
Runs the backup utility service on a specified directory
func (*CrateService) Init ¶
func (service *CrateService) Init()
Initialize all the various services, remember to also defer close!
type Dir ¶
type DirPath ¶
type DirPath interface { Join(elem ...string) string // Join path elements to the current path List() ([]Path, error) // Return a list of the Paths in the directory Walk(walkFn WalkFunc) error // Walk a directory with the walk function Populate() // Populates the info on the dir path (does a lot of work) }
type ExifHandler ¶
type ExifHandler struct {
// contains filtered or unexported fields
}
Implements the Walker interface to retrieve all tags
func (*ExifHandler) Coordinates ¶
func (ew *ExifHandler) Coordinates() (float64, float64, error)
Helper function for the GPS Coordinates
func (*ExifHandler) DateTaken ¶
func (ew *ExifHandler) DateTaken() (time.Time, error)
Helper function for the date taken - overloads the exif library DateTime
func (*ExifHandler) GPSDateTime ¶
func (ew *ExifHandler) GPSDateTime() (time.Time, error)
Helper function to fetch the GPS date and time
type FileMeta ¶
type FileMeta struct { Node MimeType string // The mimetype of the file Name string // The base name of the file Size int64 // The size of the file in bytes Modified time.Time // The last modified time LastSeen time.Time // The last time that Crate saw the file Signature string // Base64 encoded SHA1 hash of the file Host string // The hostname of the computer Author string // The User or username of the file creator // contains filtered or unexported fields }
type FilePath ¶
type FilePath interface { IsImage() bool // The File is an image Ext() string // The extension (if a file, empty string if not) Base() string // The base name of the path Populate() // Populates the info on the file path (does a lot of work) Info() string // Returns a JSON serialized print of the file info Store() error // Store the meta data to a database }
type ImageMeta ¶
type ImageMeta struct { FileMeta Width int // Width of the image Height int // Height of the image Tags map[string]string // Image tags from the Exif data }
func ConvertImageMeta ¶
Converts a FileMeta into an ImageMeta
func (*ImageMeta) Dimensions ¶
Returns the width, hight of the image
func (*ImageMeta) GetExif ¶
func (img *ImageMeta) GetExif() (*ExifHandler, bool)
Get the EXIF Data from the JPEG
type Logger ¶
type Logger struct { Level LogLevel // The minimum log level to log at // contains filtered or unexported fields }
Wraps the log.Logger to provide custom log handling
func (*Logger) SetOutputPath ¶
Set a new log output location on the Logger
type Path ¶
type Path interface { IsDir() bool // Path is a directory IsFile() bool // Path is a file IsHidden() bool // Path is a hidden file or directory Dir() *Dir // The parent directory of the path Stat() (os.FileInfo, error) // Returns the attributes of the path User() (*user.User, error) // Returns the User object for the path String() string // The string representation of the file Byte() []byte // The byte representation of the JSON }