Documentation ¶
Overview ¶
package withny provides a way to watch a withny channel.
Index ¶
- Variables
- func DownloadChat(ctx context.Context, client *api.Client, chat Chat) error
- func DownloadLiveStream(ctx context.Context, client *api.Client, ls LiveStream) error
- func FormatOutput(outFormat string, meta api.MetaData, labels map[string]string, ext string) (string, error)
- func PrepareFile(outFormat string, meta api.MetaData, labels map[string]string, ext string) (fName string, err error)
- func PrepareFileAutoRename(outFormat string, meta api.MetaData, labels map[string]string, ext string) (fName string, err error)
- type ChannelWatcher
- type Chat
- type HasNewStreamResponse
- type LiveStream
- type OptionalParams
- type Params
Constants ¶
This section is empty.
Variables ¶
var DefaultParams = Params{ QualityConstraint: api.PlaylistConstraint{}, PacketLossMax: 20, OutFormat: "{{ .Date }} {{ .Title }} ({{ .ChannelName }}).{{ .Ext }}", WriteChat: false, WriteMetaDataJSON: false, WriteThumbnail: false, WaitPollInterval: 10 * time.Second, Remux: true, RemuxFormat: "mp4", Concat: true, KeepIntermediates: false, ScanDirectory: "", EligibleForCleaningAge: 48 * time.Hour, DeleteCorrupted: true, ExtractAudio: false, Labels: nil, Ignore: []string{}, }
DefaultParams is the default set of parameters.
var ( // ErrLiveStreamNotOnline is returned when the live stream is not online. ErrLiveStreamNotOnline = errors.New("live stream is not online") )
Functions ¶
func DownloadChat ¶ added in v0.2.0
DownloadChat downloads a withny chat.
func DownloadLiveStream ¶
DownloadLiveStream downloads a withny live stream.
func FormatOutput ¶
func FormatOutput( outFormat string, meta api.MetaData, labels map[string]string, ext string, ) (string, error)
FormatOutput formats the output file name.
Types ¶
type ChannelWatcher ¶
ChannelWatcher is responsible to watch a withny channel.
func NewChannelWatcher ¶
func NewChannelWatcher(client *api.Client, params *Params, channelID string) *ChannelWatcher
NewChannelWatcher creates a new withny channel watcher.
func (*ChannelWatcher) HasNewStream ¶ added in v1.2.0
func (w *ChannelWatcher) HasNewStream( ctx context.Context, ) (res HasNewStreamResponse, err error)
HasNewStream checks if the live stream is online.
func (*ChannelWatcher) Process ¶
Process runs the whole preparation, download and post-processing pipeline.
func (*ChannelWatcher) Watch ¶
func (w *ChannelWatcher) Watch(ctx context.Context)
Watch watches the channel for any new live stream.
type HasNewStreamResponse ¶ added in v1.2.0
type HasNewStreamResponse struct { HasNewStream bool Stream api.GetStreamsResponseElement User api.GetUserResponse PlaybackURL string }
HasNewStreamResponse is the response of HasNewStream.
type LiveStream ¶
type LiveStream struct { MetaData api.MetaData Params *Params OutputFileName string PlaybackURL string }
LiveStream encapsulates the withny live stream.
type OptionalParams ¶
type OptionalParams struct { QualityConstraint *api.PlaylistConstraint `yaml:"quality,omitempty"` PacketLossMax *int `yaml:"packetLossMax,omitempty"` OutFormat *string `yaml:"outFormat,omitempty"` WriteChat *bool `yaml:"writeChat,omitempty"` WriteMetaDataJSON *bool `yaml:"writeMetaDataJson,omitempty"` WriteThumbnail *bool `yaml:"writeThumbnail,omitempty"` WaitPollInterval *time.Duration `yaml:"waitPollInterval,omitempty"` Remux *bool `yaml:"remux,omitempty"` RemuxFormat *string `yaml:"remuxFormat,omitempty"` Concat *bool `yaml:"concat,omitempty"` KeepIntermediates *bool `yaml:"keepIntermediates,omitempty"` ScanDirectory *string `yaml:"scanDirectory,omitempty"` EligibleForCleaningAge *time.Duration `yaml:"eligibleForCleaningAge,omitempty"` DeleteCorrupted *bool `yaml:"deleteCorrupted,omitempty"` ExtractAudio *bool `yaml:"extractAudio,omitempty"` Labels map[string]string `yaml:"labels,omitempty"` Ignore []string `yaml:"ignore,omitempty"` }
OptionalParams represents the optional parameters for the download.
func (*OptionalParams) Override ¶
func (override *OptionalParams) Override(params *Params)
Override applies the values from the OptionalParams to the Params.
type Params ¶
type Params struct { QualityConstraint api.PlaylistConstraint `yaml:"quality,omitempty"` PacketLossMax int `yaml:"packetLossMax,omitempty"` OutFormat string `yaml:"outFormat,omitempty"` WriteChat bool `yaml:"writeChat,omitempty"` WriteMetaDataJSON bool `yaml:"writeMetaDataJson,omitempty"` WriteThumbnail bool `yaml:"writeThumbnail,omitempty"` WaitPollInterval time.Duration `yaml:"waitPollInterval,omitempty"` Remux bool `yaml:"remux,omitempty"` RemuxFormat string `yaml:"remuxFormat,omitempty"` Concat bool `yaml:"concat,omitempty"` KeepIntermediates bool `yaml:"keepIntermediates,omitempty"` ScanDirectory string `yaml:"scanDirectory,omitempty"` EligibleForCleaningAge time.Duration `yaml:"eligibleForCleaningAge,omitempty"` DeleteCorrupted bool `yaml:"deleteCorrupted,omitempty"` ExtractAudio bool `yaml:"extractAudio,omitempty"` Labels map[string]string `yaml:"labels,omitempty"` Ignore []string `yaml:"ignore,omitempty"` }
Params represents the parameters for the download.