models

package
v0.0.0-...-64a98d2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2025 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPattern

func AddPattern(p Pattern) error

func Setup

func Setup(dsn string) string

Types

type Admin

type Admin struct {
	ID       string `json:"id"`
	Password string `json:"password"`
}

func GetAdminFromDB

func GetAdminFromDB() (Admin, error)

func (*Admin) GenerateToken

func (a *Admin) GenerateToken() (string, error)

func (*Admin) VerifyPassword

func (a *Admin) VerifyPassword(password string) error

type CheckResponse

type CheckResponse struct {
	Valid bool `json:"valid"`
}

type DLTorrent

type DLTorrent struct {
	Hash       string
	Progress   float64
	Quit       chan struct{}
	HttpClient *http.Client
}

func NewDLTorrent

func NewDLTorrent(hash string) *DLTorrent

func (*DLTorrent) UpdateProgress

func (t *DLTorrent) UpdateProgress(progress float64)

type JSONErrorResponse

type JSONErrorResponse struct {
	Code    int      `json:"code"`
	Message string   `json:"message"`
	Errors  []string `json:"errors,omitempty"`
}

type LoginInfo

type LoginInfo struct {
	Url   string `json:"url"`
	Token string `json:"token"`
}

type LoginPayload

type LoginPayload struct {
	Server   string `json:"server"`
	Password string `json:"password"`
}

type Pattern

type Pattern struct {
	ID             string    `json:"id"`
	Source         Source    `json:"source"`
	QueryKeywords  []string  `json:"queryKeywords"`
	SearchKeywords []string  `json:"searchKeywords"`
	DownloadPath   string    `json:"downloadPath"`
	Period         Period    `json:"period"`
	DayIndicator   string    `json:"dayIndicator"`
	FireHour       int       `json:"fireHour"`
	FireMinute     int       `json:"fireMinute"`
	Created        time.Time `json:"created"`
	Updated        time.Time `json:"updated"`
}

func GetPattern

func GetPattern(id string) (Pattern, error)

func GetPatterns

func GetPatterns() ([]Pattern, error)

func (*Pattern) Delete

func (p *Pattern) Delete() error

func (*Pattern) Update

func (p *Pattern) Update() error

type PatternDB

type PatternDB struct {
	ID           string    `db:"id"`
	Source       string    `db:"source"`
	Query        string    `db:"query"`
	Search       string    `db:"search"`
	DownloadPath string    `db:"dlpath"`
	Period       string    `db:"period"`
	Dayind       string    `db:"dayind"`
	FireHour     int       `db:"firehour"`
	FireMinute   int       `db:"fireminute"`
	Created      time.Time `db:"created"`
	Updated      time.Time `db:"updated"`
}

func (*PatternDB) ToPattern

func (p *PatternDB) ToPattern() Pattern

type PatternPayload

type PatternPayload struct {
	Source         string   `json:"source"`
	QueryKeywords  []string `json:"queryKeywords"`
	SearchKeywords []string `json:"searchKeywords"`
	DownloadPath   string   `json:"downloadPath"`
	Period         string   `json:"period"`
	DayIndicator   string   `json:"dayIndicator"`
	FireHour       int      `json:"fireHour"`
	FireMinute     int      `json:"fireMinute"`
}

func (*PatternPayload) ToPattern

func (p *PatternPayload) ToPattern() (Pattern, error)

func (*PatternPayload) Validate

func (p *PatternPayload) Validate() bool

type Period

type Period = string
const (
	Daily   Period = "dayly"
	Weekly  Period = "weekly"
	Monthly Period = "monthly"
)

type SEO

type SEO struct {
	Description string
	Keywords    string
}

type Site

type Site struct {
	AppName  string
	Title    string
	Metatags SEO
	Year     int
}

func GetDefaultSite

func GetDefaultSite(title string) Site

type Source

type Source = string
const (
	Nyaa      Source = "nyaa.si"
	PirateBay Source = "thepiratebay.org"
)

type TokenInfo

type TokenInfo struct {
	Token string `json:"token"`
}

type Torrent

type Torrent struct {
	MagnetLink string    `json:"magnet_link"`
	Keywords   []string  `json:"keywords"`
	Seeders    int       `json:"seeders"`
	Leechers   int       `json:"leechers"`
	Size       int       `json:"size"` // size in Mega Bytes
	Quality    int       `json:"quality"`
	Uploaded   time.Time `json:"uploaded"`
}

func (*Torrent) CalculateQuality

func (t *Torrent) CalculateQuality(SearchKeywords []string)

func (*Torrent) IsValid

func (t *Torrent) IsValid() bool

Jump to

Keyboard shortcuts

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