utils

package
v0.0.0-...-51a4268 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Client = &http.Client{
	Timeout: time.Duration(timeoutFromConfig()) * time.Second,
}
View Source
var DateFormatReplacer = strings.NewReplacer("dd", "02", "mm", "01", "yyyy", "2006")

Functions

func CameraGuess

func CameraGuess(input string) string

func CopyFile

func CopyFile(src string, dst string, buffersize int, progressbar *mpb.Bar, modTime time.Time) error

func DownloadFile

func DownloadFile(filepath string, url string, progressbar *mpb.Bar) error

func FindFolderInPath

func FindFolderInPath(entirePath, directory string) (string, error)

func GetNewBar

func GetNewBar(progressBar *mpb.Progress, total int64, filename string, barType BarType) *mpb.Bar

func GetOrder

func GetOrder(sortoptions SortOptions, GetLocation locationUtil, osPathname, out, mediaDate, deviceName string) string

func ReverseLocation

func ReverseLocation(location Location) (string, error)

func Unzip

func Unzip(src string, dest string) error

Types

type BarType

type BarType int
const (
	IoTX BarType = iota
	Percentage
)

type Camera

type Camera int
const (
	GoPro Camera = iota
	DJI
	Insta360
	Android
)

func CameraGet

func CameraGet(s string) (Camera, error)

func (Camera) ToString

func (c Camera) ToString() string

type ConnectionType

type ConnectionType string
const (
	SDCard  ConnectionType = "sd_card"
	Connect ConnectionType = "connect"
)

type DurationResponse

type DurationResponse struct {
	Programs []interface{} `json:"programs"`
	Streams  []struct {
		Duration float32 `json:"duration,string"`
	} `json:"streams"`
}

type FFprobe

type FFprobe struct {
	ProgramPath string
}

func NewFFprobe

func NewFFprobe(path *string) FFprobe

func (*FFprobe) Duration

func (f *FFprobe) Duration(path string) (*DurationResponse, error)

func (*FFprobe) Frames

func (f *FFprobe) Frames(path string) (*FramesResponse, error)

func (*FFprobe) GPSLocation

func (f *FFprobe) GPSLocation(path string) (*Location, error)

func (*FFprobe) Streams

func (f *FFprobe) Streams(path string) (*StreamsResponse, error)

func (*FFprobe) VideoSize

func (f *FFprobe) VideoSize(path string) (*VideoSizeResponse, error)

type FramesResponse

type FramesResponse struct {
	Programs []interface{} `json:"programs"`
	Streams  []struct {
		Frames int `json:"nb_frames,string"`
	} `json:"streams"`
}

type GPSLocation

type GPSLocation struct {
	Format struct {
		Tags struct {
			Location string `json:"location"`
		} `json:"tags"`
	} `json:"format"`
}

type Import

type Import interface {
	Import(params ImportParams) (*Result, error)
}

type ImportParams

type ImportParams struct {
	Input, Output, CameraName string
	SkipAuxiliaryFiles        bool
	DateFormat                string
	BufferSize                int
	Prefix                    string
	DateRange                 []time.Time
	TagNames                  []string
	Connection                ConnectionType
	Sort                      SortOptions
}

type Location

type Location struct {
	Latitude  float64
	Longitude float64
}

func LocationFromEXIF

func LocationFromEXIF(photoPath string) (*Location, error)

type Result

type Result struct {
	FilesImported    int
	FilesNotImported []string
	Errors           []error
}

type ResultCounter

type ResultCounter struct {
	Errors           []error
	FilesNotImported []string
	FilesImported    int
	// contains filtered or unexported fields
}

func (*ResultCounter) Get

func (rc *ResultCounter) Get() Result

func (*ResultCounter) SetFailure

func (rc *ResultCounter) SetFailure(err error, file string)

func (*ResultCounter) SetSuccess

func (rc *ResultCounter) SetSuccess()

type SortOptions

type SortOptions struct {
	ByLocation bool
	ByCamera   bool
}

type StreamsResponse

type StreamsResponse struct {
	Streams []struct {
		Index          int    `json:"index"`
		CodecTagString string `json:"codec_tag_string"`
	} `json:"streams"`
}

type VideoSizeResponse

type VideoSizeResponse struct {
	Programs []interface{} `json:"programs"`
	Streams  []struct {
		Width      int    `json:"width"`
		Height     int    `json:"height"`
		RFrameRate string `json:"r_frame_rate"`
	} `json:"streams"`
}

type WriteCounter

type WriteCounter struct {
	Total uint64
}

func (WriteCounter) PrintProgress

func (wc WriteCounter) PrintProgress()

func (*WriteCounter) Write

func (wc *WriteCounter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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