media

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package media manages video library functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Library

type Library struct {
	Paths  map[string]*Path
	Videos map[string]*Video
	// contains filtered or unexported fields
}

Library manages importing and retrieving video data.

func NewLibrary

func NewLibrary() *Library

NewLibrary returns new instance of Library.

func (*Library) Add

func (lib *Library) Add(fp string) error

Add adds a single video from a given file path.

func (*Library) AddPath added in v0.1.0

func (lib *Library) AddPath(p *Path) error

AddPath adds a media path to the library.

func (*Library) Import

func (lib *Library) Import(p *Path) error

Import adds all valid videos from a given path.

func (*Library) Playlist

func (lib *Library) Playlist() Playlist

Playlist returns a sorted Playlist of all videos.

func (*Library) Remove

func (lib *Library) Remove(fp string)

Remove removes a single video from a given file path.

type Path added in v0.1.0

type Path struct {
	Path   string
	Prefix string
}

Path represents a media library path.

type Playlist

type Playlist []*Video

Playlist holds an array of videos capable of sorting by Timestamp.

func (Playlist) Len

func (p Playlist) Len() int

Len returns length of array (for sorting).

func (Playlist) Less

func (p Playlist) Less(i, j int) bool

Less returns true if p[i] Timestamp is after p[j] (for sorting).

func (Playlist) Swap

func (p Playlist) Swap(i, j int)

Swap swaps two values in array by index (for sorting).

type Video

type Video struct {
	ID          string
	Title       string
	Album       string
	Description string
	Thumb       []byte
	ThumbType   string
	Modified    string
	Size        int64
	Path        string
	Timestamp   time.Time
}

Video represents metadata for a single video.

func ParseVideo

func ParseVideo(p *Path, name string) (*Video, error)

ParseVideo parses a video file's metadata and returns a Video.

Jump to

Keyboard shortcuts

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