site

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2023 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintTorrents

func PrintTorrents(torrents []Torrent, filter string, now int64, noHeader bool)

func Register

func Register(regInfo *RegInfo)

Types

type RegInfo

type RegInfo struct {
	Name    string
	Aliases []string
	Creator func(string, *config.SiteConfigStruct, *config.ConfigStruct) (Site, error)
}

func GetConfigSiteReginfo

func GetConfigSiteReginfo(name string) *RegInfo

type Site

type Site interface {
	GetName() string
	GetSiteConfig() *config.SiteConfigStruct
	// download torrent by original id (eg. 12345), sitename.id (eg. mteam.12345), or torrent download url
	DownloadTorrent(url string) (content []byte, filename string, err error)
	// download torrent by torrent original id (eg. 12345)
	DownloadTorrentById(id string) (content []byte, filename string, err error)
	GetLatestTorrents(full bool) ([]Torrent, error)
	GetAllTorrents(sort string, desc bool, pageMarker string, baseUrl string) (torrents []Torrent, nextPageMarker string, err error)
	SearchTorrents(keyword string, baseUrl string) ([]Torrent, error)
	GetStatus() (*Status, error)
	PurgeCache()
}

func CreateSite

func CreateSite(name string) (Site, error)

func CreateSiteInternal

func CreateSiteInternal(name string,
	siteConfig *config.SiteConfigStruct, config *config.ConfigStruct) (Site, error)

type SiteCreator

type SiteCreator func(*RegInfo) (Site, error)

type Status

type Status struct {
	UserName            string
	UserDownloaded      int64
	UserUploaded        int64
	TorrentsSeedingCnt  int64
	TorrentsLeechingCnt int64
}

type Torrent

type Torrent struct {
	Name               string
	Id                 string // optional torrent id in the site
	InfoHash           string
	DownloadUrl        string
	DownloadMultiplier float64
	UploadMultiplier   float64
	DiscountEndTime    int64
	Time               int64 // torrent timestamp
	Size               int64
	IsSizeAccurate     bool
	Seeders            int64
	Leechers           int64
	Snatched           int64
	HasHnR             bool // true if has any type of HR
	IsActive           bool // true if torrent is as already downloading / seeding
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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