public

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrVideoNotFound  = errors.New("video not found")
	ErrSeriesNotFound = errors.New("series not found")
)

Functions

This section is empty.

Types

type Breadcrumb struct {
	ID       int    `db:"id" json:"id"`
	URL      string `db:"url" json:"url"`
	UseInURL bool   `db:"use" json:"useInURL"`
	Name     string `db:"name" json:"name"`
	SeriesID int    `db:"series_id" json:"-"` // Here since needed
}

Breadcrumb generic to be used for both series and video as a breadcrumb

type BreadcrumbItem struct {
	Video  *VideoItem `json:"video,omitempty"`
	Series *Series    `json:"series,omitempty"`
}

BreadcrumbItem is either a video or a series

type BreadcrumbRepo interface {
	VideoBreadcrumb(ctx context.Context, videoID int) ([]Breadcrumb, error)
	SeriesBreadcrumb(ctx context.Context, seriesID int) ([]Breadcrumb, error)
	Find(ctx context.Context, path string) (BreadcrumbItem, error)
}

BreadcrumbRepo represents all breadcrumb interactions

type Channel added in v0.7.0

type Channel struct {
	URLName        string    `db:"url_name" json:"urlName"`        // "tennis"
	Name           string    `db:"name" json:"name"`               // "YUSU Tennis 2020"
	Description    string    `db:"description" json:"description"` // "Very good tennis"
	Thumbnail      string    `db:"thumbnail" json:"thumbnail"`
	OutputType     string    `db:"output_type" json:"outputType"`
	OutputURL      string    `db:"output_url" json:"outputURL"`
	Status         string    `db:"status" json:"status"`     // "live" or "scheduled" or "cancelled" or "finished"
	Location       string    `db:"location" json:"location"` // "Central Hall"
	ScheduledStart time.Time `db:"scheduled_start" json:"scheduledStart"`
	ScheduledEnd   time.Time `db:"scheduled_end" json:"scheduledEnd"`
}

Channel represents a derivative of ystv/playout's channels. These are event only rather than linear or event.

type Playlist added in v0.7.0

type Playlist struct {
	PlaylistID  int         `db:"playlist_id" json:"id"`
	Name        string      `db:"name" json:"name"`
	Description string      `db:"description" json:"description"`
	Thumbnail   string      `db:"thumbnail" json:"thumbnail"`
	Videos      []VideoItem `json:"videos"`
}

Playlist is a list of videos Seperate from series and can contain videos from anywhere

type PlaylistRepo added in v0.7.0

type PlaylistRepo interface {
	GetPlaylist(ctx context.Context, playlistID int) (Playlist, error)
	GetPlaylistPopular(ctx context.Context, fromPeriod time.Time) (Playlist, error)
	GetPlaylistPopularByAllTime(ctx context.Context) (Playlist, error)
	GetPlaylistPopularByPastYear(ctx context.Context) (Playlist, error)
	GetPlaylistPopularByPastMonth(ctx context.Context) (Playlist, error)
	GetPlaylistRandom(ctx context.Context) (Playlist, error)
}

PlaylistRepo represents all playlist interactions

type Series

type Series struct {
	SeriesMeta
	ImmediateChildSeries []SeriesMeta `json:"childSeries"`
	ChildVideos          []VideoMeta  `json:"videos"`
}

Series provides basic information about a series this is useful when you want to know the current series and see it's immediate children.

type SeriesMeta

type SeriesMeta struct {
	SeriesID    int    `db:"series_id" json:"id"`
	URL         string `db:"url" json:"url"`
	SeriesName  string `db:"name" json:"name"`
	Description string `db:"description" json:"description"`
	Thumbnail   string `db:"thumbnail" json:"thumbnail"`
	Depth       int    `db:"depth" json:"-"`
}

SeriesMeta is used as a children object for a series

type SeriesRepo

type SeriesRepo interface {
	GetSeries(ctx context.Context, seriesID int) (Series, error)
	GetSeriesMeta(ctx context.Context, seriesID int) (Series, error)
	GetSeriesImmediateChildrenSeries(ctx context.Context, seriesID int) ([]SeriesMeta, error)
	GetSeriesFromPath(ctx context.Context, path string) (Series, error)
	Search(ctx context.Context, query string) (Series, error)
}

SeriesRepo represents all series interactions

type Store

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

