app

package
v0.0.0-...-4b7c6e8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName = "go-media-organizer"

	IsUnix = runtime.GOOS == "linux" || runtime.GOOS == "darwin" || runtime.GOOS == "freebsd" || runtime.GOOS == "openbsd"

	MinFileSize = 1000 // 1000 B / 1 KB
	DirPerms    = 0755
	FilePerms   = 0644

	DirMetadata        = ".metadata"
	DirVideos          = "originals"
	DirImages          = "originals"
	DirVideosConverted = "converted"

	MediaTypeVideo = "video"
	MediaTypeImage = "image"

	DateFormat          = time.RFC3339
	DateTimestampFormat = "2006:01:02 15:04:05"
	DefaultTimezone     = "Europe/Berlin"

	DefaultCameraModelFallback = "Unknown"

	RegexImage       = "(?i)\\.(jpg|jpeg|gif|png|webp|tiff|tif|bmp|raw|svg|psd|ai)$"
	RegexVideo       = "(?i)\\.(mpg|wmv|avi|mov|m4v|3gp|mp4|flv|webm|ogv|ts|divx|mkv|mpeg)$"
	RegexVideoOld    = "(?i)\\.(mpg|wmv|avi|mov|m4v|3gp|flv|divx|mpeg)$"
	RegexExcludeDirs = "(?i)(\\.([a-z_0-9-]+)|/bower_components|/node_modules|/vendor|/Developer)/.*$"
	RegexScreenShot  = "(?i)(Screen Shot|Screen Record|Screenshot|Captur)"
)

Variables

This section is empty.

Functions

func FileAppend

func FileAppend(path, str string)

func FileCalcChecksum

func FileCalcChecksum(path string) string

func FileCopy

func FileCopy(src, dest string, keepAttributes bool) error

func FileFixDates

func FileFixDates(path string, creationDate time.Time, modificationDate time.Time) error

func FileMove

func FileMove(src, dest string) error

func FormatDateWithTimezone

func FormatDateWithTimezone(date time.Time, timezone string) string

func GetJsonMapValue

func GetJsonMapValue(dataMap RawJsonMap, key string) string

func HandleError

func HandleError(e error)

func IsDir

func IsDir(dir string) bool

func IsError

func IsError(e error) bool

func JsonEncodePretty

func JsonEncodePretty(v interface{}) ([]byte, error)

func MakeDirIfNotExists

func MakeDirIfNotExists(dir string)

func ParseDateWithTimezone

func ParseDateWithTimezone(layout string, value string, timezone string) (time.Time, error)

func PathExists

func PathExists(dir string) bool

func PrintLn

func PrintLn(template string, args ...interface{})

func PrintReplaceLn

func PrintReplaceLn(template string, args ...interface{})

func ToString

func ToString(val interface{}) string

func TotalBytesToString

func TotalBytesToString(b int64, useDecimalSystem bool) string

Types

type CmdFileStats

type CmdFileStats struct {
	ProcessedFiles  int
	SkippedFiles    int
	DuplicatedFiles int
	TotalSize       int64
}

func TidyUp

func TidyUp(params CmdOptions) (CmdFileStats, error)

type CmdOptions

type CmdOptions struct {
	CurrentTime   time.Time // TODO: calculate elapsed time
	SrcDir        string
	DestDir       string
	DryRun        bool
	Limit         uint
	Extensions    string
	ConvertVideos bool
	FixDates      bool
	Move          bool
	Quiet         bool
}

type ExifData

type ExifData struct {
	Data        ExifToolData
	DataDump    RawJsonMap
	DataDumpRaw string
}

type ExifToolData

type ExifToolData struct {
	// File info:
	SourceFile        string
	Directory         string
	FileName          string
	FileSize          string
	FileModifyDate    string
	FileAccessDate    string
	FileType          string
	FileTypeExtension string
	FilePermissions   string
	MIMEType          string
	// Exif / XMP info:
	Make              string
	Model             string
	Software          string
	CreatorTool       string
	CreateDate        string
	ModifyDate        string
	DateTimeOriginal  string
	DateTimeDigitized string
	ImageWidth        string
	ImageHeight       string
	ImageSize         string
	GPSAltitude       string
	GPSLatitude       string
	GPSLongitude      string
	GPSLatitudeRef    string
	GPSLongitudeRef   string
	GPSPosition       string
	GPSDateTime       string
}

type FileMeta

type FileMeta struct {
	Source            FilePathInfo
	Destination       FilePathInfo
	MetadataPath      FilePathInfo
	Size              int64
	Checksum          string
	CreationTime      string
	ModificationTime  string
	MediaType         string
	CameraModel       string
	CreationTool      string
	IsScreenShot      bool
	IsDuplication     bool
	IsAlreadyImported bool
	IsLegacyVideo     bool
	Exif              ExifData
	GPS               GPSData
}

func GetFileMetadata

func GetFileMetadata(params CmdOptions, path string, info os.FileInfo) (FileMeta, error)

type FilePathInfo

type FilePathInfo struct {
	Path      string
	Basename  string
	Dirname   string
	Extension string
}

type GPSCoord

type GPSCoord struct {
	Latitude  float64
	Longitude float64
}

type GPSData

type GPSData struct {
	Position GPSCoord
	Timezone string
}

func GPSDataParse

func GPSDataParse(gpsPosition string) GPSData

type RawJsonMap

type RawJsonMap map[string]interface{}

type TidyUpWalkFunc

type TidyUpWalkFunc func(stats *CmdFileStats, path string, info os.FileInfo, err error) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL