public

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: GPL-3.0 Imports: 13 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 {
	GetVideoBreadcrumb(ctx context.Context, videoID int) ([]Breadcrumb, error)
	GetSeriesBreadcrumb(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 events only rather than linear or events.

type CustomSetting added in v0.9.8

type CustomSetting struct {
	SettingID string `db:"setting_id" json:"settingID"`
	// Value will be returned in Base64 from PostgreSQL
	Value interface{} `db:"value" json:"value"`
}

type CustomSettingsRepo added in v0.9.8

type CustomSettingsRepo interface {
	GetCustomSettingPublic(ctx context.Context, settingID string) (CustomSetting, error)
}

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 Separate 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 Repos added in v0.9.6

func NewStore

func NewStore(db *sqlx.DB, cdnEndpoint string) Repos

NewStore creates our data store

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 its 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) (SeriesMeta, error)
	GetSeriesFullMeta(ctx context.Context, seriesID int) (Series, error)
	GetSeriesImmediateChildrenSeries(ctx context.Context, seriesID int) ([]SeriesMeta, error)
	GetSeriesFromPath(ctx context.Context, path string) (Series, error)
	GetSeriesByYear(ctx context.Context, year int) (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 (*Store) Find

func (s *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) GetCustomSettingPublic added in v0.9.8

func (s *Store) GetCustomSettingPublic(ctx context.Context, settingID string) (CustomSetting, error)

func (*Store) GetPlaylist added in v0.7.0

func (s *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 (s *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 (s *Store) GetPlaylistPopularByAllTime(ctx context.Context) (Playlist, error)

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

func (*Store) GetPlaylistPopularByPastMonth added in v0.7.0

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

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

func (*Store) GetPlaylistPopularByPastYear added in v0.7.0

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

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

func (*Store) GetPlaylistRandom added in v0.7.0

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

GetPlaylistRandom retrieves a random list of videos

func (*Store) GetSeries

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

GetSeries provides the immediate children of children and videos

func (*Store) GetSeriesBreadcrumb added in v0.9.5

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

GetSeriesBreadcrumb will return the breadcrumb from SeriesID to root

func (*Store) GetSeriesByYear added in v0.9.5

func (s *Store) GetSeriesByYear(ctx context.Context, year int) (Series, error)

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

func (*Store) GetSeriesFromPath

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

GetSeriesFromPath returns a series from an url path

func (*Store) GetSeriesFullMeta added in v0.9.5

func (s *Store) GetSeriesFullMeta(ctx context.Context, seriesID int) (Series, error)

GetSeriesFullMeta provides basic information for only the selected series

func (*Store) GetSeriesImmediateChildrenSeries

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

GetSeriesImmediateChildrenSeries returns series directly below the chosen series

func (*Store) GetSeriesMeta

func (s *Store) GetSeriesMeta(ctx context.Context, seriesID int) (SeriesMeta, error)

GetSeriesMeta provides basic information for only the selected series

func (*Store) GetTeamByEmail added in v0.9.5

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

GetTeamByEmail returns a single team including its members

func (*Store) GetTeamByID added in v0.9.5

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

GetTeamByID returns a single team including its members

func (*Store) GetTeamByStartEndYearByEmail added in v0.9.5

func (s *Store) GetTeamByStartEndYearByEmail(ctx context.Context, emailAlias string, startYear, endYear int) (Team, error)

GetTeamByStartEndYearByEmail returns a team by an academic year

func (*Store) GetTeamByStartEndYearByID added in v0.9.5

func (s *Store) GetTeamByStartEndYearByID(ctx context.Context, teamID, startYear, endYear int) (Team, error)

GetTeamByStartEndYearByID returns a team by an academic year

func (*Store) GetTeamByYearByEmail added in v0.9.5

func (s *Store) GetTeamByYearByEmail(ctx context.Context, emailAlias string, year int) (Team, error)

GetTeamByYearByEmail returns a team by a calendar year

func (*Store) GetTeamByYearByID added in v0.9.5

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

GetTeamByYearByID returns a team by a calendar year

func (*Store) GetVideo

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

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

func (*Store) GetVideoBreadcrumb added in v0.9.5

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

GetVideoBreadcrumb returns the absolute path from a VideoID

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) ([]TeamMemberDB, error)

ListOfficers returns the list of current officers

func (*Store) ListTeamMembers added in v0.7.0

func (s *Store) ListTeamMembers(ctx context.Context, teamID int) ([]TeamMemberDB, 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) ListVideos added in v0.9.7

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

ListVideos returns all video metadata

func (*Store) Search added in v0.7.0

func (s *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) TeamMemberDBToTeamMember added in v0.9.6

func (s *Store) TeamMemberDBToTeamMember(teamMember TeamMemberDB) TeamMember

func (*Store) VideoOfSeries

func (s *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"`
	LongDescription  string       `json:"longDescription,omitempty" db:"full_description"`
	Members          []TeamMember `json:"members,omitempty"`
}

Team an organisational group

type TeamMember

type TeamMember struct {
	UserName           string     `json:"userName"`
	Avatar             string     `json:"avatar"`
	EmailAlias         string     `json:"emailAlias"`
	Pronouns           *string    `json:"pronouns,omitempty"`
	OfficerName        string     `json:"officerName"`
	OfficerDescription string     `json:"officerDescription"`
	HistoryWikiURL     string     `json:"historywikiURL"`
	TeamEmail          string     `json:"teamEmail"`
	IsLeader           bool       `json:"isLeader"`
	IsDeputy           bool       `json:"isDeputy"`
	StartDate          *time.Time `json:"startDate,omitempty"`
	EndDate            *time.Time `json:"endDate,omitempty"`
}

TeamMember a position within a group

type TeamMemberDB added in v0.9.6

type TeamMemberDB struct {
	UserID             int         `db:"user_id"`
	UserName           string      `db:"user_name"`
	UserEmail          string      `db:"user_email"`
	Avatar             string      `db:"avatar"`
	UseGravatar        bool        `db:"use_gravatar"`
	EmailAlias         string      `db:"email_alias"`
	Pronouns           null.String `db:"pronouns"`
	OfficerName        string      `db:"officer_name"`
	OfficerDescription string      `db:"officer_description"`
	HistoryWikiURL     string      `db:"historywiki_url"`
	TeamEmail          string      `db:"team_email"`
	IsLeader           bool        `db:"is_leader"`
	IsDeputy           bool        `db:"is_deputy"`
	StartDate          null.Time   `db:"start_date"`
	EndDate            null.Time   `db:"end_date"`
}

TeamMemberDB a position within a group

type TeamRepo

type TeamRepo interface {
	ListTeams(ctx context.Context) ([]Team, error)
	GetTeamByEmail(ctx context.Context, emailAlias string) (Team, error)
	GetTeamByID(ctx context.Context, teamID int) (Team, error)
	GetTeamByYearByEmail(ctx context.Context, emailAlias string, year int) (Team, error)
	GetTeamByYearByID(ctx context.Context, teamID, year int) (Team, error)
	GetTeamByStartEndYearByEmail(ctx context.Context, emailAlias string, startYear, endYear int) (Team, error)
	GetTeamByStartEndYearByID(ctx context.Context, teamID, startYear, endYear int) (Team, error)
	ListTeamMembers(ctx context.Context, teamID int) ([]TeamMemberDB, error)
	ListOfficers(ctx context.Context) ([]TeamMemberDB, 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 {
	ListVideos(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