pkg

package
v0.55.3 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TmpFolder                     = "tmp"                         // 临时缓存的文件夹
	RodCacheFolder                = "rod"                         // rod 的缓存目录
	PluginFolder                  = "Plugin"                      // 插件的目录
	DebugFolder                   = "CSF-DebugThings"             // 调试相关的文件夹
	SubFixCacheFolder             = "CSF-SubFixCache"             // 字幕时间校正的缓存文件夹,一般可以不清理
	ShareSubFileCache             = "CSF-ShareSubCache"           // 字幕共享的缓存目录,不建议删除
	CacheCenterFolder             = "CSF-CacheCenter"             // 下载缓存、队列缓存、下载次数缓存的文件夹
	ManualSubUploadCacheFolder    = "CSF-ManualSubUploadCache"    // 手动上传字幕的缓存文件夹
	VideoAndSubPreviewCacheFolder = "CSF-VideoAndSubPreviewCache" // 视频和字幕的预览缓存
)

缓存文件的位置信息,都是在程序的根目录下的 cache 中

View Source
const (
	Plugin_Adblock = "adblock"
)

Variables

This section is empty.

Functions

func AESIv16

func AESIv16() string

func AESKey16

func AESKey16() string

func AdblockTmpFolder

func AdblockTmpFolder() string

func AddBaseUrl

func AddBaseUrl(baseUrl, url string) string

AddBaseUrl 判断传入的 url 是否需要拼接 baseUrl

func AppVersion

func AppVersion() string

func AppVersionInt

func AppVersionInt() (int, int, int)

func BaseKey

func BaseKey() string

func Bool2Int

func Bool2Int(inBool bool) int

func BytesToInt

func BytesToInt(b []byte) (int, error)

BytesToInt 字节转换成整形

func ClearFolder

func ClearFolder(folderFullPath string) error

ClearFolder 清空文件夹

func ClearIdleSubFixCacheFolder

func ClearIdleSubFixCacheFolder(l *logrus.Logger, rootSubFixCacheFolder string, outOfDate time.Duration) error

ClearIdleSubFixCacheFolder 清理闲置的字幕修正缓存文件夹

func ClearManualSubUploadCacheFolder

func ClearManualSubUploadCacheFolder() error

ClearManualSubUploadCacheFolder 清理手动上传字幕的缓存文件夹

func ClearPluginFolderByName

func ClearPluginFolderByName(folderName string) error

ClearPluginFolderByName 清理指定的缓存文件夹

func ClearRodTmpRootFolder

func ClearRodTmpRootFolder() error

ClearRodTmpRootFolder 清理 rod 缓存文件夹

func ClearRootTmpFolder

func ClearRootTmpFolder() error

ClearRootTmpFolder 清理缓存的根目录,将里面的子文件夹一并清理

func ClearShareSubFolderByYear

func ClearShareSubFolderByYear(year int) error

ClearShareSubFolderByYear 清理指定的缓存文件夹

func ClearShareSubFolderByYearAndName

func ClearShareSubFolderByYearAndName(year int, name string) error

ClearShareSubFolderByYearAndName 清理指定的缓存文件夹

func ClearTmpFolderByName

func ClearTmpFolderByName(folderName string) error

ClearTmpFolderByName 清理指定的缓存文件夹

func ClearVideoAndSubPreviewCacheFolder

func ClearVideoAndSubPreviewCacheFolder() error

ClearVideoAndSubPreviewCacheFolder 清理视频和字幕的预览缓存

func CloseChrome

func CloseChrome(l *logrus.Logger)

CloseChrome 强行结束没有关闭的 Chrome 进程

func ConfigRootDirFPath

func ConfigRootDirFPath() string

ConfigRootDirFPath ---------------------------------------------

func CopyDir

func CopyDir(src string, dst string) error

CopyDir copies a whole directory recursively

func CopyFile

func CopyFile(src, dst string) error

CopyFile copies a single file from src to dst

func CopyFiles2DebugFolder

func CopyFiles2DebugFolder(names []string, subFiles []string) error

CopyFiles2DebugFolder 把文件放入到 Debug 文件夹中,新建 desFolderName 文件夹

func DefDebugFolder

func DefDebugFolder() string

func DefRodTmpRootFolder

func DefRodTmpRootFolder() string

func DefSubFixCacheFolder

func DefSubFixCacheFolder() string

func DefTmpFolder

func DefTmpFolder() string

func DownFile

func DownFile(l *logrus.Logger, urlStr string) ([]byte, string, error)

DownFile 从指定的 url 下载文件

