utils

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertTwitchLiveChatToVodChat

func ConvertTwitchLiveChatToVodChat(path string, channelName string, vID string, vExtID string, cID int, chatStart time.Time) error

func CreateFolder

func CreateFolder(path string) error

CreateFolder - creates folder if it doesn't exist Adds base directory to path - supply with everything after /vods/

func DeleteFile

func DeleteFile(path string) error

func DownloadFile

func DownloadFile(url, path, filename string) error

DownloadFile - downloads file from url to destination Adds base directory to path - supply with everything after /vods/ DownloadFile("http://img", "channel", "profile.png")

func FileExists

func FileExists(path string) bool

func IsValidLogType added in v1.2.3

func IsValidLogType(logType string) bool

func IsValidUUID added in v1.2.3

func IsValidUUID(input string) (uuid.UUID, error)

func MoveFile

func MoveFile(sourcePath, destPath string) error

func MoveFolder added in v1.1.5

func MoveFolder(src string, dst string) error

func PrintMemUsage added in v1.1.6

func PrintMemUsage()

func ReadChatFile added in v1.1.0

func ReadChatFile(path string) ([]byte, error)

func ReadLastLines

func ReadLastLines(path string, lines int) ([]byte, error)

func SanitizeFileName added in v1.1.7

func SanitizeFileName(fileName string) string

func ValidateFileName added in v1.2.3

func ValidateFileName(fileName string) (string, error)

func ValidateFileNameInput added in v1.2.3

func ValidateFileNameInput(input string) (string, error)

func ValidateLogType added in v1.2.3

func ValidateLogType(logType string) (string, error)

func WriteJson

func WriteJson(j interface{}, path string, filename string) error

Types

type Comment

type Comment struct {
	ID                   string    `json:"_id"`
	Source               string    `json:"source"`
	ContentOffsetSeconds float64   `json:"content_offset_seconds"`
	Commenter            Commenter `json:"commenter"`
	Message              Message   `json:"message"`
}

type Commenter

type Commenter struct {
	DisplayName  string `json:"display_name"`
	ID           string `json:"id"`
	IsModerator  bool   `json:"is_moderator"`
	IsSubscriber bool   `json:"is_subscriber"`
	IsTurbo      bool   `json:"is_turbo"`
	Name         string `json:"name"`
}

type CustomValidator

type CustomValidator struct {
	Validator *validator.Validate
}

func (*CustomValidator) Init

func (cv *CustomValidator) Init()

Init validator

func (*CustomValidator) Validate

func (cv *CustomValidator) Validate(i interface{}) error

Validate Data

type Emoticon

type Emoticon struct {
	EmoticonID    string `json:"emoticon_id"`
	EmoticonSetID string `json:"emoticon_set_id"`
}

type ErrorResponse added in v1.2.3

type ErrorResponse struct {
	Message string `json:"message"`
}

type Fragment

type Fragment struct {
	Text     string    `json:"text"`
	Emoticon *Emoticon `json:"emoticon"`
	Pos1     int       `json:"pos1"`
	Pos2     int       `json:"pos2"`
}

type LiveChat

type LiveChat struct {
	Comments []LiveComment `json:"comments"`
}

type LiveComment

type LiveComment struct {
	ActionType string `json:"action_type"`
	Author     struct {
		Badges []struct {
			ClickAction string `json:"click_action"`
			ClickURL    string `json:"click_url"`
			Description string `json:"description"`
			Icons       []struct {
				Height int    `json:"height"`
				ID     string `json:"id"`
				URL    string `json:"url"`
				Width  int    `json:"width"`
			} `json:"icons"`
			ID      string      `json:"id"`
			Name    string      `json:"name"`
			Title   string      `json:"title"`
			Version interface{} `json:"version"`
		} `json:"badges"`
		DisplayName  string `json:"display_name"`
		ID           string `json:"id"`
		IsModerator  bool   `json:"is_moderator"`
		IsSubscriber bool   `json:"is_subscriber"`
		IsTurbo      bool   `json:"is_turbo"`
		Name         string `json:"name"`
	} `json:"author"`
	ChannelID   string `json:"channel_id"`
	ClientNonce string `json:"client_nonce"`
	Colour      string `json:"colour"`
	Emotes      []struct {
		ID     string `json:"id"`
		Images []struct {
			Height int    `json:"height"`
			ID     string `json:"id"`
			URL    string `json:"url"`
			Width  int    `json:"width"`
		} `json:"images"`
		Locations []string `json:"locations"`
		Name      string   `json:"name"`
	} `json:"emotes"`
	Flags            string `json:"flags"`
	IsFirstMessage   bool   `json:"is_first_message"`
	Message          string `json:"message"`
	MessageID        string `json:"message_id"`
	MessageType      string `json:"message_type"`
	ReturningChatter string `json:"returning_chatter"`
	Timestamp        int64  `json:"timestamp"`
	UserType         string `json:"user_type"`
}

func OpenChatFile

func OpenChatFile(path string) ([]LiveComment, error)

type Message

type Message struct {
	Body             string          `json:"body"`
	BitsSpent        int             `json:"bits_spent"`
	Fragments        []Fragment      `json:"fragments"`
	UserBadges       []UserBadge     `json:"user_badges"`
	UserColor        string          `json:"user_color"`
	UserNoticeParams UserNoticParams `json:"user_notice_params"`
}

type ParsedChat

type ParsedChat struct {
	Streamer Streamer  `json:"streamer"`
	Comments []Comment `json:"comments"`
}

type PlaybackStatus added in v0.0.2

type PlaybackStatus string
const (
	InProgress PlaybackStatus = "in_progress"
	Finished   PlaybackStatus = "finished"
)

func (PlaybackStatus) Values added in v0.0.2

func (PlaybackStatus) Values() (kinds []string)

type Role

type Role string
const (
	AdminRole    Role = "admin"
	EditorRole   Role = "editor"
	ArchiverRole Role = "archiver"
	UserRole     Role = "user"
)

func (Role) Values

func (Role) Values() (kinds []string)

type Streamer

type Streamer struct {
	Name string `json:"name"`
	ID   int    `json:"id"`
}

type TaskStatus

type TaskStatus string
const (
	Success TaskStatus = "success"
	Running TaskStatus = "running"
	Pending TaskStatus = "pending"
	Failed  TaskStatus = "failed"
)

func (TaskStatus) Values

func (TaskStatus) Values() (kinds []string)

type UserBadge

type UserBadge struct {
	ID      string `json:"_id"`
	Version string `json:"version"`
}

type UserNoticParams

type UserNoticParams struct {
	MsgID *string `json:"msg-id"`
}

type VodPlatform

type VodPlatform string
const (
	PlatformTwitch  VodPlatform = "twitch"
	PlatformYoutube VodPlatform = "youtube"
)

func (VodPlatform) Values

func (VodPlatform) Values() (kinds []string)

type VodQuality

type VodQuality string
const (
	Best    VodQuality = "best"
	Source  VodQuality = "source"
	R720P60 VodQuality = "720p60"
	R480P30 VodQuality = "480p30"
	R360P30 VodQuality = "360p30"
	R160P30 VodQuality = "160p30"
)

func (VodQuality) Values

func (VodQuality) Values() (kinds []string)

type VodType

type VodType string
const (
	Archive   VodType = "archive"
	Live      VodType = "live"
	Highlight VodType = "highlight"
	Upload    VodType = "upload"
	Clip      VodType = "clip"
)

func (VodType) Values

func (VodType) Values() (kinds []string)

Jump to

Keyboard shortcuts

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