utils

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Domain

func Domain(url string) string

Domain get the domain of given URL

func FileLineCounter

func FileLineCounter(r io.Reader) (int, error)

FileLineCounter Counts line in file

func FileName

func FileName(name, ext string, length int) string

FileName Converts a string to a valid filename

func FilePath

func FilePath(name, ext string, length int, outputPath 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 MergeFilesWithSameExtension

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

MergeFilesWithSameExtension merges files that have the same extension into one. Can also handle merging audio and video.

func MergeToMP4

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

MergeToMP4 merges video parts to an MP4 file.

func NeedDownloadList

func NeedDownloadList(items string, itemStart, itemEnd, length int) []int

NeedDownloadList return the indices of playlist that need download

func ParseInputFile

func ParseInputFile(r io.Reader, items string, itemStart, itemEnd int) []string

ParseInputFile Parses input file into args

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