medialibrary

package
v0.0.0-...-2c780d5 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashFile

func HashFile(path string) (string, error)

Types

type MediaEntry

type MediaEntry struct {
	Path        string `json:"path"`
	Description string `json:"description"`
	MimeType    string `json:"mime_type"`
	Hash        string `json:"hash"`
	ByteSize    int64  `json:"byte_size"`
}

type MediaLibrary

type MediaLibrary struct {
	Name         string        `json:"name"`
	RootDir      string        `json:"root_dir"`
	Description  string        `json:"description"`
	ImageLink    string        `json:"image,omitempty"`
	LastModified int64         `json:"last_modified"`
	CatalogFile  string        `json:"-"`
	Entries      []*MediaEntry `json:"entries"`
}

func Load

func Load(name string) (*MediaLibrary, error)

func New

func New(rootDir string, name string, description string) (*MediaLibrary, error)

func (*MediaLibrary) AddFile

func (library *MediaLibrary) AddFile(path string, size int64) error

func (*MediaLibrary) DescribeItem

func (library *MediaLibrary) DescribeItem(hash string, description string) error

func (*MediaLibrary) FindByHash

func (library *MediaLibrary) FindByHash(hash string) *MediaEntry

Attempts to locate a media entry based on the hash. If it is not found, the result will be nil

func (*MediaLibrary) GetCatalog

func (library *MediaLibrary) GetCatalog() ([]*MediaEntry, error)

func (*MediaLibrary) Ingest

func (library *MediaLibrary) Ingest() error

Recursively runs through the root directory and ensures that there's at least a key in the library metadata for that file

func (*MediaLibrary) Reload

func (library *MediaLibrary) Reload() error

func (*MediaLibrary) RemoveFile

func (library *MediaLibrary) RemoveFile(path string) error

func (*MediaLibrary) Save

func (library *MediaLibrary) Save() error

Jump to

Keyboard shortcuts

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