api

package
v1.5.0-beta.4 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: MIT Imports: 55 Imported by: 0

Documentation

Index

Constants

View Source
const (
	POLL_START_MSG         = "start_poll"
	POLL_CLOSE_MSG         = "close_active_poll"
	POLL_PARTICIPATION_MSG = "submit_poll_option_vote"
)
View Source
const (
	WorkerHTTPPort = "8060"
	CutOffLength   = 256
)
View Source
const (
	LiveUpdateRoomName       = "live-update"
	UpdateTypeCourseWentLive = "course_went_live"
)
View Source
const (
	FilterMaxCoursesCount = 3
	DefaultLimit          = 10
)
View Source
const (
	TypeServerInfo = "info"
	TypeServerWarn = "warn"
	TypeServerErr  = "error"
)
View Source
const (
	ChatRoomName = "chat/:streamID"
)
View Source
const (
	MAX_FILE_SIZE = 1000 * 1000 * 50 // 50 MB
)

Variables

Functions

func AssignRunnerAction

func AssignRunnerAction(dao dao.DaoWrapper, action *model.Action) error

func BroadcastStats

func BroadcastStats(streamsDao dao.StreamsDao)

func CollectStats

func CollectStats(daoWrapper dao.DaoWrapper) func()

func ConfigChatRouter

func ConfigChatRouter(router *gin.RouterGroup)

ConfigChatRouter configure gin router for chat (without gzip)

func ConfigGinRouter

func ConfigGinRouter(router *gin.Engine)

ConfigGinRouter for non ws endpoints

func ConfigRealtimeRouter

func ConfigRealtimeRouter(router *gin.RouterGroup)

ConfigRealtimeRouter configure gin router for live-updates (without gzip)

func CreateJob

func CreateJob(dao dao.DaoWrapper, ctx context.Context, values map[string]interface{}) error

func CreateStreamRequest

func CreateStreamRequest(daoWrapper dao.DaoWrapper, stream model.Stream, course model.Course, workers []model.Worker, sourceType string, source string)

func DeleteVideoSectionImage

func DeleteVideoSectionImage(workerDao dao.WorkerDao, path string) error

func FetchLivePreviews

func FetchLivePreviews(daoWrapper dao.DaoWrapper) func()

FetchLivePreviews gets a live thumbnail from a worker.

func GenerateVideoSectionImages

func GenerateVideoSectionImages(daoWrapper dao.DaoWrapper, parameters *generateVideoSectionImagesParameters) error

func NotifyForStreams

func NotifyForStreams(dao dao.DaoWrapper) func()

NotifyForStreams is a CronFunction that is called every 2 minutes to check if there are streams that are due to start in 10 minutes or less. it creates a Job (a model that is used to keep a bundle of actions together and keep individual tasks) for designated tasks

func NotifyLiveUpdateCourseWentLive

func NotifyLiveUpdateCourseWentLive(courseId uint)

func NotifyRunnerAssignments

func NotifyRunnerAssignments(dao dao.DaoWrapper) func()

func NotifyViewersLiveState

func NotifyViewersLiveState(streamId uint, live bool)

func NotifyWorkers

func NotifyWorkers(daoWrapper dao.DaoWrapper) func()

NotifyWorkers collects all streams that are due to stream (starts in the next 10 minutes from a lecture hall) and invokes the corresponding calls at the workers with the least workload via gRPC

func NotifyWorkersToStopStream

func NotifyWorkersToStopStream(stream model.Stream, discardVoD bool, daoWrapper dao.DaoWrapper)

NotifyWorkersToStopStream notifies all workers for a given stream to quit encoding

func RegenerateThumbs

func RegenerateThumbs(daoWrapper dao.DaoWrapper, file model.File, stream *model.Stream, course *model.Course) error

RegenerateThumbs regenerates the thumbnails for the timeline. This is useful for video with faulty thumbnails and for VoDs that were created before the thumbnail feature.

func RegisterLiveUpdateRealtimeChannel

func RegisterLiveUpdateRealtimeChannel()

func RegisterRealtimeChatChannel

func RegisterRealtimeChatChannel()

func ServeWorkerGRPC

func ServeWorkerGRPC()

ServeWorkerGRPC initializes a gRPC server on port 50052

func SetTranscodeFinished

func SetTranscodeFinished(ctx context.Context, req *protobuf.ActionFinished) (*protobuf.Status, error)

func SetUploadFinished

func SetUploadFinished(ctx context.Context, req *protobuf.ActionFinished) (*protobuf.Status, error)

func StartGrpcRunnerServer

func StartGrpcRunnerServer()

func StreamRequest

func StreamRequest(ctx context.Context, dao dao.DaoWrapper, runner model.Runner, values map[string]interface{})

func TranscodingRequest

func TranscodingRequest(ctx context.Context, dao dao.DaoWrapper, runner model.Runner, values map[string]interface{})

Types

type AddBookmarkRequest

type AddBookmarkRequest struct {
	StreamID    uint   `json:"streamID"`
	Description string `json:"description"`
	Hours       uint   `json:"hours"`
	Minutes     uint   `json:"minutes"`
	Seconds     uint   `json:"seconds"`
}

func (AddBookmarkRequest) ToBookmark

func (r AddBookmarkRequest) ToBookmark(userID uint) model.Bookmark

type CalendarEntry

type CalendarEntry struct {
	CreatedAt   string
	Start       string
	End         string
	ID          string
	Url         string
	Location    string
	Summary     string
	Description string
}

type GetBookmarksQuery

