Documentation
¶
Index ¶
- Constants
- type Approval
- type BayesianTagSum
- type Recommender
- type Tag
- type UnencodedVideo
- type VideoModel
- func (v *VideoModel) AddRatingToVideoID(ratingUID, videoID int64, ratingValue float64) error
- func (v *VideoModel) ApproveVideo(userID, videoID int) error
- func (v *VideoModel) DeleteVideo(videoID string) error
- func (v *VideoModel) ForeignVideoExists(foreignVideoID, website string) (bool, error)
- func (v *VideoModel) GetAverageRatingForVideoID(videoID int64) (float64, error)
- func (v *VideoModel) GetComments(videoID, currUserID int64) ([]*videoproto.Comment, error)
- func (v *VideoModel) GetNumberOfSearchResultsForQuery(fromUserID int64, searchVal string, showUnapproved, unapprovedOnly bool) (int64, error)
- func (v *VideoModel) GetUnencodedVideos() ([]UnencodedVideo, error)
- func (v *VideoModel) GetVideoInfo(videoID string) (*videoproto.VideoMetadata, error)
- func (v *VideoModel) GetVideoList(direction videoproto.SortDirection, pageNum int64, fromUserID int64, ...) ([]*videoproto.Video, error)
- func (v *VideoModel) GetVideoRecommendations(userID int64) (*videoproto.RecResp, error)
- func (v *VideoModel) IncrementViewsForVideo(videoID int64) error
- func (v *VideoModel) MakeComment(userID, videoID, parentID int64, content string) error
- func (v *VideoModel) MakeUpvote(userID, commentID int64, isUpvote bool) error
- func (v *VideoModel) MarkApprovals() error
- func (v *VideoModel) MarkVideoApproved(videoID string) error
- func (v *VideoModel) MarkVideoAsEncoded(uv UnencodedVideo) error
- func (v *VideoModel) MarkVideoAsTooBig(uv UnencodedVideo) error
- func (v *VideoModel) SaveForeignVideo(ctx context.Context, title, description string, foreignAuthorUsername string, ...) (int64, error)
Constants ¶
const (
NumResultsPerPage = 50
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BayesianTagSum ¶
type BayesianTagSum struct {
// contains filtered or unexported fields
}
Dumb recommender system, computes expected rating value for user from a video's tags and orders by sum No more train otomads??? (please)
func NewBayesianTagSum ¶
func NewBayesianTagSum(db *sqlx.DB) BayesianTagSum
func (*BayesianTagSum) GetRecommendations ¶
func (b *BayesianTagSum) GetRecommendations(uid int64) ([]*videoproto.VideoRec, error)
func (*BayesianTagSum) RemoveRecommendedVideoForUser ¶
func (b *BayesianTagSum) RemoveRecommendedVideoForUser(userID, videoID int64) error
type Recommender ¶
type Recommender interface { GetRecommendations(userID int64) ([]*videoproto.VideoRec, error) RemoveRecommendedVideoForUser(userID, videoID int64) error }
TODO: test suite for recommender implementations with precision and recall for sample dataset
type UnencodedVideo ¶
func (UnencodedVideo) GetMPDUUID ¶
func (v UnencodedVideo) GetMPDUUID() string
type VideoModel ¶
type VideoModel struct { ApprovalThreshold int // contains filtered or unexported fields }
func NewVideoModel ¶
func NewVideoModel(db *sqlx.DB, client proto.UserServiceClient, approvalThreshold int) (*VideoModel, error)
func (*VideoModel) AddRatingToVideoID ¶
func (v *VideoModel) AddRatingToVideoID(ratingUID, videoID int64, ratingValue float64) error
func (*VideoModel) ApproveVideo ¶
func (v *VideoModel) ApproveVideo(userID, videoID int) error
Individual trusted user approves of the video
func (*VideoModel) DeleteVideo ¶
func (v *VideoModel) DeleteVideo(videoID string) error
func (*VideoModel) ForeignVideoExists ¶
func (v *VideoModel) ForeignVideoExists(foreignVideoID, website string) (bool, error)
func (*VideoModel) GetAverageRatingForVideoID ¶
func (v *VideoModel) GetAverageRatingForVideoID(videoID int64) (float64, error)
func (*VideoModel) GetComments ¶
func (v *VideoModel) GetComments(videoID, currUserID int64) ([]*videoproto.Comment, error)
func (*VideoModel) GetNumberOfSearchResultsForQuery ¶
func (v *VideoModel) GetNumberOfSearchResultsForQuery(fromUserID int64, searchVal string, showUnapproved, unapprovedOnly bool) (int64, error)
FIXME: optimization: move to redis once I figure out what types of queries are necessary
func (*VideoModel) GetUnencodedVideos ¶
func (v *VideoModel) GetUnencodedVideos() ([]UnencodedVideo, error)
func (*VideoModel) GetVideoInfo ¶
func (v *VideoModel) GetVideoInfo(videoID string) (*videoproto.VideoMetadata, error)
Information that isn't super straightforward to query for
func (*VideoModel) GetVideoList ¶
func (v *VideoModel) GetVideoList(direction videoproto.SortDirection, pageNum int64, fromUserID int64, searchVal string, showUnapproved, unapprovedOnly bool, category videoproto.OrderCategory) ([]*videoproto.Video, error)
For now, this only supports either fromUserID or withTag. Can support both in future, need to switch to goqu and write better tests
func (*VideoModel) GetVideoRecommendations ¶
func (v *VideoModel) GetVideoRecommendations(userID int64) (*videoproto.RecResp, error)
func (*VideoModel) IncrementViewsForVideo ¶
func (v *VideoModel) IncrementViewsForVideo(videoID int64) error
func (*VideoModel) MakeComment ¶
func (v *VideoModel) MakeComment(userID, videoID, parentID int64, content string) error
Comment stuff
func (*VideoModel) MakeUpvote ¶
func (v *VideoModel) MakeUpvote(userID, commentID int64, isUpvote bool) error
func (*VideoModel) MarkApprovals ¶
func (v *VideoModel) MarkApprovals() error
func (*VideoModel) MarkVideoApproved ¶
func (v *VideoModel) MarkVideoApproved(videoID string) error
func (*VideoModel) MarkVideoAsEncoded ¶
func (v *VideoModel) MarkVideoAsEncoded(uv UnencodedVideo) error
func (*VideoModel) MarkVideoAsTooBig ¶
func (v *VideoModel) MarkVideoAsTooBig(uv UnencodedVideo) error
func (*VideoModel) SaveForeignVideo ¶
func (v *VideoModel) SaveForeignVideo(ctx context.Context, title, description string, foreignAuthorUsername string, foreignAuthorID string, originalSite string, originalVideoLink, originalVideoID, newURI string, tags []string, domesticAuthorID int64) (int64, error)
check if user has been created if it hasn't, then create it list user as parent of this video FIXME this signature is too long lol If domesticAuthorID is 0, will interpret as foreign video from foreign user