helper

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDownloadTask

func AddDownloadTask(clientInstance client.Client, id string, savePath string) (
	clientDownloads []client.Download, downloads []*schema.Download, err error)

Add file or resource to client. If id is a resource id, add all files of it to client. It skip downloading files that already exists in local.

func AskYesNoConfirm

func AskYesNoConfirm(prompt string) bool

Ask user to confirm an (dangerous) action via typing yes in tty

func GetNewFilePath

func GetNewFilePath(dir string, name string) (fullpath string)

Return fullpath = join(dir,name), suitable for creating a new file in dir. If file already exists, append the proper numeric suffix to make sure fullpath does not exist.

func GetWildcardFilenames

func GetWildcardFilenames(filestr string) []string

"*.torrent" => ["./a.torrent", "./b.torrent"...]. Return nil if filestr does not contains wildcard char. Windows cmd / powershell 均不支持命令行 *.torrent 参数扩展。必须应用自己实现。做个简易版的.

func NormalizeName

func NormalizeName(continueOnError bool, pathes ...string) (renamed int, err error)

Normalize file path names, truncate long names and replace restrictive chars.

func ParseFilenameArgs

func ParseFilenameArgs(args ...string) []string

func ReadFileHeader

func ReadFileHeader(name string, size int) ([]byte, error)

func SearchPtoolSite

func SearchPtoolSite(binary, site, keyword string, includeDead bool, matchExact bool) (exists bool, err error)

Types

type PtoolSearchResult

type PtoolSearchResult struct {
	ErrorSites    int `json:"errorSites,omitempty"`
	NoResultSites int `json:"noResultSites,omitempty"`
	SuccessSites  int `json:"successSites,omitempty"`
	Torrents      []*struct {
		Name        string `json:"Name,omitempty"`
		Description string `json:"Description,omitempty"`
		Id          string `json:"Id,omitempty"`
		Size        int64  `json:"Size,omitempty"`
	} `json:"torrents,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