config

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	BRUSH_CAT      = "_brush"
	XSEED_TAG      = "_xseed"
	STATS_FILENAME = "ptool_stats.txt"

	DEFAULT_SITE_TIMEZONE                           = "Asia/Shanghai"
	DEFAULT_CLIENT_BRUSH_MIN_DISK_SPACE             = int64(5 * 1024 * 1024 * 1024)
	DEFAULT_CLIENT_BRUSH_SLOW_UPLOAD_SPEED_TIER     = int64(100 * 1024)
	DEFAULT_CLIENT_BRUSH_MAX_DOWNLOADING_TORRENTS   = int64(6)
	DEFAULT_CLIENT_BRUSH_MAX_TORRENTS               = int64(9999)
	DEFAULT_CLIENT_BRUSH_MIN_RATION                 = float64(0.2)
	DEFAULT_CLIENT_BRUSH_DEFAULT_UPLOAD_SPEED_LIMIT = int64(10 * 1024 * 1024)
	DEFAULT_CLIENT_BRUSH_TORRENT_SIZE_LIMIT         = int64(1024 * 1024 * 1024 * 1024 * 1024) // 1PB, that's say, unlimited
	DEFAULT_SITE_TORRENT_UPLOAD_SPEED_LIMIT         = int64(10 * 1024 * 1024)
)

Variables

View Source
var (
	VerboseLevel = 0
	ConfigDir    = ""
	ConfigFile   = ""
)

Functions

func GetGroupSites

func GetGroupSites(name string) []string

if name is a group, return it's sites, otherwise return nil

func MatchSite added in v0.1.1

func MatchSite(domain string, siteConfig *SiteConfigStruct) bool

func ParseGroupAndOtherNames

func ParseGroupAndOtherNames(names ...string) []string

parse an slice of groupOrOther names, expand group name to site names, return the final slice of names

func ParseGroupAndOtherNamesWithoutDeduplicate

func ParseGroupAndOtherNamesWithoutDeduplicate(names ...string) []string

Types

type ClientConfigStruct

type ClientConfigStruct struct {
	Type                              string  `yaml:"type"`
	Name                              string  `yaml:"name"`
	Disabled                          bool    `yaml:"disabled"`
	Url                               string  `yaml:"url"`
	Username                          string  `yaml:"username"`
	Password                          string  `yaml:"password"`
	BrushMinDiskSpace                 string  `yaml:"brushMinDiskSpace"`
	BrushSlowUploadSpeedTier          string  `yaml:"brushSlowUploadSpeedTier"`
	BrushMaxDownloadingTorrents       int64   `yaml:"brushMaxDownloadingTorrents"`
	BrushMaxTorrents                  int64   `yaml:"brushMaxTorrents"`
	BrushMinRatio                     float64 `yaml:"brushMinRatio"`
	BrushDefaultUploadSpeedLimit      string  `yaml:"brushDefaultUploadSpeedLimit"`
	BrushTorrentSizeLimit             string  `yaml:"brushTorrentSizeLimit"`
	BrushMinDiskSpaceValue            int64
	BrushSlowUploadSpeedTierValue     int64
	BrushDefaultUploadSpeedLimitValue int64
	BrushTorrentSizeLimitValue        int64
	QbittorrentNoLogin                bool `yaml:"qbittorrentNoLogin"` // if set, will NOT send login request
}

func GetClientConfig

func GetClientConfig(name string) *ClientConfigStruct

type ConfigStruct

type ConfigStruct struct {
	IyuuToken        string                `yaml:"iyuuToken"`
	SiteProxy        string                `yaml:"siteProxy"`
	UserAgent        string                `yaml:"userAgent"`
	BrushEnableStats bool                  `yaml:"brushEnableStats"`
	Clients          []*ClientConfigStruct `yaml:"clients"`
	Sites            []*SiteConfigStruct   `yaml:"sites"`
	Groups           []*GroupConfigStruct  `yaml:"groups"`
}

func Get

func Get() *ConfigStruct

type GroupConfigStruct

type GroupConfigStruct struct {
	Name  string   `yaml:"name"`
	Sites []string `yaml:"sites"`
}

type SiteConfigStruct

type SiteConfigStruct struct {
	Type                         string   `yaml:"type"`
	Name                         string   `yaml:"name"`
	Aliases                      []string // for internal use only
	Comment                      string   `yaml:"comment"`
	Disabled                     bool     `yaml:"disabled"`
	Url                          string   `yaml:"url"`
	Domains                      []string `yaml:"domains"` // other site domains (do not include subdomain part)
	TorrentsUrl                  string   `yaml:"torrentsUrl"`
	SearchUrl                    string   `yaml:"searchUrl"`
	TorrentsExtraUrls            []string `yaml:"torrentsExtraUrls"`
	Cookie                       string   `yaml:"cookie"`
	UserAgent                    string   `yaml:"userAgent"`
	Proxy                        string   `yaml:"proxy"`
	TorrentUploadSpeedLimit      string   `yaml:"uploadSpeedLimit"`
	GlobalHnR                    bool     `yaml:"globalHnR"`
	Timezone                     string   `yaml:"timezone"`
	BrushAllowNoneFree           bool     `yaml:"brushAllowNoneFree"`
	SelectorTorrentsListHeader   string   `yaml:"selectorTorrentsListHeader"`
	SelectorTorrentsList         string   `yaml:"selectorTorrentsList"`
	SelectorTorrentBlock         string   `yaml:"selectorTorrentBlock"` // dom block of a torrent in list
	SelectorTorrent              string   `yaml:"selectorTorrent"`
	SelectorTorrentDownloadLink  string   `yaml:"selectorTorrentDownloadLink"`
	SelectorTorrentDetailsLink   string   `yaml:"selectorTorrentDetailsLink"`
	SelectorTorrentTime          string   `yaml:"selectorTorrentTime"`
	SelectorTorrentSeeders       string   `yaml:"selectorTorrentSeeders"`
	SelectorTorrentLeechers      string   `yaml:"selectorTorrentLeechers"`
	SelectorTorrentSnatched      string   `yaml:"selectorTorrentSnatched"`
	SelectorTorrentSize          string   `yaml:"selectorTorrentSize"`
	SelectorTorrentProcessBar    string   `yaml:"selectorTorrentProcessBar"`
	SelectorTorrentFree          string   `yaml:"SelectorTorrentFree"`
	SelectorUserInfo             string   `yaml:"selectorUserInfo"`
	SelectorUserInfoUserName     string   `yaml:"selectorUserInfoUserName"`
	SelectorUserInfoUploaded     string   `yaml:"selectorUserInfoUploaded"`
	SelectorUserInfoDownloaded   string   `yaml:"selectorUserInfoDownloaded"`
	TorrentUploadSpeedLimitValue int64
}

func GetSiteConfig added in v0.1.1

func GetSiteConfig(name string) *SiteConfigStruct

func (*SiteConfigStruct) GetName

func (siteConfig *SiteConfigStruct) GetName() string

func (*SiteConfigStruct) ParseSiteUrl

func (siteConfig *SiteConfigStruct) ParseSiteUrl(siteUrl string, appendQueryStringDelimiter bool) string

parse a site internal url (eg. special.php), return absolute url

Jump to

Keyboard shortcuts

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