utils

package
v0.0.0-...-1b12922 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const MAXLENGTH = 80

MAXLENGTH Maximum length of file name

Variables

This section is empty.

Functions

func Domain

func Domain(url string) string

Domain get the domain of given URL

func FileName

func FileName(name string) string

FileName Converts a string to a valid filename

func FilePath

func FilePath(name, ext string, escape bool) (string, error)

FilePath gen valid file path

func FileSize

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

FileSize return the file size of the specified path file

func GetNameAndExt

func GetNameAndExt(uri string) (string, string, error)

GetNameAndExt return the name and ext of the URL https://img9.bcyimg.com/drawer/15294/post/1799t/1f5a87801a0711e898b12b640777720f.jpg -> 1f5a87801a0711e898b12b640777720f, jpg

func GetStringFromJson

func GetStringFromJson(json, path string) string

GetStringFromJson get the string value from json path

func ItemInSlice

func ItemInSlice(item, list interface{}) bool

ItemInSlice if a item is in the list

func LimitLength

func LimitLength(s string, length int) string

LimitLength Handle overly long strings

func M3u8URLs

func M3u8URLs(uri string) ([]string, error)

M3u8URLs get all urls from m3u8 url

func MatchAll

func MatchAll(text, pattern string) [][]string

MatchAll return all matching results

func MatchOneOf

func MatchOneOf(text string, patterns ...string) []string

MatchOneOf match one of the patterns

func Md5

func Md5(text string) string

Md5 md5 hash

func MergeAudioAndVideo

func MergeAudioAndVideo(paths []string, mergedFilePath string) error

MergeAudioAndVideo merge audio and video

func MergeToMP4

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

MergeToMP4 merge video parts to MP4

func NeedDownloadList

func NeedDownloadList(length int) []int

NeedDownloadList return the indices of playlist that need download

func PrintVersion

func PrintVersion()

PrintVersion print version information

func Range

func Range(min, max int) []int

Range generate a sequence of numbers by range

func Reverse

func Reverse(s string) string

Reverse Reverse a string

Types

type WaitGroupPool

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

WaitGroupPool pool of WaitGroup

func NewWaitGroupPool

func NewWaitGroupPool(size int) *WaitGroupPool

NewWaitGroupPool creates a sized pool for WaitGroup

func (*WaitGroupPool) Add

func (p *WaitGroupPool) Add()

Add increments the WaitGroup counter by one. See sync.WaitGroup documentation for more information.

func (*WaitGroupPool) Done

func (p *WaitGroupPool) Done()

Done decrements the WaitGroup counter by one. See sync.WaitGroup documentation for more information.

func (*WaitGroupPool) Wait

func (p *WaitGroupPool) Wait()

Wait blocks until the WaitGroup counter is zero. See sync.WaitGroup documentation for more information.

Jump to

Keyboard shortcuts

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