content

package
v0.0.0-...-01875d1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2019 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const FingerprintSep = '|'

Variables

View Source
var Movie = Class{
	Name: "movie",
	Constraints: map[string]*regexp.Regexp{
		"title":    regexp.MustCompile(`\w+`),
		"director": regexp.MustCompile(`\w+`),
		"year":     regexp.MustCompile(`\d{4}`),
		"duration": regexp.MustCompile(`[\d:]+`),
	},
	Minimum: map[string]int{
		"title": 1,
		"year":  1,
	},
	IndexBy: []string{
		"title",
	},
	Path: func(m map[string][]string) string {
		return fmt.Sprintf("%s (%s)", m["title"], m["year"])
	},
	Fingerprint: []string{
		"title",
		"director",
		"year",
	},
}
View Source
var Music = Class{
	Name: "music",
	Constraints: map[string]*regexp.Regexp{
		"title":       regexp.MustCompile(`\w+`),
		"artist":      regexp.MustCompile(`\w+`),
		"album":       regexp.MustCompile(`\w+`),
		"albumartist": regexp.MustCompile(`\w+`),
		"genre":       regexp.MustCompile(`\w+`),
		"mood":        regexp.MustCompile(`\w+`),
		"number":      regexp.MustCompile(`\d+`),
		"duration":    regexp.MustCompile(`\d+`),
	},
	Minimum: map[string]int{
		"title":  1,
		"artist": 1,
	},
	IndexBy: []string{
		"title",
		"artist",
		"albumartist",
	},
	Path: func(m map[string][]string) string {
		aslice := m["albumartist"]
		if len(aslice) < 1 {
			aslice = m["artist"]
		}
		aa := aslice[0]
		if len(m["album"]) < 1 {
			return fmt.Sprintf("%s/%s", aa, m["title"][0])
		}
		return fmt.Sprintf("%s/%s/%s", aa, m["album"][0], m["title"][0])
	},
	Fingerprint: []string{
		"artist",
		"title",
	},
}
View Source
var TV = Class{
	Name: "tv",
	Constraints: map[string]*regexp.Regexp{
		"title":    regexp.MustCompile(`\w+`),
		"show":     regexp.MustCompile(`\w+`),
		"director": regexp.MustCompile(`\w+`),
		"season":   regexp.MustCompile(`\d+`),
		"number":   regexp.MustCompile(`\d+`),
		"year":     regexp.MustCompile(`\d{4}`),
		"duration": regexp.MustCompile(`[\d:]+`),
	},
	Minimum: map[string]int{
		"show":   1,
		"season": 1,
		"number": 1,
	},
	IndexBy: []string{
		"show",
	},
	Path: func(m map[string][]string) string {
		return fmt.Sprintf("%s (%s)", m["title"], m["year"])
	},
	Fingerprint: []string{
		"show",
		"season",
		"number",
	},
}

Functions

func NewIdea

func NewIdea(contentClass string, tags []Tag) (Idea, []Tag, error)

Types

type AudioInfo

type AudioInfo struct {
	BitsPerSample uint8
	Channels      uint8
	SampleRate    uint32
}

type Blob2IdeaAdapter

type Blob2IdeaAdapter struct {
	Bs blobs.Blobstore
}

func (*Blob2IdeaAdapter) Get

func (a *Blob2IdeaAdapter) Get(id blobs.ID) (Idea, error)

func (*Blob2IdeaAdapter) Put

func (a *Blob2IdeaAdapter) Put(idea Idea) (blobs.ID, error)

func (*Blob2IdeaAdapter) Scan

func (a *Blob2IdeaAdapter) Scan(f func(blobs.ID, Idea) bool) error

type Blob2ReprAdapter

type Blob2ReprAdapter struct {
	Bs blobs.Blobstore
}

func (*Blob2ReprAdapter) Get

func (a *Blob2ReprAdapter) Get(id blobs.ID) (*Repr, error)

func (*Blob2ReprAdapter) Put

func (a *Blob2ReprAdapter) Put(repr *Repr) (blobs.ID, error)

func (*Blob2ReprAdapter) Scan

func (a *Blob2ReprAdapter) Scan(f func(blobs.ID, *Repr) bool) error

type Chunk

type Chunk struct {
	Offset uint64
	Size   uint64
	DataAt blobs.ID //blobs.ID
}

type Class

type Class struct {
	Name        string
	Constraints map[string]*regexp.Regexp
	Minimum     map[string]int
	IndexBy     []string
	Path        func(map[string][]string) string
	Fingerprint []string
}

type ErrNotEnoughInfo

type ErrNotEnoughInfo struct {
	ContentClass  string
	MissingFields []string
}

func (*ErrNotEnoughInfo) Error

func (err *ErrNotEnoughInfo) Error() string

type Fingerprint

type Fingerprint string

type Idea

type Idea struct {
	// contains filtered or unexported fields
}

func (*Idea) Fields

func (idea *Idea) Fields() []string

func (*Idea) Fingerprint

func (idea *Idea) Fingerprint() Fingerprint

func (*Idea) Get

func (idea *Idea) Get(field string) []string

func (*Idea) IndexBy

func (idea *Idea) IndexBy() []Tag

func (*Idea) MarshalJSON

func (idea *Idea) MarshalJSON() ([]byte, error)

func (*Idea) Path

func (idea *Idea) Path() string

func (*Idea) UnmarshalJSON

func (idea *Idea) UnmarshalJSON(data []byte) (err error)

type IdeaStore

type IdeaStore interface {
	Get(blobs.ID) (Idea, error)
	Put(Idea) (blobs.ID, error)
	Scan(func(blobs.ID, Idea) bool) error
}

type Repr

type Repr struct {
	Idea      blobs.ID
	Container string
	AudioInfo *AudioInfo `"json:omitempty"`
	VideoInfo *VideoInfo `"json:omitempty"`
	Tags      []Tag
	Chunks    []Chunk
}

func (*Repr) QualityString

func (repr *Repr) QualityString() string

type ReprStore

type ReprStore interface {
	Get(blobs.ID) (*Repr, error)
	Put(*Repr) (blobs.ID, error)
	Scan(func(blobs.ID, *Repr) bool) error
}

type Resolution

type Resolution struct {
	Width  uint32
	Height uint32
}

func (*Resolution) String

func (r *Resolution) String() string

type Tag

type Tag struct {
	Key   string
	Value string
}

func (*Tag) MarshalJSON

func (t *Tag) MarshalJSON() ([]byte, error)

func (*Tag) String

func (t *Tag) String() string

func (*Tag) UnmarshalJSON

func (t *Tag) UnmarshalJSON(data []byte) error

type VideoInfo

type VideoInfo struct {
	Resolution Resolution
}

Jump to

Keyboard shortcuts

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