data

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMessagesTable

func CreateMessagesTable(db *sql.DB)

CreateMessagesTable will create the chat messages table if needed.

func DeleteWebhook

func DeleteWebhook(id int) error

DeleteWebhook will delete a webhook from the database.

func FindHighestVideoQualityIndex

func FindHighestVideoQualityIndex(qualities []models.StreamOutputVariant) int

FindHighestVideoQualityIndex will return the highest quality from a slice of variants.

func GetChatDisabled

func GetChatDisabled() bool

GetChatDisabled will return if chat is disabled.

func GetCustomStyles

func GetCustomStyles() string

GetCustomStyles will return a string with CSS to insert into the page.

func GetDatabase

func GetDatabase() *sql.DB

GetDatabase will return the shared instance of the actual database.

func GetDirectoryEnabled

func GetDirectoryEnabled() bool

GetDirectoryEnabled will return if this server should register to YP.

func GetDirectoryRegistrationKey

func GetDirectoryRegistrationKey() string

GetDirectoryRegistrationKey will return the YP protocol registration key.

func GetExternalActions

func GetExternalActions() []models.ExternalAction

GetExternalActions will return the registered external actions.

func GetExtraPageBodyContent

func GetExtraPageBodyContent() string

GetExtraPageBodyContent will return the user-supplied body content.

func GetFfMpegPath

func GetFfMpegPath() string

GetFfMpegPath will return the ffmpeg path.

func GetForbiddenUsernameList

func GetForbiddenUsernameList() []string

GetForbiddenUsernameList will return the blocked usernames as a comma separated string.

func GetHTTPListenAddress

func GetHTTPListenAddress() string

GetHTTPListenAddress will return the HTTP listen address.

func GetHTTPPortNumber

func GetHTTPPortNumber() int

GetHTTPPortNumber will return the server HTTP port.

func GetLastDisconnectTime

func GetLastDisconnectTime() (*utils.NullTime, error)

GetLastDisconnectTime will return the time the last stream ended.

func GetLogoPath

func GetLogoPath() string

GetLogoPath will return the path for the logo, relative to webroot.

func GetNSFW

func GetNSFW() bool

GetNSFW will return if this stream has NSFW content.

func GetPeakOverallViewerCount

func GetPeakOverallViewerCount() int

GetPeakOverallViewerCount will return the overall max number of viewers.

func GetPeakSessionViewerCount

func GetPeakSessionViewerCount() int

GetPeakSessionViewerCount will return the max number of viewers for this stream.

func GetRTMPPortNumber

func GetRTMPPortNumber() int

GetRTMPPortNumber will return the server RTMP port.

func GetS3Config

func GetS3Config() models.S3

GetS3Config will return the external storage configuration.

func GetS3StorageEnabled

func GetS3StorageEnabled() bool

GetS3StorageEnabled will return if external storage is enabled.

func GetServerMetadataTags

func GetServerMetadataTags() []string

GetServerMetadataTags will return the metadata tags.

func GetServerName

func GetServerName() string

GetServerName will return the server name text.

func GetServerSummary

func GetServerSummary() string

GetServerSummary will return the server summary text.

func GetServerURL

func GetServerURL() string

GetServerURL will return the server URL.

func GetServerWelcomeMessage

func GetServerWelcomeMessage() string

GetServerWelcomeMessage will return the server welcome message text.

func GetSocialHandles

func GetSocialHandles() []models.SocialHandle

GetSocialHandles will return the external social links.

func GetStreamKey

func GetStreamKey() string

GetStreamKey will return the inbound streaming password.

func GetStreamLatencyLevel

func GetStreamLatencyLevel() models.LatencyLevel

GetStreamLatencyLevel will return the stream latency level.

func GetStreamOutputVariants

func GetStreamOutputVariants() []models.StreamOutputVariant

GetStreamOutputVariants will return all of the stream output variants.

func GetStreamTitle

func GetStreamTitle() string

GetStreamTitle will return the name of the current stream.

func GetVideoCodec

func GetVideoCodec() string

GetVideoCodec returns the codec to use for transcoding video.

func GetWebhooks

func GetWebhooks() ([]models.Webhook, error)

GetWebhooks will return all the webhooks.

func GetWebhooksForEvent

func GetWebhooksForEvent(event models.EventType) []models.Webhook

GetWebhooksForEvent will return all of the webhooks that want to be notified about an event type.

func HasPopulatedDefaults

func HasPopulatedDefaults() bool

HasPopulatedDefaults will determine if the defaults have been inserted into the database.

func InsertWebhook

func InsertWebhook(url string, events []models.EventType) (int, error)

InsertWebhook will add a new webhook to the database.

func PopulateDefaults

func PopulateDefaults()

PopulateDefaults will set default values in the database.

func SetChatDisabled

func SetChatDisabled(disabled bool) error

SetChatDisabled will disable chat if set to true.

func SetCustomStyles

func SetCustomStyles(styles string) error

SetCustomStyles will save a string with CSS to insert into the page.

func SetDirectoryEnabled

func SetDirectoryEnabled(enabled bool) error

SetDirectoryEnabled will set if this server should register to YP.

func SetDirectoryRegistrationKey

func SetDirectoryRegistrationKey(key string) error

SetDirectoryRegistrationKey will set the YP protocol registration key.

func SetExternalActions

func SetExternalActions(actions []models.ExternalAction) error

SetExternalActions will save external actions.

func SetExtraPageBodyContent

func SetExtraPageBodyContent(content string) error

SetExtraPageBodyContent will set the user-supplied body content.

