media

package
v0.0.0-...-5cffe04 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Date: 26/06/2019 // 2023/09/11 Created By ybenel

Package media manages video library functionality Date: 26/06/2019 Created By ybenel

Date: 26/06/2019 Created By ybenel

Date: 26/06/2019 Created By ybenel

Date: 26/06/2019 Created By ybenel

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(logger *mylog.Logger, filepath string) error

Add adds a single video from a given file path.

func (*Library) AddPath

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

AddPath adds a media path to the library.

func (*Library) GetContentType

func (lib *Library) GetContentType(ext string) string

Handle Content Type Media

func (*Library) Import

func (lib *Library) Import(logger *mylog.Logger, 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(logger *mylog.Logger, filepath string)

Remove removes a single video from a given file path.

type Path

type Path struct {
	Path    string
	Prefix  string
	Private bool
}

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
	FileType    template.HTML
	Path        string
	FilePath    string
	Timestamp   time.Time
	Restricted  bool
}

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