Documentation ¶
Index ¶
- Variables
- func GenRandomName(n int) string
- func GenRandomString(length int, validChars string) string
- func GenUrlInfos(urls []*url.URL, headersForDownloader map[string]string) []*live.StreamUrlInfo
- func GenUrls(strs ...string) ([]*url.URL, error)
- func GetFFmpegPath(ctx context.Context) (string, error)
- func GetFuncMap(config *configs.Config) template.FuncMap
- func GetMd5String(b []byte) string
- func IsFFmpegExist(ctx context.Context) bool
- func Match1(re, str string) string
- func ParseString(str string, filter ...StringFilter) string
- func PrintStack(ctx context.Context)
- type StringFilter
- type StringFilterChain
- type StringFilterFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ParseUnicode = StringFilterFunc(func(str string) string { buf := new(bytes.Buffer) chars := []byte(str) for i := 0; i < len(str); { if chars[i] == 92 && chars[i+1] == 117 { t, _ := strconv.ParseInt(string(chars[i+2:i+6]), 16, 32) buf.WriteString(fmt.Sprintf("%c", t)) i += 6 } else { buf.WriteByte(chars[i]) i++ } } return buf.String() })
View Source
var RemoveSymbolOtherChar = StringFilterFunc(func(str string) string { reg := regexp.MustCompile(`\p{So}`) for reg.MatchString(str) { str = reg.ReplaceAllString(str, "_") } return str })
View Source
var ReplaceIllegalChar = StringFilterFunc(func(str string) string { reg := regexp.MustCompile(`[\/\\\:\*\?\"\<\>\|]|[\.\s]+$`) for reg.MatchString(str) { str = reg.ReplaceAllString(str, "_") } return str })
View Source
var UnescapeHTMLEntity = StringFilterFunc(html.UnescapeString)
Functions ¶
func GenRandomName ¶
func GenRandomString ¶ added in v0.7.6
func GenUrlInfos ¶ added in v0.7.33
func GetMd5String ¶
func IsFFmpegExist ¶
func ParseString ¶
func ParseString(str string, filter ...StringFilter) string
func PrintStack ¶ added in v0.7.8
Types ¶
type StringFilter ¶
type StringFilterChain ¶
type StringFilterChain struct {
// contains filtered or unexported fields
}
func NewStringFilterChain ¶
func NewStringFilterChain(filter ...StringFilter) *StringFilterChain
func (*StringFilterChain) Do ¶
func (c *StringFilterChain) Do(str string) string
type StringFilterFunc ¶
func (StringFilterFunc) Do ¶
func (f StringFilterFunc) Do(s string) string
Click to show internal directories.
Click to hide internal directories.