func ExtEnCode

func ExtEnCode() string

func FileNameIsBDMV

func FileNameIsBDMV(id_bdmv_fileFPath string) (bool, string)

FileNameIsBDMV 是否是 BDMV 蓝光目录,符合返回 true,以及 fakseVideoFPath

func FixWindowPathBackSlash

func FixWindowPathBackSlash(path string) string

FixWindowPathBackSlash 修复 Windows 反斜杠的梗

func GenerateAccessToken

func GenerateAccessToken() string

GenerateAccessToken 生成随机的 AccessToken

func Get2UUID

func Get2UUID() string

func GetConfigRootDirFPath

func GetConfigRootDirFPath() string

GetConfigRootDirFPath 获取 Config 的根目录,不同系统不一样

func GetDebugFolderByName

func GetDebugFolderByName(names []string) (string, error)

GetDebugFolderByName 根据传入的 strings (["aa", "bb"]) 组成 DebugFolder/aa/bb 这样的路径

func GetEpisodeKeyName

func GetEpisodeKeyName(season, eps int, zerofill ...bool) string

func GetFileName

func GetFileName(l *logrus.Logger, resp *http.Response) string

GetFileName 获取下载文件的文件名

func GetFileSHA1

func GetFileSHA1(srcFileFPath string) (string, error)

GetFileSHA1 获取文件的 SHA1 值

func GetFileSHA1String

func GetFileSHA1String(fileFPath string) (string, error)

GetFileSHA1String 获取文件的 SHA1 字符串

func GetFileSHA256String

func GetFileSHA256String(fileFPath string) (string, error)

GetFileSHA256String 获取文件的 SHA256 字符串

func GetManualSubUploadCacheFolder

func GetManualSubUploadCacheFolder() (string, error)

GetManualSubUploadCacheFolder 手动上传字幕的缓存文件夹

func GetMaxSizeFile

func GetMaxSizeFile(path string) string

func GetNowTimeString

func GetNowTimeString() (string, int, int, int)

GetNowTimeString 获取当前的时间,没有秒

func GetPluginFolderByName

func GetPluginFolderByName(folderName string) (string, error)

GetPluginFolderByName 获取缓存的文件夹,没有则新建

func GetPluginRootFolder

func GetPluginRootFolder() (string, error)

GetPluginRootFolder 在程序的根目录新建,取缓用文件夹,每一个视频的缓存将在其中额外新建子集文件夹

func GetPublicIP

func GetPublicIP(log *logrus.Logger, queue *settings.TaskQueue) string

func GetRestOfDaySec

func GetRestOfDaySec() time.Duration

func GetRodTmpRootFolder

func GetRodTmpRootFolder() (string, error)

GetRodTmpRootFolder 在程序的根目录新建,rod 缓存用文件夹

func GetRootCacheCenterFolder

func GetRootCacheCenterFolder() (string, error)

GetRootCacheCenterFolder 下载缓存、队列缓存、下载次数缓存的文件夹

func GetRootDebugFolder

func GetRootDebugFolder() (string, error)

GetRootDebugFolder 在程序的根目录新建,调试用文件夹

func GetRootSubFixCacheFolder

func GetRootSubFixCacheFolder() (string, error)

GetRootSubFixCacheFolder 在程序的根目录新建,字幕时间校正的缓存文件夹

func GetRootTmpFolder

func GetRootTmpFolder() (string, error)

GetRootTmpFolder 在程序的根目录新建,取缓用文件夹,每一个视频的缓存将在其中额外新建子集文件夹

func GetShareFolderByYear

func GetShareFolderByYear(year int) (string, error)

GetShareFolderByYear 缓存的文件夹以发行的年为一个单位存储

func GetShareSubRootFolder

func GetShareSubRootFolder() (string, error)

GetShareSubRootFolder 在程序的根目录新建,字幕共享的缓存根目录,下级还有具体是按发行的时间去划分的子集目录

func GetSubFixCacheFolderByName

func GetSubFixCacheFolderByName(folderName string) (string, error)

GetSubFixCacheFolderByName 获取缓存的文件夹,没有则新建

func GetTmpFolderByName

func GetTmpFolderByName(folderName string) (string, error)

GetTmpFolderByName 获取缓存的文件夹,没有则新建

func GetVideoAndSubPreviewCacheFolder

func GetVideoAndSubPreviewCacheFolder() (string, error)

GetVideoAndSubPreviewCacheFolder 视频和字幕的预览缓存

func IntToBytes

func IntToBytes(n int) ([]byte, error)

IntToBytes 整形转换成字节

func IsDir

