metadata

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPortalEndpoint points to the portal
	DefaultPortalEndpoint = "https://podops.dev"
	// DefaultAPIEndpoint points to the API
	DefaultAPIEndpoint = "https://api.podops.dev"
	// DefaultCDNEndpoint point to the CDN
	DefaultCDNEndpoint = "https://cdn.podops.dev"

	LabelLanguage   = "language"
	LabelExplicit   = "explicit"
	LabelType       = "type"
	LabelBlock      = "block"
	LabelComplete   = "complete"
	LabelGUID       = "guid"
	LabelParentGUID = "parent_guid"
	LabelDate       = "date"
	LabelSeason     = "season"
	LabelEpisode    = "episode"

	ShowTypeEpisodic = "Episodic"
	ShowTypeSerial   = "Serial"

	EpisodeTypeFull    = "Full"
	EpisodeTypeTrailer = "Trailer"
	EpisodeTypeBonus   = "Bonus"
)
View Source
const (
	AssertionWarning = 0
	AssertionError   = 1
)

Variables

This section is empty.

Functions

func DefaultEpisodeMetadata

func DefaultEpisodeMetadata(guid, parentGUID string) map[string]string

DefaultEpisodeMetadata creates a default set of labels etc for a Episode resource

guid:		<unique id> 'item.guid'
date:		<publish date> REQUIRED 'item.pubDate'
season: 	<season number> OPTIONAL 'item.itunes.season'
episode:	<episode number> REQUIRED 'item.itunes.episode'
explicit:	True | False REQUIRED 'channel.itunes.explicit'
type:		Full | Trailer | Bonus REQUIRED 'item.itunes.episodeType'
block:		Yes OPTIONAL 'item.itunes.block' Anything else than 'Yes' has no effect

func DefaultShowMetadata

func DefaultShowMetadata(guid string) map[string]string

DefaultShowMetadata creates a default set of labels etc for a Show resource

language:	<ISO639 two-letter-code> REQUIRED 'channel.language'
explicit:	True | False REQUIRED 'channel.itunes.explicit'
type:		Episodic | Serial REQUIRED 'channel. itunes.type'
block:		Yes OPTIONAL 'channel.itunes.block' Anything else than 'Yes' has no effect
complete:	Yes OPTIONAL 'channel.itunes.complete' Anything else than 'Yes' has no effect

Types

type Assertion

type Assertion struct {
	Type int    // 0 == warning, 1 == error
	Txt  string // description of the problem
}

type Category

type Category struct {
	Name        string   `json:"name" yaml:"name" binding:"required"`      // REQUIRED
	SubCategory []string `json:"subcategory" yaml:"subcategory,omitempty"` // OPTIONAL
}

Category is the show/episodes category and it's subcategories

type Episode

type Episode struct {
	APIVersion  string             `json:"apiVersion" yaml:"apiVersion" binding:"required"`   // REQUIRED default: v1.0
	Kind        string             `json:"kind" yaml:"kind" binding:"required"`               // REQUIRED default: episode
	Metadata    Metadata           `json:"metadata" yaml:"metadata" binding:"required"`       // REQUIRED
	Description EpisodeDescription `json:"description" yaml:"description" binding:"required"` // REQUIRED
	Image       Resource           `json:"image" yaml:"image" binding:"required"`             // REQUIRED 'item.itunes.image'
	Enclosure   Resource           `json:"enclosure" yaml:"enclosure" binding:"required"`     // REQUIRED
}

Episode holds all metadata related to a podcast episode

func DefaultEpisode

func DefaultEpisode(name, parentName, guid, parentGUID string) *Episode

DefaultEpisode creates a default episode struc

func (*Episode) GUID

func (e *Episode) GUID() string

GUID is a convenience method to access the resources guid

func (*Episode) Item

func (e *Episode) Item() (*rss.Item, error)

Item returns the episode struct needed for a podcast feed struct

func (*Episode) PublishDate

func (e *Episode) PublishDate() string

PublishDate is a convenience method to access the pub date

func (*Episode) PublishDateTimestamp

func (e *Episode) PublishDateTimestamp() int64

PublishDateTimestamp converts a RFC1123Z formatted timestamp into UNIX timestamp

func (*Episode) Validate

func (e *Episode) Validate() error

Validate verifies the integrity of the struct. Aborts on first error.

type EpisodeDescription

