common

package
v0.0.0-...-95de4b9 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MediaTypeImage   = "image"
	MediaTypeVideo   = "video"
	MediaTypeUnknown = "unknown"
)
View Source
const AliasTypeName = "alias"
View Source
const DuplicateTypeName = "duplicate"
View Source
const MediaTypeName = "media"

Variables

View Source
var AliasIndexName = "fp-aliases"
View Source
var AliasPathOverride = ""
View Source
var ClarifaiCacheIndexName = "clarifai_cache"
View Source
var ClarifaiTypeName = "document"
View Source
var ConfigDirectory string
View Source
var ElasticSearchServer = "http://localhost:9200"
View Source
var ExecutingDirectory string
View Source
var ExifToolPath string
View Source
var FfmpegPath string
View Source
var HomeDirectory string
View Source
var IndexMakeNoChanges = false
View Source
var IndexerPath string
View Source
var LocationCacheDirectory string
View Source
var LogDirectory string
View Source
var MediaClassifierPath string
View Source
var MediaIndexName = "media-index"
View Source
var RedisServer = "http://localhost:6379"
View Source
var ThumbnailDirectory string
View Source
var VipsThumbnailPath string

Functions

func AddWarning

func AddWarning(client *elastic.Client, id string, newWarnings []string)

func AliasForPath

func AliasForPath(path string) (string, error)

func CheckExec

func CheckExec(commandName string, args ...string) (string, error)

func ConfigureLogging

func ConfigureLogging(logDirectory, appName string)

func ConvertToCountryName

func ConvertToCountryName(code string, defValue string) string

func CreateAliasIndex

func CreateAliasIndex(client *elastic.Client) error

func CreateClarifaiClassifyIndex

func CreateClarifaiClassifyIndex(client *elastic.Client) error

func CreateClient

func CreateClient() *elastic.Client

func CreateDirectory

func CreateDirectory(directory string) error

func CreateMediaIndex

func CreateMediaIndex(client *elastic.Client) error

func DayOfYear

func DayOfYear(month, day int) int

func DayOfYearFromDate

func DayOfYearFromDate(date time.Time) int

func FileExists

func FileExists(path string) (bool, error)

func FullPathForAliasedPath

func FullPathForAliasedPath(aliased string) (string, error)

func GetIndexFieldName

func GetIndexFieldName(fieldName string) (string, bool)

func InitDirectories

func InitDirectories(appName string)

func InitializeAliases

func InitializeAliases(client *elastic.Client) error

Load all aliases

func IsExecWorking

func IsExecWorking(commandName string, args ...string) bool

func IsValidAlias

func IsValidAlias(alias string) bool

func IsValidAliasedPath

func IsValidAliasedPath(aliased string) bool

func MaxCpus

func MaxCpus(desired int) int

func NumCpus

func NumCpus() int

func PathExists

func PathExists(path string) (bool, error)

func PathForAlias

func PathForAlias(alias string) (string, error)

func RatioNumCpus

func RatioNumCpus(factor float32) int

func ToThumbPath

func ToThumbPath(aliasedPath string) string

func UpdateLastIndexed

func UpdateLastIndexed(alias string) error

func VisitAllPaths

func VisitAllPaths(callback func(alias AliasDocument))

Types

type AliasDocument

type AliasDocument struct {
	Path            string    `json:"aliaspath"`
	Alias           string    `json:"alias"`
	DateAdded       time.Time `json:"datetimeadded"`
	DateLastIndexed time.Time `json:"datetimelastindexed"`
}

type CandidateFile

type CandidateFile struct {
	FullPath      string
	AliasedPath   string
	Signature     string
	LengthInBytes int64
	Exif          ExifOutput
	Warnings      []string
}

func (*CandidateFile) AddWarning

func (cf *CandidateFile) AddWarning(warning string)

type ClassifyMessage

type ClassifyMessage struct {
	File  string `json:"file"`
	Alias string `json:"alias"`
}

type DuplicateItem

type DuplicateItem struct {
	IgnoredPath  string `json:"ignoredpath"`
	ExistingPath string `json:"existingpath"`
}

type ExifOutput

type ExifOutput struct {
	SourceFile string
	File       ExifOutputFile
	EXIF       ExifOutputExif
	IPTC       ExifOutputIptc
	Quicktime  ExifOutputQuicktime
	XMP        ExifOutputXmp
	Composite  ExifOutputComposite
}

type ExifOutputComposite

type ExifOutputComposite struct {
	GPSPosition string
}

type ExifOutputExif