func SetFfmpegPath

func SetFfmpegPath(path string) error

SetFfmpegPath will set the custom ffmpeg path.

func SetForbiddenUsernameList

func SetForbiddenUsernameList(usernames []string) error

SetForbiddenUsernameList set the username blocklist as a comma separated string.

func SetHTTPListenAddress

func SetHTTPListenAddress(address string) error

SetHTTPListenAddress will set the server HTTP listen address.

func SetHTTPPortNumber

func SetHTTPPortNumber(port float64) error

SetHTTPPortNumber will set the server HTTP port.

func SetLastDisconnectTime

func SetLastDisconnectTime(disconnectTime time.Time) error

SetLastDisconnectTime will set the time the last stream ended.

func SetLogoPath

func SetLogoPath(logo string) error

SetLogoPath will set the path for the logo, relative to webroot.

func SetNSFW

func SetNSFW(isNSFW bool) error

SetNSFW will set if this stream has NSFW content.

func SetPeakOverallViewerCount

func SetPeakOverallViewerCount(count int) error

SetPeakOverallViewerCount will set the overall max number of viewers.

func SetPeakSessionViewerCount

func SetPeakSessionViewerCount(count int) error

SetPeakSessionViewerCount will set the max number of viewers for this stream.

func SetRTMPPortNumber

func SetRTMPPortNumber(port float64) error

SetRTMPPortNumber will set the server RTMP port.

func SetS3Config

func SetS3Config(config models.S3) error

SetS3Config will set the external storage configuration.

func SetS3StorageEnabled

func SetS3StorageEnabled(enabled bool) error

SetS3StorageEnabled will enable or disable external storage.

func SetServerMetadataTags

func SetServerMetadataTags(tags []string) error

SetServerMetadataTags will return the metadata tags.

func SetServerName

func SetServerName(name string) error

SetServerName will set the server name text.

func SetServerSummary

func SetServerSummary(summary string) error

SetServerSummary will set the server summary text.

func SetServerURL

func SetServerURL(url string) error

SetServerURL will set the server URL.

func SetServerWelcomeMessage

func SetServerWelcomeMessage(welcomeMessage string) error

SetServerWelcomeMessage will set the server welcome message text.

func SetSocialHandles

func SetSocialHandles(socialHandles []models.SocialHandle) error

SetSocialHandles will set the external social links.

func SetStreamKey

func SetStreamKey(key string) error

SetStreamKey will set the inbound streaming password.

func SetStreamLatencyLevel

func SetStreamLatencyLevel(level float64) error

SetStreamLatencyLevel will set the stream latency level.

func SetStreamOutputVariants

func SetStreamOutputVariants(variants []models.StreamOutputVariant) error

SetStreamOutputVariants will set the stream output variants.

func SetStreamTitle

func SetStreamTitle(title string) error

SetStreamTitle will set the name of the current stream.

func SetVideoCodec

func SetVideoCodec(codec string) error

SetVideoCodec will set the codec used for video encoding.

func SetWebhookAsUsed

func SetWebhookAsUsed(id string) error

SetWebhookAsUsed will update the last used time for a webhook.

func SetupPersistence

func SetupPersistence(file string) error

SetupPersistence will open the datastore and make it available.

func VerifySettings

func VerifySettings() error

VerifySettings will perform a sanity check for specific settings values.

Types

type ConfigEntry

type ConfigEntry struct {
	Key   string
	Value interface{}
}

ConfigEntry is the actual object saved to the database. The Value is encoded using encoding/gob.

type Datastore

type Datastore struct {
	DB *sql.DB

	DbLock *sync.Mutex
	// contains filtered or unexported fields
}

Datastore is the global key/value store for configuration values.

func GetDatastore

func GetDatastore() *Datastore

GetDatastore returns the shared instance of the owncast datastore.

func GetStore

func GetStore() *Datastore

GetStore will return the shared instance of the read/write datastore.

func (*Datastore) Get

func (ds *Datastore) Get(key string) (ConfigEntry, error)

Get will query the database for the key and return the entry.

func (*Datastore) GetBool

func (ds *Datastore) GetBool(key string) (bool, error)

GetBool will return the boolean value for a key.

func (*Datastore) GetCachedValue

func (ds *Datastore) GetCachedValue(key string) ([]byte, error)

GetCachedValue will return a value for key from the cache.

func (*Datastore) GetNumber

func (ds *Datastore) GetNumber(key string) (float64, error)

GetNumber will return the numeric value for a key.

func (*Datastore) GetString

func (ds *Datastore) GetString(key string) (string, error)

GetString will return the string value for a key.

func (*Datastore) Reset

func (ds *Datastore) Reset()

Reset will delete all config entries in the datastore and start over.

func (*Datastore) Save

func (ds *Datastore) Save(e ConfigEntry) error

Save will save the ConfigEntry to the database.

func (*Datastore) SetBool

func (ds *Datastore) SetBool(key string, value bool) error

SetBool will set the boolean value for a key.

func (*Datastore) SetCachedValue

func (ds *Datastore) SetCachedValue(key string, b []byte)

SetCachedValue will set a value for key in the cache.

func (*Datastore) SetNumber

func (ds *Datastore) SetNumber(key string, value float64) error

SetNumber will set the numeric value for a key.

func (*Datastore) SetString

func (ds *Datastore) SetString(key string, value string) error

SetString will set the string value for a key.

func (*Datastore) Setup

func (ds *Datastore) Setup()

Setup will create the datastore table and perform initial initialization.

Jump to

Keyboard shortcuts

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