type EpisodeDescription struct {
	Title       string   `json:"title" yaml:"title" binding:"required"`                                 // REQUIRED 'item.title' 'item.itunes.title'
	Summary     string   `json:"summary" yaml:"summary" binding:"required"`                             // REQUIRED 'item.description'
	EpisodeText string   `json:"episodeText,omitempty" yaml:"episodeText,omitempty" binding:"required"` // REQUIRED 'item.itunes.summary'
	Link        Resource `json:"link" yaml:"link"`                                                      // RECOMMENDED 'item.link'
	Duration    int      `json:"duration" yaml:"duration" binding:"required"`                           // REQUIRED 'item.itunes.duration'
}

EpisodeDescription holds essential episode metadata

type Metadata

type Metadata struct {
	Name   string            `json:"name" yaml:"name" binding:"required"` // REQUIRED <unique name>
	Labels map[string]string `json:"labels" yaml:"labels,omitempty"`      // REQUIRED
}

Metadata contains information describing a resource

type Owner

type Owner struct {
	Name  string `json:"name" yaml:"name" binding:"required"`   // REQUIRED
	Email string `json:"email" yaml:"email" binding:"required"` // REQUIRED
}

Owner describes the owner of the show/podcast

type Resource

type Resource struct {
	URI    string `json:"uri" yaml:"uri" binding:"required"`        // REQUIRED
	Title  string `json:"title,omitempty" yaml:"title,omitempty"`   // OPTIONAL
	Anchor string `json:"anchor,omitempty" yaml:"anchor,omitempty"` // OPTIONAL
	Rel    string `json:"rel,omitempty" yaml:"rel,omitempty"`       // OPTIONAL
	Type   string `json:"type,omitempty" yaml:"type,omitempty"`     // OPTIONAL
	Size   int    `json:"size,omitempty" yaml:"size,omitempty"`     // OPTIONAL
}

Resource provides a link to a media resource

type ResourceMetadata

type ResourceMetadata struct {
	APIVersion string   `json:"apiVersion" yaml:"apiVersion" binding:"required"` // REQUIRED default: v1.0
	Kind       string   `json:"kind" yaml:"kind" binding:"required"`             // REQUIRED default: show
	Metadata   Metadata `json:"metadata" yaml:"metadata" binding:"required"`     // REQUIRED
}

ResourceMetadata holds only the kind and metadata a resource

func (*ResourceMetadata) GUID

func (r *ResourceMetadata) GUID() string

GUID is a convenience method to access the resources guid

type Show

type Show struct {
	APIVersion  string          `json:"apiVersion" yaml:"apiVersion" binding:"required"`   // REQUIRED default: v1.0
	Kind        string          `json:"kind" yaml:"kind" binding:"required"`               // REQUIRED default: show
	Metadata    Metadata        `json:"metadata" yaml:"metadata" binding:"required"`       // REQUIRED
	Description ShowDescription `json:"description" yaml:"description" binding:"required"` // REQUIRED
	Image       Resource        `json:"image" yaml:"image" binding:"required"`             // REQUIRED 'channel.itunes.image'
}

Show holds all metadata related to a podcast/show

func DefaultShow

func DefaultShow(name, title, summary, guid string) *Show

DefaultShow creates a default show struc

func (*Show) GUID

func (s *Show) GUID() string

GUID is a convenience method to access the resources guid

func (*Show) Podcast

func (s *Show) Podcast() (*rss.Channel, error)

Podcast transforms Show metadata into a podcast feed struct

func (*Show) Validate

func (s *Show) Validate() error

Validate verifies the integrity of the struct. Aborts on first error.

type ShowDescription

type ShowDescription struct {
	Title     string    `json:"title" yaml:"title" binding:"required"`          // REQUIRED 'channel.title' 'channel.itunes.title'
	Summary   string    `json:"summary" yaml:"summary" binding:"required"`      // REQUIRED 'channel.description'
	Link      Resource  `json:"link" yaml:"link"`                               // RECOMMENDED 'channel.link'
	Category  Category  `json:"category" yaml:"category" binding:"required"`    // REQUIRED channel.category
	Owner     Owner     `json:"owner" yaml:"owner"`                             // RECOMMENDED 'channel.itunes.owner'
	Author    string    `json:"author" yaml:"author"`                           // RECOMMENDED 'channel.itunes.author'
	Copyright string    `json:"copyright,omitempty" yaml:"copyright,omitempty"` // OPTIONAL 'channel.copyright'
	NewFeed   *Resource `json:"newFeed,omitempty" yaml:"newFeed,omitempty"`     // OPTIONAL channel.itunes.new-feed-url -> move to label
}

ShowDescription holds essential show metadata

Jump to

Keyboard shortcuts

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