notify

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultNotificationFormats = NotificationFormats{
	ConfigReloaded: NotificationFormat{
		Enabled:  ptr.Ref(true),
		Title:    "config reloaded",
		Message:  "",
		Priority: 10,
	},
	LoginFailed: NotificationFormat{
		Enabled:  ptr.Ref(true),
		Title:    "login failed",
		Message:  "{{ .Error }}",
		Priority: 10,
	},
	Panicked: NotificationFormat{
		Enabled:  ptr.Ref(true),
		Title:    "panicked",
		Message:  "{{ .Capture }}",
		Priority: 10,
	},
	Idle: NotificationFormat{
		Enabled: ptr.Ref(false),
		Title:   "watching {{ .ChannelID }}",
	},
	PreparingFiles: NotificationFormat{
		Enabled: ptr.Ref(false),
		Title:   "preparing files for {{ .MetaData.ProfileData.Name }}",
	},
	Downloading: NotificationFormat{
		Enabled:  ptr.Ref(true),
		Title:    "{{ .MetaData.ProfileData.Name }} is streaming",
		Message:  "{{ .MetaData.ChannelData.Title }}",
		Priority: 7,
	},
	PostProcessing: NotificationFormat{
		Enabled:  ptr.Ref(false),
		Title:    "post-processing {{ .MetaData.ProfileData.Name }}",
		Message:  "{{ .MetaData.ChannelData.Title }}",
		Priority: 7,
	},
	Finished: NotificationFormat{
		Enabled:  ptr.Ref(true),
		Title:    "{{ .MetaData.ProfileData.Name }} stream ended",
		Message:  "{{ .MetaData.ChannelData.Title }}",
		Priority: 7,
	},
	Error: NotificationFormat{
		Enabled:  ptr.Ref(true),
		Title:    "stream download of {{ .ChannelID }} failed",
		Message:  "{{ .Error }}",
		Priority: 10,
	},
	Canceled: NotificationFormat{
		Enabled:  ptr.Ref(true),
		Title:    "stream download of {{ .ChannelID }} canceled",
		Priority: 10,
	},
}

Functions

This section is empty.

Types

type BaseNotifier added in v1.2.0

type BaseNotifier interface {
	Notify(
		ctx context.Context,
		title string,
		message string,
		priority int,
	) error
}

func NewDummyNotifier

func NewDummyNotifier() BaseNotifier

func NewShoutrrr added in v1.2.0

func NewShoutrrr(urls []string, opts ...ShoutrrrOption) BaseNotifier

type FormatedNotifier added in v1.2.0

type FormatedNotifier interface {
	BaseNotifier
	NotifyConfigReloaded(ctx context.Context) error
	NotifyLoginFailed(ctx context.Context, capture error) error
	NotifyPanicked(ctx context.Context, capture any) error
	NotifyIdle(ctx context.Context, channelID string, labels map[string]string) error
	NotifyPreparingFiles(
		ctx context.Context,
		channelID string,
		labels map[string]string,
		metadata any,
	) error
	NotifyDownloading(
		ctx context.Context,
		channelID string,
		labels map[string]string,
		metadata any,
	) error
	NotifyPostProcessing(
		ctx context.Context,
		channelID string,
		labels map[string]string,
		metadata any,
	) error
	NotifyFinished(
		ctx context.Context,
		channelID string,
		labels map[string]string,
		metadata any,
	) error
	NotifyError(
		ctx context.Context,
		channelID string,
		labels map[string]string,
		err error,
	) error
	NotifyCanceled(
		ctx context.Context,
		channelID string,
		labels map[string]string,
	) error
}

func NewFormatedNotifier added in v1.2.0

func NewFormatedNotifier(notifier BaseNotifier, formats NotificationFormats) FormatedNotifier

type NotificationFormat added in v1.2.0

type NotificationFormat struct {
	Enabled  *bool  `yaml:"enabled,omitempty"`
	Title    string `yaml:"title,omitempty"`
	Message  string `yaml:"message,omitempty"`
	Priority int    `yaml:"priority,omitempty"`
}

type NotificationFormats added in v1.2.0

type NotificationFormats struct {
	ConfigReloaded NotificationFormat `yaml:"configReloaded,omitempty"`
	LoginFailed    NotificationFormat `yaml:"loginFailed,omitempty"`
	Panicked       NotificationFormat `yaml:"panicked,omitempty"`
	Idle           NotificationFormat `yaml:"idle,omitempty"`
	PreparingFiles NotificationFormat `yaml:"preparingFiles,omitempty"`
	Downloading    NotificationFormat `yaml:"downloading,omitempty"`
	PostProcessing NotificationFormat `yaml:"postProcessing,omitempty"`
	Finished       NotificationFormat `yaml:"finished,omitempty"`
	Error          NotificationFormat `yaml:"error,omitempty"`
	Canceled       NotificationFormat `yaml:"canceled,omitempty"`
}

type NotificationTemplate added in v1.2.0

type NotificationTemplate struct {
	TitleTemplate   *template.Template
	MessageTemplate *template.Template
}

type NotificationTemplates added in v1.2.0

type NotificationTemplates struct {
	ConfigReloaded NotificationTemplate
	LoginFailed    NotificationTemplate
	Panicked       NotificationTemplate
	Idle           NotificationTemplate
	PreparingFiles NotificationTemplate
	Downloading    NotificationTemplate
	PostProcessing NotificationTemplate
	Finished       NotificationTemplate
	Error          NotificationTemplate
	Canceled       NotificationTemplate
}

type Shoutrrr added in v1.2.0

type Shoutrrr struct {
	*router.ServiceRouter
	// contains filtered or unexported fields
}

func (*Shoutrrr) Notify added in v1.2.0

func (n *Shoutrrr) Notify(
	ctx context.Context,
	title string,
	message string,
	priority int,
) error

type ShoutrrrOption added in v1.2.0

type ShoutrrrOption func(*ShoutrrrOptions)

func IncludeTitleInMessage added in v1.2.0

func IncludeTitleInMessage(value ...bool) ShoutrrrOption

func NoPriority added in v1.4.1

func NoPriority(value ...bool) ShoutrrrOption

type ShoutrrrOptions added in v1.2.0

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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