meta

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	MetaType_name = map[int32]string{
		0: "Unknown",
		1: "Directory",
		2: "Image",
		3: "Video",
		4: "Audio",
		5: "Document",
		6: "Archive",
	}
	MetaType_value = map[string]int32{
		"Unknown":   0,
		"Directory": 1,
		"Image":     2,
		"Video":     3,
		"Audio":     4,
		"Document":  5,
		"Archive":   6,
	}
)

Enum value maps for MetaType.

View Source
var ErrNotDir = errors.New("not a directory")
View Source
var File_meta_meta_proto protoreflect.FileDescriptor
View Source
var File_meta_meta_type_proto protoreflect.FileDescriptor

Functions

func DateFormat added in v0.0.3

func DateFormat(str string) string
Example
package main

import (
	"fmt"

	"github.com/xuender/fmeta/meta"
)

func main() {
	fmt.Println(meta.DateFormat("2006/01/02 15:04:05"))
	fmt.Println(meta.DateFormat("2006:01:02 15:04:05"))

}
Output:

2006-01-02 15:04:05
2006-01-02 15:04:05

func ImageExif

func ImageExif(reader io.Reader) ([]exif.ExifTag, error)

Types

type Meta

type Meta struct {
	Type      MetaType `protobuf:"varint,1,opt,name=type,proto3,enum=meta.MetaType" json:"type,omitempty"`
	Subtype   string   `protobuf:"bytes,2,opt,name=subtype,proto3" json:"subtype,omitempty"`
	Extension string   `protobuf:"bytes,3,opt,name=extension,proto3" json:"extension,omitempty"`
	Datetime  string   `protobuf:"bytes,4,opt,name=datetime,proto3" json:"datetime,omitempty"`
	Size      int64    `protobuf:"varint,5,opt,name=size,proto3" json:"size,omitempty"`
	Width     int32    `protobuf:"varint,6,opt,name=width,proto3" json:"width,omitempty"`
	Height    int32    `protobuf:"varint,7,opt,name=height,proto3" json:"height,omitempty"`
	Duration  float64  `protobuf:"fixed64,8,opt,name=duration,proto3" json:"duration,omitempty"`
	Channels  int32    `protobuf:"varint,9,opt,name=channels,proto3" json:"channels,omitempty"`
	// contains filtered or unexported fields
}

Meta message.

func DirMeta

func DirMeta(path string) (*Meta, error)
Example
package main

import (
	"fmt"

	"github.com/xuender/fmeta/meta"
)

func main() {
	val, err := meta.DirMeta(".")

	fmt.Println(err)
	fmt.Println(val.GetType())

	_, err = meta.DirMeta("nofound")
	fmt.Println(err)

}
Output:

<nil>
Directory
stat nofound: no such file or directory

func FileMeta

func FileMeta(path string) (*Meta, error)
Example
package main

import (
	"fmt"

	"github.com/xuender/fmeta/meta"
)

func main() {
	val, err := meta.FileMeta("green.jpg")

	fmt.Println(err)
	fmt.Println(val.GetType())

}
Output:

<nil>
Image

func (*Meta) Descriptor deprecated

func (*Meta) Descriptor() ([]byte, []int)

Deprecated: Use Meta.ProtoReflect.Descriptor instead.

func (*Meta) GetChannels added in v0.0.2

func (x *Meta) GetChannels() int32

func (*Meta) GetDatetime

func (x *Meta) GetDatetime() string

func (*Meta) GetDuration added in v0.0.2

func (x *Meta) GetDuration() float64

func (*Meta) GetExtension

func (x *Meta) GetExtension() string

func (*Meta) GetHeight added in v0.0.2

func (x *Meta) GetHeight() int32

func (*Meta) GetSize added in v0.0.2

func (x *Meta) GetSize() int64

func (*Meta) GetSubtype

func (x *Meta) GetSubtype() string

func (*Meta) GetType

func (x *Meta) GetType() MetaType

func (*Meta) GetWidth added in v0.0.2

func (x *Meta) GetWidth() int32

func (*Meta) ProtoMessage

func (*Meta) ProtoMessage()

func (*Meta) ProtoReflect

func (x *Meta) ProtoReflect() protoreflect.Message

func (*Meta) Reset

func (x *Meta) Reset()

func (*Meta) String

func (x *Meta) String() string

type MetaType

type MetaType int32

MetaType message.

const (
	MetaType_Unknown   MetaType = 0
	MetaType_Directory MetaType = 1
	MetaType_Image     MetaType = 2
	MetaType_Video     MetaType = 3
	MetaType_Audio     MetaType = 4
	MetaType_Document  MetaType = 5
	MetaType_Archive   MetaType = 6
)

func (MetaType) Descriptor

func (MetaType) Descriptor() protoreflect.EnumDescriptor

func (MetaType) Enum

func (x MetaType) Enum() *MetaType

func (MetaType) EnumDescriptor deprecated

func (MetaType) EnumDescriptor() ([]byte, []int)

Deprecated: Use MetaType.Descriptor instead.

func (MetaType) Number

func (x MetaType) Number() protoreflect.EnumNumber

func (MetaType) String

func (x MetaType) String() string

func (MetaType) Type

Jump to

Keyboard shortcuts

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