src

package
v0.0.0-...-2a8ae44 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2019 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const ERROR_CONTENT_DEF = "err_content"
View Source
const MIN_UPLOAD_FILE_SIZE int64 = 1024 * 256 // 最小上传大小

Variables

View Source
var (
	GDRIVE_ROOT_DIR    = "LiveAuto" // 所有上传所在根目录
	GDRIVE_ROOT_DIR_ID = ""         // 查询出来的根目录ID
)
View Source
var Logger *logrus.Logger

Functions

func GetDirID

func GetDirID(dir_name string) (dir_id string, err error)

func InitGDrive

func InitGDrive()

func InitLogger

func InitLogger()

func LoadCfgRecorder

func LoadCfgRecorder()

加载xml配置文件中的

func MakeDir

func MakeDir(dir_name string, parent_id ...string) (dir_id string, err error)

调用gdrive创建目录 @dir_name 目录名 @parent_id 父目录ID

@dir_id 所创建目录的ID

func NewDownloader

func NewDownloader(url, filePath string) *downloader

func ReadConfig

func ReadConfig(configFilePath string) error

Types

type Config

type Config struct {
	XMLName       xml.Name    `xml:"config"`
	PieceSize     int64       `xml:"piece_size"`
	Proxy         string      `xml:"proxy"`
	CheckInterval int         `xml:"check_interval"`
	OutPutDirPath string      `xml:"out_put_dir_path"`
	RecordRules   recordRules `xml:"record_rules"`
}
var G_Config *Config

type DownloadCBCodeType

type DownloadCBCodeType int
const (
	NORMAL_END  DownloadCBCodeType = iota // 通常的情况  live流中断、结束
	WRITE_ERROR                           // 写入硬盘错误 空间满了
	NEXT_PIECE                            // 单片段达到大小上限
	UNSTART_ERROR
	STOP_SELF // 主动停止
	LIVE_STREAM_NIL
)

downloader返回值定义

type GDriveUploader

type GDriveUploader struct {
	Recorder *Recorder
	// contains filtered or unexported fields
}

func (*GDriveUploader) DoUpload

func (self *GDriveUploader) DoUpload(file_path string)

type IRecorderMngr

type IRecorderMngr interface {
	AddRecorder(*Recorder) error
	RemoveRecorder(id api.LiveId) error
	GetRecorder(id api.LiveId) *Recorder
	GetAllRecorder() []*Recorder
}

func GetIRecorderMngr

func GetIRecorderMngr() IRecorderMngr

type RecordConfig

type RecordConfig struct {
	// 循环
	Loop bool
	// TODO
	BeginTime       int
	EndTime         int
	EnableUploaders []UploaderType
	AutoRemove      bool // 上传成功后删除本地文件
}

type Recorder

type Recorder struct {
	RecordConfig
	Live api.Live

	Uploaders []Uploader
	IndexID   int // 递增int标识
	// contains filtered or unexported fields
}

func NewRecorder

func NewRecorder(live_url string, config RecordConfig) (*Recorder, error)

func (*Recorder) Start

func (self *Recorder) Start()

func (*Recorder) Stop

func (self *Recorder) Stop()

type Rule

type Rule struct {
	Urls            string          `xml:"urls"`
	EnableUploaders enableUploaders `xml:"enable_uploaders"`
	Loop            bool            `xml:"loop"`
	CheckInterval   int             `xml:"check_interval"`
}

type Uploader

type Uploader interface {
	DoUpload(file_path string)
}

func NewUploader

func NewUploader(_type UploaderType, owner *Recorder) Uploader

type UploaderType

type UploaderType int
const (
	GDRIVE UploaderType = iota // gdrive网盘
	MAX_SUPPORT_UPLOADER
	YOUTUBE // youtube
)

Jump to

Keyboard shortcuts

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