utils

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

From https://github.com/iawia002/annie/blob/master/utils/ffmpeg.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileExist

func FileExist(fpath, fname string) bool

func FilePath

func FilePath(fpath, fname, ext string) string

func FileSize

func FileSize(filePath string) (int64, bool, error)

func Get

func Get(url, cookies string, reqBody io.Reader) (string, error)

func GetJson

func GetJson(url, cookies string, v interface{}) error

func MKDir

func MKDir(fpath string)

func MKDirs

func MKDirs(paths ...string)

func Md5

func Md5(text string) string

func MergeToMP4

func MergeToMP4(paths []string, mergedFilePath string, filename string) error

MergeToMP4 merge video parts to MP4

func MkDir

func MkDir(fpath string) error

func NewWGProgressBar

func NewWGProgressBar(wg *sync.WaitGroup) *mpb.Progress

func Request

func Request(method, url, cookies string, reqBody io.Reader, header map[string]string) (*http.Response, error)

func WriteFile

func WriteFile(fpath, fname string, data []byte) error

func WriteJson

func WriteJson(fpath, fname string, data interface{}) error

func WriteJsonS

func WriteJsonS(fpath, fname string, data interface{}) error

func WriteLockFile

func WriteLockFile(fpath, fname string) error

Types

type Progress

type Progress struct {
	Title    string       `json:"title"`
	Status   int          `json:"status"`
	Message  string       `json:"message"`
	Progress ProgressData `json:"data"`
	// contains filtered or unexported fields
}

Status: -1 Error 0 Not Started 1 Running 2 Finished

func NewProgress

func NewProgress(title string, size int64, callback func(pg *Progress)) *Progress

func (*Progress) Add

func (pg *Progress) Add(len int64)

func (*Progress) Error

func (pg *Progress) Error(err error)

func (*Progress) Finish

func (pg *Progress) Finish()

func (*Progress) Start

func (pg *Progress) Start()

func (*Progress) Write

func (pg *Progress) Write(p []byte) (n int, err error)

type ProgressData

type ProgressData struct {
	Size     int64     `json:"size"`
	Progress int64     `json:"progress"`
	Increase int64     `json:"increase"`
	Time     time.Time `json:"time"`
}

Jump to

Keyboard shortcuts

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