type GetBookmarksQuery struct {
	StreamID uint `form:"streamID" binding:"required"`
}

type GrpcRunnerServer

type GrpcRunnerServer struct {
	protobuf.UnimplementedFromRunnerServer

	dao.DaoWrapper
}

GrpcRunnerServer is the end note that connects all runners with TUMLive

func (GrpcRunnerServer) Heartbeat

Heartbeat is called by the runner every 30 seconds to update the stats of the runner. it contains not only the vmStats that show how much power it has (nice to have for later runner selection, see getRunnerWithLeastWorkloadForJob) but also saves the actions that the runner has started and running locally

func (GrpcRunnerServer) NotifyActionFinished

func (g GrpcRunnerServer) NotifyActionFinished(ctx context.Context, request *protobuf.ActionFinished) (*protobuf.Status, error)

NotifyActionFinished is so TUMLive gets notified on the completion of an action. This is set generic so that there are not more notify functions on the runner part

func (GrpcRunnerServer) NotifyStreamEnded

func (g GrpcRunnerServer) NotifyStreamEnded(ctx context.Context, request *protobuf.StreamEnded) (*protobuf.Status, error)

NotifyStreamEnded is called by the runner when the stream has ended. It sets the stream to ended in the data bank

func (GrpcRunnerServer) NotifyStreamStarted

func (g GrpcRunnerServer) NotifyStreamStarted(ctx context.Context, request *protobuf.StreamStarted) (*protobuf.Status, error)

func (GrpcRunnerServer) NotifyVoDUploadFinished

func (g GrpcRunnerServer) NotifyVoDUploadFinished(ctx context.Context, request *protobuf.VoDUploadFinished) (*protobuf.Status, error)

NotifyVOdUploadFinished is called by the runner when the upload of a vod is finished

func (GrpcRunnerServer) Register

Register is called by the runner on start up, creating a model in the data bank and start to send heartbeats

func (GrpcRunnerServer) RequestSelfStream

RequestSelfStream is called by the runner when a stream is supposed to be started by obs or other third party software returns an error if anything goes wrong OR the stream may not be published

type MailTmpl

type MailTmpl struct {
	Name   string
	OptIn  bool
	Course model.Course
	Users  []*model.User
}

type MeiliSearchMap

type MeiliSearchMap map[string]any

type SearchCourseDTO

type SearchCourseDTO struct {
	Name         string `json:"name"`
	Slug         string `json:"slug"`
	Year         int    `json:"year"`
	TeachingTerm string `json:"semester"`
}

func ToSearchCourseDTO

func ToSearchCourseDTO(cs ...model.Course) []SearchCourseDTO

ToSearchCourseDTO converts Courses to slice of SearchCourseDTO

type SearchStreamDTO

type SearchStreamDTO struct {
	ID           uint   `json:"ID"`
	Name         string `json:"name"`
	Description  string `json:"description"`
	CourseName   string `json:"courseName"`
	Year         int    `json:"year"`
	TeachingTerm string `json:"semester"`
	CourseSlug   string `json:"courseSlug"`
}

func ToSearchStreamDTO

func ToSearchStreamDTO(wrapper dao.DaoWrapper, streams ...model.Stream) []SearchStreamDTO

ToSearchStreamDTO converts Streams to slice of SearchStreamDTO

Ignores any errors and sets affected fields to zero value

type SearchSubtitlesDTO

type SearchSubtitlesDTO struct {
	StreamID           uint      `json:"streamID"`
	Timestamp          int64     `json:"timestamp"`
	TextPrev           string    `json:"textPrev"` // the previous subtitle line
	Text               string    `json:"text"`
	TextNext           string    `json:"textNext"` // the next subtitle line
	StreamName         string    `json:"streamName"`
	StreamStartTime    time.Time `json:"streamStartTime"`
	StreamEndTime      time.Time `json:"streamEndTime"`
	CourseName         string    `json:"courseName"`
	CourseSlug         string    `json:"courseSlug"`
	CourseYear         int       `json:"year"`
	CourseTeachingTerm string    `json:"semester"`
}

func ToSearchSubtitleDTO

func ToSearchSubtitleDTO(wrapper dao.DaoWrapper, subtitles ...tools.MeiliSubtitles) []SearchSubtitlesDTO

ToSearchSubtitleDTO converts MeiliSubtitles to slice of SearchSubtitlesDTO

Ignores any errors and sets affected fields to zero value

type SubtitleGeneratorClient

type SubtitleGeneratorClient struct {
	pb.SubtitleGeneratorClient
	*grpc.ClientConn
}

func GetSubtitleGeneratorClient

func GetSubtitleGeneratorClient() (SubtitleGeneratorClient, error)

func (SubtitleGeneratorClient) CloseConn

func (s SubtitleGeneratorClient) CloseConn()

type UpdateBookmarkRequest

type UpdateBookmarkRequest struct {
	Description string `json:"description"`
	Hours       uint   `json:"hours"`
	Minutes     uint   `json:"minutes"`
	Seconds     uint   `json:"seconds"`
}

func (UpdateBookmarkRequest) ToBookmark

func (r UpdateBookmarkRequest) ToBookmark(id uint) model.Bookmark

type UpdateVideoSectionRequest

type UpdateVideoSectionRequest struct {
	Description  string `json:"description"`
	StartHours   uint   `json:"startHours"`
	StartMinutes uint   `json:"startMinutes"`
	StartSeconds uint   `json:"startSeconds"`
}

Jump to

Keyboard shortcuts

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