common

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClientTorrentSortFlag = &cmd.EnumFlag{
	Description: "Sort field of client torrents",
	Options: [][2]string{
		{"name", ""},
		{"size", ""},
		{"speed", ""},
		{"state", ""},
		{"time", ""},
		{"activity-time", ""},
		{"tracker", ""},
		{constants.NONE, ""},
	},
}

"name", "size", "speed", "state", "time", "tracker", "none"

View Source
var OrderFlag = &cmd.EnumFlag{
	Description: "Sort order",
	Options: [][2]string{
		{"asc", ""},
		{"desc", ""},
	},
}

asc|desc

View Source
var SiteTorrentSortFlag = &cmd.EnumFlag{
	Description: "Sort field of site torrents",
	Options: [][2]string{
		{"size", ""},
		{"time", ""},
		{"name", ""},
		{"seeders", ""},
		{"leechers", ""},
		{"snatched", ""},
		{constants.NONE, ""},
	},
}

size|time|name|seeders|leechers|snatched|none

Functions

func ExportClientTorrent added in v0.1.10

func ExportClientTorrent(clientInstance client.Client, torrent *client.Torrent,
	outputPath string, useCommentMeta bool) (contents []byte, tinfo *torrentutil.TorrentMeta, err error)

Export a client torrent's metainfo (".torrent" file contents), return it's byte contents and parsed info. If outputPath is not empty, it also writes the contents to that path; if it's "-", write to stdout. If useCommentMeta is true, encode the client torrents' category / tag / savePath in exported .torrent contents' comment field.

func IsPureFlag added in v0.1.6

func IsPureFlag(name string) bool

func YesNoAutoFlag added in v0.1.8

func YesNoAutoFlag(desc string) *cmd.EnumFlag

Types

type PathMapper added in v0.1.10

type PathMapper struct {
	// contains filtered or unexported fields
}

func NewPathMapper added in v0.1.10

func NewPathMapper(rules []string) (*PathMapper, error)

func (*PathMapper) After2Before added in v0.1.10

func (spm *PathMapper) After2Before(afterPath string) (beforePath string, match bool)

func (*PathMapper) Before2After added in v0.1.10

func (spm *PathMapper) Before2After(beforePath string) (afterPath string, match bool)

type TorrentType added in v0.1.10

type TorrentType int
const (
	TORRENT_SUCCESS TorrentType = iota
	TORRENT_FAILURE
	TORRENT_INVALID
)

type TorrentsStatistics added in v0.1.10

type TorrentsStatistics struct {
	TorrentsCnt         int64 // number of valid .torrent files
	SuccessCnt          int64
	SuccessSize         int64
	SuccessContentFiles int64
	FailureCnt          int64
	FailureSize         int64
	InvalidCnt          int64
	SmallestSize        int64
	LargestSize         int64
}

func NewTorrentsStatistics added in v0.1.10

func NewTorrentsStatistics() *TorrentsStatistics

func (*TorrentsStatistics) Print added in v0.1.10

func (ts *TorrentsStatistics) Print(output io.Writer)

func (*TorrentsStatistics) Update added in v0.1.10

func (ts *TorrentsStatistics) Update(torrentType TorrentType, size int64, files int64)

func (*TorrentsStatistics) UpdateClientTorrent added in v0.1.10

func (ts *TorrentsStatistics) UpdateClientTorrent(torrentType TorrentType, torrent *client.Torrent)

func (*TorrentsStatistics) UpdateTinfo added in v0.1.10

func (ts *TorrentsStatistics) UpdateTinfo(torrentType TorrentType, tinfo *torrentutil.TorrentMeta)

Jump to

Keyboard shortcuts

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