type ExifOutputExif struct {
	ApertureValue    float32
	CreateDate       string
	DateTimeOriginal string
	ModifyDate       string
	ExposureProgram  string
	ExposureTime     interface{} // Sigh - sometimes a number, sometimes a string - 1 is a number, while "1/200" is a string. Probably an exiftool'ism
	Flash            string
	FNumber          float32
	FocalLength      string
	GPSLatitudeRef   string
	GPSLatitude      string
	GPSLongitudeRef  string
	GPSLongitude     string
	ISO              interface{} // Most cameras use an int, some a string (!)
	LensInfo         string
	LensModel        string
	Make             string
	Model            string
	WhiteBalance     string
}

type ExifOutputFile

type ExifOutputFile struct {
	MIMEType       string
	ImageHeight    int
	ImageWidth     int
	FileModifyDate string
}

type ExifOutputIptc

type ExifOutputIptc struct {
	Keywords interface{} // Some are []string - others are string. Exiftool seems to be the source
}

type ExifOutputQuicktime

type ExifOutputQuicktime struct {
	ContentCreateDate string
	CreateDate        string
	ModifyDate        string
	ImageWidth        int
	ImageHeight       int
	Duration          string
}

type ExifOutputXmp

type ExifOutputXmp struct {
	Subject interface{} // Some are []string - others are string. Exiftool seems to be the source
	Make    string
	Model   string
}

type GeoPoint

type GeoPoint struct {
	Latitude  float64 `json:"lat"`
	Longitude float64 `json:"lon"`
}

type Media

type Media struct {
	Signature     string `json:"signature"`
	Filename      string `json:"filename"`
	Path          string `json:"path"`
	LengthInBytes int64  `json:"lengthinbytes"`

	MimeType        string  `json:"mimetype,omitempty"`
	Width           int     `json:"width,omitempty"`
	Height          int     `json:"height,omitempty"`
	DurationSeconds float32 `json:"durationseconds,omitempty"`

	// EXIF info
	ApertureValue       float32 `json:"aperture,omitempty"`
	ExposureProgram     string  `json:"exposureprogram,omitempty"`
	ExposureTime        float32 `json:"exposuretime,omitempty"`
	ExposureTimeString  string  `json:"exposuretimestring,omitempty"`
	Flash               string  `json:"flash,omitempty"`
	FNumber             float32 `json:"fnumber,omitempty"`
	FocalLengthMm       float32 `json:"focallengthmm,omitempty"`
	Iso                 int     `json:"iso,omitempty"`
	WhiteBalance        string  `json:"whitebalance,omitempty"`
	LensInfo            string  `json:"lensinfo,omitempty"`
	LensModel           string  `json:"lensmodel,omitempty"`
	CameraMake          string  `json:"cameramake,omitempty"`
	CameraModel         string  `json:"cameramodel,omitempty"`
	OriginalCameraMake  string  `json:"originalcameramake,omitempty"`
	OriginalCameraModel string  `json:"originalcameramodel,omitempty"`

	// For arrays - see here for mappings & searching: http://stackoverflow.com/questions/26258292/querystring-search-on-array-elements-in-elastic-search
	Keywords []string `json:"keywords,omitempty"`

	// Auto-classified
	Tags *[]string `json:"tags,omitempty"`

	// Location
	Location *GeoPoint `json:"location,omitempty"`

	// Placename, from the reverse coding of the location
	LocationCountryName          string `json:"countryname,omitempty"`
	LocationCountryCode          string `json:"countrycode,omitempty"`
	LocationStateName            string `json:"statename,omitempty"`
	LocationCityName             string `json:"cityname,omitempty"`
	LocationSiteName             string `json:"sitename,omitempty"`
	LocationPlaceName            string `json:"placename,omitempty"`
	LocationHierarchicalName     string `json:"hierarchicalname,omitempty"`
	LocationDisplayName          string `json:"displayname,omitempty"`
	CachedLocationDistanceMeters int    `json:"cachedlocationdistancemeters,omitempty"` // # of meters away from stored location the placename came from (due to using caching server)

	// Date related fields
	DateTime  time.Time `json:"datetime"`  // 2009-06-15T13:45:30.0000000-07:00 'round trip pattern'
	Date      string    `json:"date"`      // yyyyMMdd - for aggregating by date
	DayName   string    `json:"dayname"`   // (Wed, Wednesday)
	MonthName string    `json:"monthname"` // (Apr, April)
	DayOfYear int       `json:"dayofyear"` // Index of the day in the year, to help with byday searches (1-366; Jan/1 = 1, Feb/29 =60, Mar/1 = 61)

	Warnings []string `json:"warnings,omitempty"`
}

func (*Media) MediaType

func (m *Media) MediaType() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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