reseed

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: 19 Imported by: 0

Documentation

Index

Constants

View Source
const RESEED_API = "https://reseed-api.tongyifan.me/"

Reseed API backend: https://github.com/tongyifan/Reseed-backend , it's a sock.io server, with the main websocket API and some additional RESTful APIs. All APIs (except "login" API) requires authorization token in header: "Authorization: Bearar <token>". To acquire token: POST https://reseed-api.tongyifan.me/login with username & password, receive json {msg, success: true, token}. token is ephemeral, expires in 1 day. Note for websocket API, if token does NOT exists, server will return 500 error when connecting; however, if token exists but is expired or invalid, server will just hang (do NOT response to any request). The websocket API uses sock.io events: "file" event: client -> server. "reseed result" event: server -> client. Note the websocket API ONLY accept frames that is pure ASCII, all unicode characters in JSON must be encoded in '\uXXXX' format.

Variables

View Source
var Command = &cobra.Command{
	Use:   "reseed",
	Short: "Cross seed automation tool using Reseed (https://github.com/tongyifan/Reseed-backend) API.",
	Long:  `Cross seed automation tool using Reseed (https://github.com/tongyifan/Reseed-backend) API.`,
}

Functions

func Escape2Anscii

func Escape2Anscii(s string) string

Escape all unicode (non-ASCII) characters to '\uXXXX' format.

func GenerateReseed2LocalSiteMap

func GenerateReseed2LocalSiteMap(reseedSites []Site,
	localSites []*config.SiteConfigStruct) map[string]string

return ReseedSite => localSiteName map

func GetReseedTorrents

func GetReseedTorrents(username string, password string, sites []*config.SiteConfigStruct, timeout int64,
	savePath ...string) (results []*Torrent, results2 []*Torrent, err error)

Request Reseed API and return xseed torrents (full match (success) & partial match (warning) results) found by Reseed backend.

func Login

func Login(username string, password string) (token string, err error)

Types

type File

type File map[string]any

the "file" event payload of Reseed sock.io API

func (File) MarshalJSON

func (f File) MarshalJSON() ([]byte, error)

It's performance is terrible, but who cares?

type ReseedLoginResult

type ReseedLoginResult struct {
	Msg     string
	Success bool
	Token   string
}

type ReseedResult

type ReseedResult struct {
	Name       string             `json:"name,omitempty"`
	CmpSuccess []ReseedResultSite `json:"cmp_success,omitempty"`
	CmpWarning []ReseedResultSite `json:"cmp_warning,omitempty"`
}

the 'reseed result' event returned by Reseed backend see https://github.com/tongyifan/Reseed-backend/blob/890dfcb20b98684bf315c8c9f5352c062ae93166/views/reseed.py#L57

type ReseedResultSite

type ReseedResultSite struct {
	// reseed torrent id
	Id int64 `json:"id,omitempty"`
	// comma-separated site torrent ids, e.g. NexusHD-123456,HDU-23456,TJUPT-34567
	Sites string `json:"sites,omitempty"`
}

type Site

type Site struct {
	BaseUrl string `json:"base_url,omitempty"` // e.g. "https://hdtime.org/"
	Name    string `json:"name,omitempty"`     // e.g. "HDTIME"

}

func (*Site) MatchFilter

func (site *Site) MatchFilter(filter string) bool

type Torrent

type Torrent struct {
	Id       string // local site torrent id, e.g. hdupt.23456
	ReseedId string // Reseed torrent id, e.g. HDU-23456
	SavePath string // Local path of torrent contents, e.g. D:\Downloads
	Filename string // Filename of torrent content file or root folder
	Success  bool   // true: a full match (success). false: partial-match (warning)
}

func (*Torrent) String

func (t *Torrent) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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