Documentation
¶
Index ¶
- func AddDownloadTask(clientInstance client.Client, id string, savePath string) (clientDownloads []client.Download, downloads []*schema.Download, err error)
- func AskYesNoConfirm(prompt string) bool
- func GetNewFilePath(dir string, name string) (fullpath string)
- func GetWildcardFilenames(filestr string) []string
- func NormalizeName(continueOnError bool, pathes ...string) (renamed int, err error)
- func ParseFilenameArgs(args ...string) []string
- func ReadFileHeader(name string, size int) ([]byte, error)
- func SearchPtoolSite(binary, site, keyword string, includeDead bool, matchExact bool) (exists bool, err error)
- type PtoolSearchResult
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 ¶
Ask user to confirm an (dangerous) action via typing yes in tty
func GetNewFilePath ¶
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 ¶
"*.torrent" => ["./a.torrent", "./b.torrent"...]. Return nil if filestr does not contains wildcard char. Windows cmd / powershell 均不支持命令行 *.torrent 参数扩展。必须应用自己实现。做个简易版的.
func NormalizeName ¶
Normalize file path names, truncate long names and replace restrictive chars.
func ParseFilenameArgs ¶
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"` }
Click to show internal directories.
Click to hide internal directories.