Documentation
¶
Index ¶
- Constants
- Variables
- func BroadcastStats(streamsDao dao.StreamsDao)
- func CollectStats(daoWrapper dao.DaoWrapper) func()
- func ConfigChatRouter(router *gin.RouterGroup)
- func ConfigGinRouter(router *gin.Engine, manager *runner_manager.Manager)
- func ConfigRealtimeRouter(router *gin.RouterGroup)
- func CreateStreamRequest(daoWrapper dao.DaoWrapper, stream model.Stream, course model.Course, ...)
- func DeleteVideoSectionImage(workerDao dao.WorkerDao, path string) error
- func FetchLivePreviews(daoWrapper dao.DaoWrapper) func()
- func GenerateVideoSectionImages(daoWrapper dao.DaoWrapper, parameters *generateVideoSectionImagesParameters) error
- func NotifyAdminsOnReaction(streamID uint, reaction string)
- func NotifyAdminsOnReactionPercentages(context context.Context)
- func NotifyLiveUpdateCourseWentLive(courseId uint)
- func NotifyViewersLiveState(streamId uint, live bool)
- func NotifyWorkers(daoWrapper dao.DaoWrapper) func()
- func ParseCourseKeys(ctx context.Context, d dao.DaoWrapper, keys []string) ([]model.Course, error)
- func ParseSemesterKeys(keys []string) ([]model.Semester, error)
- func RegenerateThumbs(daoWrapper dao.DaoWrapper, file model.File, stream *model.Stream, ...) error
- func RegisterLiveUpdateRealtimeChannel()
- func RegisterReactionUpdateRealtimeChannel(wrapper dao.DaoWrapper)
- func RegisterRealtimeChatChannel()
- func RunVoiceServiceReceiver(authToken string)
- func ServeWorkerGRPC(subtitleClient subtitle_proto.SubtitleGeneratorClient, subtitleAuth string)
- type AddBookmarkRequest
- type CalendarEntry
- type GetBookmarksQuery
- type MeiliSearchMap
- type OnStartReq
- type SafeStreamStructStream
- type SearchCatalog
- type SearchCourseDTO
- type SearchHits
- type SearchScope
- type SearchStreamDTO
- type SearchSubtitlesDTO
- type SectionImages
- type StreamReactionRoutes
- type SubtitleGeneratorClient
- type UpdateBookmarkRequest
- type UpdateVideoSectionRequest
Constants ¶
const ( POLL_START_MSG = "start_poll" POLL_CLOSE_MSG = "close_active_poll" POLL_PARTICIPATION_MSG = "submit_poll_option_vote" )
const ( WorkerHTTPPort = "8060" CutOffLength = 256 )
const ( LiveUpdateRoomName = "live-update" UpdateTypeCourseWentLive = "course_went_live" )
const ( FilterMaxCoursesCount = 3 DefaultLimit = 10 )
const ( TypeServerInfo = "info" TypeServerWarn = "warn" TypeServerErr = "error" )
const (
ChatRoomName = "chat/:streamID"
)
const (
MAX_FILE_SIZE = 1000 * 1000 * 50 // 50 MB
)
const (
ReactionUpdateRoomName = "reaction-update"
)
Variables ¶
ErrSearchUnavailable means Meilisearch did not answer; locally that is the norm.
var ErrUnknownCourse = errors.New("unknown course")
ErrUnknownCourse is a course key no course matches.
var RealtimeInstance = realtime.New(connector.NewMelodyConnector())
Functions ¶
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, manager *runner_manager.Manager, )
ConfigGinRouter for non ws endpoints
func ConfigRealtimeRouter ¶
func ConfigRealtimeRouter(router *gin.RouterGroup)
ConfigRealtimeRouter configure gin router for live-updates (without gzip)
func CreateStreamRequest ¶
func DeleteVideoSectionImage ¶
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 NotifyAdminsOnReaction ¶ added in v1.7.12
func NotifyAdminsOnReactionPercentages ¶ added in v1.7.12
func NotifyLiveUpdateCourseWentLive ¶
func NotifyLiveUpdateCourseWentLive(courseId uint)
func NotifyViewersLiveState ¶
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 ParseCourseKeys ¶ added in v1.9.0
ParseCourseKeys reads courses written as v1's URL parameter did: "<slug><year><term>", "brauereiwesen2022S". It answers ErrUnknownCourse for a key no course matches or that is malformed, which the caller should treat as a missing course.
func ParseSemesterKeys ¶ added in v1.9.0
ParseSemesterKeys reads semesters written as v1's URL parameter did: "2022S".
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 RegisterReactionUpdateRealtimeChannel ¶ added in v1.7.12
func RegisterReactionUpdateRealtimeChannel(wrapper dao.DaoWrapper)
func RegisterRealtimeChatChannel ¶
func RegisterRealtimeChatChannel()
func RunVoiceServiceReceiver ¶ added in v1.5.9
func RunVoiceServiceReceiver(authToken string)
func ServeWorkerGRPC ¶
func ServeWorkerGRPC(subtitleClient subtitle_proto.SubtitleGeneratorClient, subtitleAuth string)
ServeWorkerGRPC initializes a gRPC server on port 50052
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 GetBookmarksQuery ¶
type GetBookmarksQuery struct {
StreamID uint `form:"streamID" binding:"required"`
}
type MeiliSearchMap ¶
type OnStartReq ¶ added in v1.5.7
type SafeStreamStructStream ¶ added in v1.5.7
type SearchCatalog ¶ added in v1.9.0
type SearchCatalog struct {
Dao dao.DaoWrapper
Meili tools.MeiliSearchInterface
}
SearchCatalog is the search the v2 API exposes. It runs on v1's filter building and post-filtering above, so both APIs agree on who may find what for as long as both exist; v1's handlers go with the search page, the filters stay.
func (SearchCatalog) Search ¶ added in v1.9.0
func (s SearchCatalog) Search(ctx context.Context, user *model.User, query string, limit int64, scope SearchScope) (SearchHits, error)
Search runs the query for user (nil for an anonymous caller) and keeps at most limit hits of each kind.
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 SearchHits ¶ added in v1.9.0
type SearchHits struct {
Courses []SearchCourseDTO
Streams []SearchStreamDTO
Subtitles []SearchSubtitlesDTO
}
SearchHits is what a search found, already reduced to what the user may see.
type SearchScope ¶ added in v1.9.0
type SearchScope struct {
Semesters []model.Semester
// A range; both or neither. Ignored when Semesters is set.
FirstSemester, LastSemester *model.Semester
// Searching inside courses looks at their lectures and subtitles instead of at
// courses, hidden ones included: naming a course is opting into it. The caller
// has checked the user may watch each.
Courses []model.Course
// Only courses, never lectures (v1's /api/search/courses).
CoursesOnly bool
}
SearchScope narrows a search the way v1's URL parameters did: named semesters, a range of them, or up to FilterMaxCoursesCount courses the caller may watch.
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 SectionImages ¶ added in v1.9.0
type SectionImages struct {
Dao dao.DaoWrapper
// May be nil, as for v1: then only the workers are asked.
Manager *runner_manager.Manager
}
SectionImages is how apiv2 reaches section thumbnail generation. The worker fallback and the worker-side delete are only implemented here, against the worker connection helpers, so apiv2 is handed this rather than reimplementing them; it goes once the workers do.
func (SectionImages) Delete ¶ added in v1.9.0
func (s SectionImages) Delete(path string) error
Delete asks a worker to delete a section's thumbnail, as v1's deleteVideoSection does.
func (SectionImages) Generate ¶ added in v1.9.0
func (s SectionImages) Generate(streamID uint, playlistURL string, course model.Course, sections []model.VideoSection) error
Generate makes the thumbnails for sections, as v1's createVideoSectionBatch does: a runner if one takes the job, else a worker. playlistURL must be signed.
type StreamReactionRoutes ¶ added in v1.7.12
type StreamReactionRoutes struct {
dao.DaoWrapper
}
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
Source Files
¶
- api_logger.go
- bookmarks.go
- chat.go
- courses.go
- download.go
- download_ics.go
- lecture_halls.go
- live_update.go
- notifications.go
- progress.go
- realtime.go
- router.go
- search.go
- search_catalog.go
- section_images.go
- seek_stats.go
- selfstream.go
- semesters.go
- statistics.go
- stream.go
- stream_reactions.go
- token.go
- users.go
- voice_service_grpc.go
- worker_grpc.go
- wsHub.go