Documentation ¶
Index ¶
- Variables
- func Start()
- func TimeIn(t time.Time, name string) (time.Time, error)
- type Recorder
- func (r *Recorder) AddOnline(u string)
- func (r *Recorder) DownloadSegment(log *log.Entry, filepath string, dlc chan *Segment)
- func (r *Recorder) GetPlaylist(log *log.Entry, channel config.Channels, urlStr string, dlc chan *Segment)
- func (r *Recorder) IsOnline(channel string) bool
- func (r *Recorder) Rec(log *log.Entry, c *config.Config, channel config.Channels, hlsURL string)
- func (r *Recorder) RefreshPlaylist(log *log.Entry, channel config.Channels) (string, error)
- func (r *Recorder) RemoveOnline(u string)
- func (r *Recorder) WaitForRestart(log *log.Entry, channel config.Channels) (string, error)
- type Segment
Constants ¶
This section is empty.
Variables ¶
var (
USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:86.0) Gecko/20100101 Firefox/86.0"
)
Functions ¶
Types ¶
type Recorder ¶
func (*Recorder) AddOnline ¶
AddOnline marks channel name being recorder right now by adding it to Channel struct
func (*Recorder) DownloadSegment ¶
DownloadSegment is mainly used as a goroutine which accepts new .ts chunks to be downloaded from GetPlaylist() function and then merges them into local file. Also updates and report total duration and bytes of current stream
func (*Recorder) GetPlaylist ¶
func (r *Recorder) GetPlaylist(log *log.Entry, channel config.Channels, urlStr string, dlc chan *Segment)
GetPlaylist is an infinite loop function used to download m3u8 live playlist file from server then it parses and drops old chunks which are already downloaded. If new chunks are present they are being sent to DownloadSegment() function via channel to be downloaded. New chunks are marked as old after being sent by adding their unique filename in cache. When m3u8 live playlist link is expired (usually 24 hours) it tries to refresh it by generating a new one
func (*Recorder) IsOnline ¶
IsOnline is used to check Online struct if specified channel is being recorder right now
func (*Recorder) Rec ¶
Rec is used to create channel's foldera and to compose stream file name then executes 2 goroutines with 1 shared channel to send data from one to another
func (*Recorder) RefreshPlaylist ¶
RefreshPlaylist is used to update direct link to m3u8 live playlist
func (*Recorder) RemoveOnline ¶
RemoveOnline removes channel name from Online struct, usually invokes when stream ends.