func IsDir(path string) bool

IsDir 存在且是文件夹

func IsEqual

func IsEqual(f1, f2 float64) bool

IsEqual 比较 float64

func IsFile

func IsFile(filePath string) bool

IsFile 存在且是文件

func IsWantedVideoExtDef

func IsWantedVideoExtDef(fileName string) bool

IsWantedVideoExtDef 后缀名是否符合规则

func LinuxConfigPathInSelfPath

func LinuxConfigPathInSelfPath() string

LinuxConfigPathInSelfPath --------------------------------------------- 针对制作群晖的 SPK 应用,无法写入默认的 /config 目录而给出的新的编译条件,直接指向这个目录到当前程序的目录

func LiteMode

func LiteMode() bool

LiteMode ---------------------------------------------

func MakeCeil10msMultipleFromFloat

func MakeCeil10msMultipleFromFloat(input float64) float64

MakeCeil10msMultipleFromFloat 将传入的秒,规整到 10ms 的倍数,返回依然是 秒,向上取整

func MakeCeil10msMultipleFromTime

func MakeCeil10msMultipleFromTime(input time.Time) time.Time

MakeCeil10msMultipleFromTime 向上取整,规整到 10ms 的倍数

func MakeFloor10msMultipleFromFloat

func MakeFloor10msMultipleFromFloat(input float64) float64

MakeFloor10msMultipleFromFloat 将传入的秒,规整到 10ms 的倍数,返回依然是 秒,向下取整

func MakeFloor10msMultipleFromTime

func MakeFloor10msMultipleFromTime(input time.Time) time.Time

MakeFloor10msMultipleFromTime 向下取整,规整到 10ms 的倍数

func MakePowerOfTwo

func MakePowerOfTwo(x int64) int64

MakePowerOfTwo 2的整次幂数 buffer length is not a power of two

func NewHttpClient

func NewHttpClient(referer ...string) (*resty.Client, error)

NewHttpClient 新建一个 resty 的对象

func OSCheck

func OSCheck() bool

OSCheck 强制的系统支持检查

func ParseTime

func ParseTime(inTime string) (time.Time, error)

ParseTime 解析字幕时间字符串,这里可能小数点后面有 2-4 位

func PrintPanicStack

func PrintPanicStack(log *logrus.Logger)

func RandStringBytesMaskImprSrcSB

func RandStringBytesMaskImprSrcSB(n int) string

func RandomSecondDuration

func RandomSecondDuration(min, max int32) time.Duration

func ReadCustomAuthFile

func ReadCustomAuthFile(log *logrus.Logger) bool

func ReadCustomPortFile

func ReadCustomPortFile(log *logrus.Logger) int

func ReplaceSpecString

func ReplaceSpecString(inString string, rep string) string

ReplaceSpecString 替换特殊的字符

func ResetWantedVideoExt added in v0.50.4

func ResetWantedVideoExt()

ResetWantedVideoExt 重置视频后缀名

func Round

func Round(x float64) int64

Round 取整

func Second2Time

func Second2Time(sec int64) time.Time

func SetAESIv16

func SetAESIv16(aESIv16 string)

SetAESIv16 ---------------------------------------------

func SetAESKey16

func SetAESKey16(aESKey16 string)

SetAESKey16 ---------------------------------------------

func SetAppVersion

func SetAppVersion(appVersion string)

SetAppVersion ---------------------------------------------

func SetBaseKey

func SetBaseKey(baseKey string)

SetBaseKey ---------------------------------------------

func SetExtEnCode

func SetExtEnCode(extEnCode string)

SetExtEnCode ---------------------------------------------

func SetLinuxConfigPathInSelfPath

func SetLinuxConfigPathInSelfPath(setPath string)

func SetLiteMode

func SetLiteMode(liteMode bool)

func Sha256File added in v0.52.2

func Sha256File(fileFPath string) (string, int, error)

func Time2Duration

func Time2Duration(inTime time.Time) time.Duration

func Time2SecondNumber

func Time2SecondNumber(inTime time.Time) float64

func Time2SubTimeString

func Time2SubTimeString(inTime time.Time, timeFormat string) string

Time2SubTimeString 时间转字幕格式的时间字符串

func TimeNumber2Time

func TimeNumber2Time(inputTimeNumber float64) time.Time

func UrlJoin

func UrlJoin(hostUrl, subUrl string) (string, error)

func WriteFile

func WriteFile(desFileFPath string, bytes []byte) error

WriteFile 写文件

func WriteStrings2File

func WriteStrings2File(desfilePath string, strings []string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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