vbutton

package module
v0.0.0-...-ae5b8a4 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultCodec  = "libopus"
	DefaultFormat = "ogg"
)

Functions

This section is empty.

Types

type AudioEncoder

type AudioEncoder interface {
	Encode(r io.Reader) (io.ReadCloser, error)
	Extension() string
}

type FFmpegEncoder

type FFmpegEncoder struct {
	Format  string
	Codec   string
	BitRate string
	// contains filtered or unexported fields
}

func NewOpusCafEncoder

func NewOpusCafEncoder() *FFmpegEncoder

func NewOpusOggEncoder

func NewOpusOggEncoder() *FFmpegEncoder

func (*FFmpegEncoder) Encode

func (e *FFmpegEncoder) Encode(r io.Reader) (out io.ReadCloser, err error)

func (*FFmpegEncoder) Extension

func (e *FFmpegEncoder) Extension() string

type FileStorage

type FileStorage interface {
	SaveFile(name string, content io.Reader) error
	GetFile(name string) (io.ReadCloser, error)
	DeleteFile(name string) error
}

type FileSystemStorage

type FileSystemStorage struct {
	// contains filtered or unexported fields
}

func NewFileSystemStorage

func NewFileSystemStorage(root string) *FileSystemStorage

func (*FileSystemStorage) DeleteFile

func (s *FileSystemStorage) DeleteFile(name string) error

func (*FileSystemStorage) GetFile

func (s *FileSystemStorage) GetFile(name string) (io.ReadCloser, error)

func (*FileSystemStorage) Init

func (s *FileSystemStorage) Init() error

func (*FileSystemStorage) SaveFile

func (s *FileSystemStorage) SaveFile(name string, content io.Reader) error

func (*FileSystemStorage) ServeFile

func (s *FileSystemStorage) ServeFile(w http.ResponseWriter, r *http.Request)

type IndexHandler

type IndexHandler struct {
	// contains filtered or unexported fields
}

func NewIndexHandler

func NewIndexHandler(vc *VoiceClipService) *IndexHandler

func (*IndexHandler) ServeHTTP