Store encapsulates our dependency

func NewStore

func NewStore(db *sqlx.DB) *Store

NewStore creates our data store

func (*Store) Find

func (m *Store) Find(ctx context.Context, path string) (BreadcrumbItem, error)

Find returns either a series or video for a given path TODO be consistent with creator's find in terms of variables

func (*Store) GetChannel added in v0.8.0

func (s *Store) GetChannel(ctx context.Context, urlName string) (Channel, error)

GetChannel will get a public or unlisted channel

func (*Store) GetPlaylist added in v0.7.0

func (m *Store) GetPlaylist(ctx context.Context, playlistID int) (Playlist, error)

GetPlaylist returns a playlist object containing a list of videos and metadata

func (*Store) GetPlaylistPopular added in v0.7.0

func (m *Store) GetPlaylistPopular(ctx context.Context, fromPeriod time.Time) (Playlist, error)

GetPlaylistPopular returns a playlist of the most popular videos

func (*Store) GetPlaylistPopularByAllTime added in v0.7.0

func (m *Store) GetPlaylistPopularByAllTime(ctx context.Context) (Playlist, error)

GetPlaylistPopularByAllTime returns a playlist of the most popular videos of all time

func (*Store) GetPlaylistPopularByPastMonth added in v0.7.0

func (m *Store) GetPlaylistPopularByPastMonth(ctx context.Context) (Playlist, error)

GetPlaylistPopularByPastMonth returns a playlist of the most popular videos of past month

func (*Store) GetPlaylistPopularByPastYear added in v0.7.0

func (m *Store) GetPlaylistPopularByPastYear(ctx context.Context) (Playlist, error)

GetPlaylistPopularByPastYear returns a playlist of the most popular videos of past year

func (*Store) GetPlaylistRandom added in v0.7.0

func (m *Store) GetPlaylistRandom(ctx context.Context) (Playlist, error)

GetPlaylistRandom retrieves a random list of videos

func (*Store) GetSeries

func (m *Store) GetSeries(ctx context.Context, seriesID int) (Series, error)

GetSeries provides the immediate children of children and videos

func (*Store) GetSeriesFromPath

func (m *Store) GetSeriesFromPath(ctx context.Context, path string) (Series, error)

GetSeriesFromPath returns a series from a url path

func (*Store) GetSeriesImmediateChildrenSeries

func (m *Store) GetSeriesImmediateChildrenSeries(ctx context.Context, seriesID int) ([]SeriesMeta, error)

GetSeriesImmediateChildrenSeries returns series directly below the chosen series

func (*Store) GetSeriesMeta

func (m *Store) GetSeriesMeta(ctx context.Context, seriesID int) (Series, error)

GetSeriesMeta provides basic information for only the selected series TODO probably want to swap this to return SeriesMeta instead

func (*Store) GetTeam added in v0.7.0

func (s *Store) GetTeam(ctx context.Context, emailAlias string) (Team, error)

GetTeam returns a single team including it's members

func (*Store) GetTeamByYear added in v0.7.0

func (s *Store) GetTeamByYear(ctx context.Context, teamID, year int) (Team, error)

GetTeamByYear returns a team by a calendar year

func (*Store) GetVideo

func (m *Store) GetVideo(ctx context.Context, videoID int) (*VideoItem, error)

GetVideo returns a VideoItem, including the files, based on a given VideoItem ID.

func (*Store) ListChannels added in v0.7.0

func (s *Store) ListChannels(ctx context.Context) ([]Channel, error)

ListChannels will list all public channels

func (*Store) ListOfficers added in v0.7.0

func (s *Store) ListOfficers(ctx context.Context) ([]TeamMember, error)

ListOfficers returns the list of officers of the current officers

func (*Store) ListTeamMembers added in v0.7.0

func (s *Store) ListTeamMembers(ctx context.Context, teamID int) ([]TeamMember, error)

ListTeamMembers returns a list of TeamMembers who are part of a team

func (*Store) ListTeams

func (s *Store) ListTeams(ctx context.Context) ([]Team, error)

ListTeams returns a list of the ystv teams and their current members.

func (*Store) ListVideo

func (m *Store) ListVideo(ctx context.Context, offset int, page int) (*[]VideoMeta, error)

ListVideo returns all video metadata

func (*Store) Search added in v0.7.0

