spiff

package
v0.22.4 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package spiff provides the model for all playlists used within TakeoutFM. A spiff is a container for one or more media tracks with basic media metadata. TakeoutFM also uses json patch to manipulate spiffs for remote playlist management.

Index

Constants

View Source
const (
	TypeMusic   = "music"
	TypeVideo   = "video"
	TypePodcast = "podcast"
	TypeStream  = "stream"
)
View Source
const (
	ContentType = "application/json-patch+json"
)

Variables

This section is empty.

Functions

func Compare

func Compare(before, after []byte) (bool, error)

func Patch

func Patch(data []byte, patch []byte) ([]byte, error)

Types

type Entry

type Entry struct {
	Ref        string   `json:"$ref,omitempty"`
	Creator    string   `json:"creator,omitempty" spiff:"creator"`
	Album      string   `json:"album,omitempty" spiff:"album"`
	Title      string   `json:"title,omitempty" spiff:"title"`
	Image      string   `json:"image,omitempty" spiff:"image"`
	Location   []string `json:"location,omitempty" spiff:"location"`
	Identifier []string `json:"identifier,omitempty" spiff:"identifier"`
	Size       []int64  `json:"size,omitempty"`
	Date       string   `json:"date,omitempty" spiff:"date"` // "2005-01-08T17:10:47-05:00",
}
type Header struct {
	Title    string `json:"title"`
	Creator  string `json:"creator,omitempty"`
	Image    string `json:"image,omitempty"`
	Location string `json:"location,omitempty"`
	Date     string `json:"date,omitempty"` // "2005-01-08T17:10:47-05:00",
}

type Playlist

type Playlist struct {
	Spiff    Spiff   `json:"playlist"`
	Index    int     `json:"index"`
	Position float64 `json:"position"`
	Type     string  `json:"type"`
}

func NewPlaylist

func NewPlaylist(listType string) *Playlist

func Unmarshal

func Unmarshal(data []byte) (*Playlist, error)

TODO could be large Playlist so return pointer

func (*Playlist) Empty added in v0.18.4

func (p *Playlist) Empty() bool

func (*Playlist) Length added in v0.18.4

func (p *Playlist) Length() int

func (*Playlist) Marshal

func (playlist *Playlist) Marshal() ([]byte, error)

type Spiff

type Spiff struct {
	Header
	Entries []Entry `json:"track"`
}

Jump to

Keyboard shortcuts

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