func (h *IndexHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type SubmitHandler

type SubmitHandler struct {
	// contains filtered or unexported fields
}

func NewSubmitHandler

func NewSubmitHandler(vc *VoiceClipService) *SubmitHandler

func (*SubmitHandler) ServeHTTP

func (h *SubmitHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type TOSHandler

type TOSHandler struct{}

func NewTOSHandler

func NewTOSHandler() *TOSHandler

func (*TOSHandler) ServeHTTP

func (h *TOSHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type UpdateHandler

type UpdateHandler struct {
	// contains filtered or unexported fields
}

func NewUpdateHandler

func NewUpdateHandler(vc *VoiceClipService) *UpdateHandler

func (*UpdateHandler) ServeHTTP

func (h *UpdateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type VoiceClip

type VoiceClip struct {
	ID           int64
	Title        string
	VTuberName   string
	AgencyName   sql.NullString
	Tags         []string
	ReferenceURL sql.NullString
	Length       time.Duration
	ApprovedAt   sql.NullTime
	CreatedAt    time.Time
}

type VoiceClipDB

type VoiceClipDB struct {
	*sql.DB
}

func NewVoiceClipDB

func NewVoiceClipDB(db *sql.DB) *VoiceClipDB

func (*VoiceClipDB) Close

func (db *VoiceClipDB) Close() error

func (*VoiceClipDB) Create

func (db *VoiceClipDB) Create() error

func (*VoiceClipDB) DeleteVoiceClip

func (db *VoiceClipDB) DeleteVoiceClip(id int64) error

func (*VoiceClipDB) GetClipTags

func (db *VoiceClipDB) GetClipTags(clipID int64) ([]string, error)

func (*VoiceClipDB) GetRecentVoiceClips

func (db *VoiceClipDB) GetRecentVoiceClips(limit int) ([]*VoiceClip, error)

func (*VoiceClipDB) GetTopAgencies

func (db *VoiceClipDB) GetTopAgencies(limit int) ([]string, error)

func (*VoiceClipDB) GetTopTags

func (db *VoiceClipDB) GetTopTags(limit int) ([]string, error)

func (*VoiceClipDB) GetTopVTubers

func (db *VoiceClipDB) GetTopVTubers(limit int) ([]string, error)

func (*VoiceClipDB) GetUnapprovedVoiceClips

func (db *VoiceClipDB) GetUnapprovedVoiceClips(maxAge time.Duration) ([]*VoiceClip, error)

func (*VoiceClipDB) GetVoiceClip

func (db *VoiceClipDB) GetVoiceClip(id int64) (*VoiceClip, error)

func (*VoiceClipDB) GetVoiceClipsByAgency

func (db *VoiceClipDB) GetVoiceClipsByAgency(agency string) ([]*VoiceClip, error)

func (*VoiceClipDB) GetVoiceClipsByTag

func (db *VoiceClipDB) GetVoiceClipsByTag(tag string) ([]*VoiceClip, error)

func (*VoiceClipDB) GetVoiceClipsByVTuber

func (db *VoiceClipDB) GetVoiceClipsByVTuber(vtuberName string) ([]*VoiceClip, error)

func (*VoiceClipDB) InsertVoiceClip

func (db *VoiceClipDB) InsertVoiceClip(clip *VoiceClip) error

func (*VoiceClipDB) SearchClips

func (db *VoiceClipDB) SearchClips(
	query sql.NullString,
	vtuber sql.NullString,
	agency sql.NullString,
	tag sql.NullString,
	limit int,
) ([]*VoiceClip, error)

func (*VoiceClipDB) UpdateVoiceClip

func (db *VoiceClipDB) UpdateVoiceClip(clip *VoiceClip) error

type VoiceClipRepository

type VoiceClipRepository interface {
	InsertVoiceClip(vc *VoiceClip) error
	UpdateVoiceClip(vc *VoiceClip) error
	DeleteVoiceClip(id int64) error
	GetRecentVoiceClips(limit int) ([]*VoiceClip, error)
	GetClipTags(id int64) ([]string, error)
	GetVoiceClip(id int64) (*VoiceClip, error)
	GetVoiceClipsByVTuber(vtuberName string) ([]*VoiceClip, error)
	GetVoiceClipsByAgency(agencyName string) ([]*VoiceClip, error)
	GetVoiceClipsByTag(tag string) ([]*VoiceClip, error)
	GetUnapprovedVoiceClips(age time.Duration) ([]*VoiceClip, error)
	GetTopAgencies(limit int) ([]string, error)
	GetTopVTubers(limit int) ([]string, error)
	GetTopTags(limit int) ([]string, error)
	SearchClips(query, vtuber, agency, tag sql.NullString, limit int) ([]*VoiceClip, error)
}

type VoiceClipService

type VoiceClipService struct {
	// contains filtered or unexported fields
}

func NewVoiceClipService

func NewVoiceClipService(db VoiceClipRepository, audioStorage FileStorage, encoders []AudioEncoder) *VoiceClipService

func (*VoiceClipService) CreateVoiceClip

func (s *VoiceClipService) CreateVoiceClip(clip *VoiceClip, inAudio io.Reader) error

func (*VoiceClipService) DeleteVoiceClip

func (s *VoiceClipService) DeleteVoiceClip(id int64) error

func (*VoiceClipService) FileTypes

func (s *VoiceClipService) FileTypes() []string

func (*VoiceClipService) GetClipTags

func (s *VoiceClipService) GetClipTags(id int64) ([]string, error)

func (*VoiceClipService) GetRecentVoiceClips

func (s *VoiceClipService) GetRecentVoiceClips(limit int) ([]*VoiceClip, error)

func (*VoiceClipService) GetTopAgencies

func (s *VoiceClipService) GetTopAgencies(limit int) ([]string, error)

func (*VoiceClipService) GetTopTags

func (s *VoiceClipService) GetTopTags(limit int) ([]string, error)

func (*VoiceClipService) GetTopVTubers

func (s *VoiceClipService) GetTopVTubers(limit int) ([]string, error)

func (*VoiceClipService) GetUnapprovedVoiceClips

func (s *VoiceClipService) GetUnapprovedVoiceClips(age time.Duration) ([]*VoiceClip, error)

func (*VoiceClipService) GetVoiceClip

func (s *VoiceClipService) GetVoiceClip(id int64) (vc *VoiceClip, err error)

func (*VoiceClipService) GetVoiceClipAudio

func (s *VoiceClipService) GetVoiceClipAudio(id int64) (audio io.ReadCloser, err error)

func (*VoiceClipService) GetVoiceClipsByAgency

func (s *VoiceClipService) GetVoiceClipsByAgency(agencyName string) ([]*VoiceClip, error)

func (*VoiceClipService) GetVoiceClipsByTag

func (s *VoiceClipService) GetVoiceClipsByTag(tag string) ([]*VoiceClip, error)

func (*VoiceClipService) GetVoiceClipsByVTuber

func (s *VoiceClipService) GetVoiceClipsByVTuber(vtuberName string) ([]*VoiceClip, error)

func (*VoiceClipService) SearchClips

func (s *VoiceClipService) SearchClips(query, vtuber, agency, tag sql.NullString, limit int) ([]*VoiceClip, error)

func (*VoiceClipService) UpdateVoiceClip

func (s *VoiceClipService) UpdateVoiceClip(clip *VoiceClip) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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