func (m *Store) Search(ctx context.Context, query string) (Series, error)

Search performs a full-text search on video library

Uses postgres' full-text search, video and series tables to try to make some sense

func (*Store) SeriesBreadcrumb

func (m *Store) SeriesBreadcrumb(ctx context.Context, seriesID int) ([]Breadcrumb, error)

SeriesBreadcrumb will return the breadcrumb from SeriesID to root

func (*Store) SeriesByYear added in v0.7.0

func (m *Store) SeriesByYear(ctx context.Context, year int) (Series, error)

SeriesByYear a virtual series containing child series / videos of content uploaded in that year

func (*Store) VideoBreadcrumb

func (m *Store) VideoBreadcrumb(ctx context.Context, videoID int) ([]Breadcrumb, error)

VideoBreadcrumb returns the absolute path from a VideoID

func (*Store) VideoOfSeries

func (m *Store) VideoOfSeries(ctx context.Context, seriesID int) ([]VideoMeta, error)

VideoOfSeries returns all the videos belonging to a series

type StreamRepo added in v0.7.0

type StreamRepo interface {
	ListChannels(ctx context.Context) ([]Channel, error)
	GetChannel(ctx context.Context, urlName string) (Channel, error)
}

StreamRepo represents all stream / playout interactions

type Team

type Team struct {
	TeamID           int          `json:"id" db:"team_id"`
	Name             string       `json:"name" db:"name"`
	EmailAlias       string       `json:"emailAlias" db:"email_alias"`
	ShortDescription string       `json:"shortDescription" db:"short_description"`
	LongDescripton   string       `json:"longDescription,omitempty" db:"full_description"`
	Members          []TeamMember `json:"members,omitempty"`
}

Team an organisational group

type TeamMember

type TeamMember struct {
	UserID             int    `json:"userID" db:"user_id"`
	UserName           string `json:"userName" db:"user_name"`
	Avatar             string `json:"avatar" db:"avatar"`
	OfficerID          int    `json:"officerID" db:"officer_id"`
	EmailAlias         string `json:"emailAlias" db:"email_alias"`
	OfficerName        string `json:"officerName" db:"officer_name"`
	OfficerDescription string `json:"officerDescription" db:"officer_description"`
	HistoryWikiURL     string `json:"historywikiURL" db:"historywiki_url"`
}

TeamMember a position within a group

type TeamRepo

type TeamRepo interface {
	ListTeams(ctx context.Context) ([]Team, error)
	GetTeam(ctx context.Context, emailAlias string) (Team, error)
	GetTeamByYear(ctx context.Context, teamID, year int) (Team, error)
	ListTeamMembers(ctx context.Context, teamID int) ([]TeamMember, error)
	ListOfficers(ctx context.Context) ([]TeamMember, error)
}

TeamRepo represents all team interactions

type VideoFile

type VideoFile struct {
	URI      string `json:"uri"`
	MimeType string `db:"mime_type" json:"mimeType"`
	Mode     string `db:"mode" json:"mode"`
	Width    int    `db:"width" json:"width"`
	Height   int    `db:"height" json:"height"`
}

VideoFile represents each file that a video item has stored.

type VideoItem

type VideoItem struct {
	VideoMeta
	Files []VideoFile `json:"files"`
}

VideoItem represents public info about video item.

type VideoMeta

type VideoMeta struct {
	VideoID       int       `db:"video_id" json:"id"`
	SeriesID      int       `db:"series_id" json:"seriesID"`
	Name          string    `db:"name" json:"name"`
	URL           string    `db:"url" json:"url"`
	Description   string    `db:"description" json:"description"`
	Thumbnail     string    `db:"thumbnail" json:"thumbnail"`
	BroadcastDate time.Time `db:"broadcast_date" json:"broadcastDate"`
	Views         int       `db:"views" json:"views"`
	Duration      int       `db:"duration" json:"duration"`
}

VideoMeta represents basic information about the videoitem used for listing.

type VideoRepo

type VideoRepo interface {
	ListVideo(ctx context.Context, offset int, page int) (*[]VideoMeta, error)
	GetVideo(ctx context.Context, videoID int) (*VideoItem, error)
	VideoOfSeries(ctx context.Context, seriesID int) ([]VideoMeta, error)
}

VideoRepo represents all video interactions

Jump to

Keyboard shortcuts

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