sgtm

package
v1.32.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2020 License: Apache-2.0, MIT Imports: 65 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DBInit added in v1.16.1

func DBInit(db *gorm.DB, sfn *snowflake.Node) (*gorm.DB, error)

func ExtractBPM added in v1.32.0

func ExtractBPM(p string) (float64, error)

Types

type Download added in v1.32.0

type Download struct {
	URL           string
	Path          string
	YoutubeDLFile string
	YoutubeDL     YoutubeDLOutput
}

func DownloadPost added in v1.32.0

func DownloadPost(post *sgtmpb.Post, force bool) (*Download, error)

type Opts

type Opts struct {
	Context       context.Context
	Logger        *zap.Logger
	DevMode       bool
	JWTSigningKey string
	Snowflake     *snowflake.Node

	EnableDiscord       bool
	DiscordToken        string
	DiscordAdminChannel string
	DiscordClientID     string
	DiscordClientSecret string

	SoundCloudClientID string

	DBPath string

	EnableServer             bool
	ServerBind               string
	ServerCORSAllowedOrigins string
	ServerRequestTimeout     time.Duration
	ServerShutdownTimeout    time.Duration
	ServerWithPprof          bool
	Hostname                 string
}

func DefaultOpts

func DefaultOpts() Opts

func (Opts) Filtered

func (opts Opts) Filtered() Opts

type Service

type Service struct {
	StartedAt time.Time
	// contains filtered or unexported fields
}

func New

func New(db *gorm.DB, opts Opts) (Service, error)

func (*Service) AuthFuncOverride

func (svc *Service) AuthFuncOverride(ctx context.Context, path string) (context.Context, error)

func (*Service) Close

func (svc *Service) Close()

func (*Service) CloseDiscord

func (svc *Service) CloseDiscord(err error)

func (*Service) CloseServer

func (svc *Service) CloseServer(err error)

func (*Service) Me added in v1.32.0

func (*Service) Ping

func (*Service) PostList added in v1.16.1

func (*Service) ServerListenerAddr

func (svc *Service) ServerListenerAddr() string

func (*Service) StartDiscord

func (svc *Service) StartDiscord() error

func (*Service) StartServer

func (svc *Service) StartServer() error

func (*Service) Status

func (*Service) UserList added in v1.16.1

type YoutubeDLOutput added in v1.32.0

type YoutubeDLOutput struct {
	Extractor          string      `json:"extractor"`
	Protocol           string      `json:"protocol"`
	UploadDate         string      `json:"upload_date"`
	LikeCount          int         `json:"like_count"`
	Duration           float64     `json:"duration"`
	Fulltitle          string      `json:"fulltitle"`
	PlaylistIndex      interface{} `json:"playlist_index"`
	ViewCount          int         `json:"view_count"`
	Playlist           interface{} `json:"playlist"`
	Title              string      `json:"title"`
	Filename           string      `json:"_filename"`
	Abr                int         `json:"abr"`
	ID                 string      `json:"id"`
	CommentCount       int         `json:"comment_count"`
	UploaderURL        string      `json:"uploader_url"`
	Thumbnail          string      `json:"thumbnail"`
	WebpageURLBasename string      `json:"webpage_url_basename"`
	DisplayID          string      `json:"display_id"`
	Description        string      `json:"description"`
	Format             string      `json:"format"`
	Timestamp          int         `json:"timestamp"`
	Preference         interface{} `json:"preference"`
	Uploader           string      `json:"uploader"`
	Genre              string      `json:"genre"`
	FormatID           string      `json:"format_id"`
	UploaderID         string      `json:"uploader_id"`
	Thumbnails         []struct {
		URL        string `json:"url"`
		Width      int    `json:"width,omitempty"`
		Resolution string `json:"resolution,omitempty"`
		ID         string `json:"id"`
		Height     int    `json:"height,omitempty"`
		Preference int    `json:"preference,omitempty"`
	} `json:"thumbnails"`
	License      string `json:"license"`
	URL          string `json:"url"`
	ExtractorKey string `json:"extractor_key"`
	Vcodec       string `json:"vcodec"`
	HTTPHeaders  struct {
		AcceptCharset  string `json:"Accept-Charset"`
		AcceptLanguage string `json:"Accept-Language"`
		AcceptEncoding string `json:"Accept-Encoding"`
		Accept         string `json:"Accept"`
		UserAgent      string `json:"User-Agent"`
	} `json:"http_headers"`
	RepostCount int    `json:"repost_count"`
	Ext         string `json:"ext"`
	WebpageURL  string `json:"webpage_url"`
	Formats     []struct {
		Ext         string      `json:"ext"`
		Protocol    string      `json:"protocol"`
		Preference  interface{} `json:"preference"`
		Vcodec      string      `json:"vcodec"`
		Format      string      `json:"format"`
		URL         string      `json:"url"`
		FormatID    string      `json:"format_id"`
		HTTPHeaders struct {
			AcceptCharset  string `json:"Accept-Charset"`
			AcceptLanguage string `json:"Accept-Language"`
			AcceptEncoding string `json:"Accept-Encoding"`
			Accept         string `json:"Accept"`
			UserAgent      string `json:"User-Agent"`
		} `json:"http_headers"`
		Abr int `json:"abr"`
	} `json:"formats"`
}

Jump to

Keyboard shortcuts

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