types

package
v0.0.0-...-fc716ca Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2016 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binary

type Binary struct {
	ID         int64
	Hash       string `sql:"size:16"`
	Name       string `sql:"size:512"`
	TotalParts int
	Posted     time.Time
	From       string
	Xref       string `sql:"size:1024"`
	GroupName  string
	Parts      []Part
}

Binary struct

func (*Binary) Size

func (b *Binary) Size() int64

Size computes size of Binary

type Category

type Category int

Category represents what type of thing a release is

const (
	Unknown Category = -1
	Other   Category = 0

	Console Category = 1000
	Movies  Category = 2000
	Audio   Category = 3000
	PC      Category = 4000
	TV      Category = 5000
	XXX     Category = 6000
	Books   Category = 7000

	Other_Misc   Category = 10
	Other_Hashed Category = 20

	Console_NDS        Category = 1010
	Console_PSP        Category = 1020
	Console_Wii        Category = 1030
	Console_Xbox       Category = 1040
	Console_Xbox360    Category = 1050
	Console_WiiWareVC  Category = 1060
	Console_XBOX360DLC Category = 1070
	Console_PS3        Category = 1080
	Console_Other      Category = 1090
	Console_3DS        Category = 1110
	Console_PSVita     Category = 1120
	Console_WiiU       Category = 1130
	Console_XboxOne    Category = 1140
	Console_PS4        Category = 1180

	Movie_Foreign Category = 2010
	Movie_Other   Category = 2020
	Movie_SD      Category = 2030
	Movie_HD      Category = 2040
	Movie_3D      Category = 2050
	Movie_BluRay  Category = 2060
	Movie_DVD     Category = 2070
	Movie_WEBDL   Category = 2080

	Audio_MP3       Category = 3010
	Audio_Video     Category = 3020
	Audio_Audiobook Category = 3030
	Audio_Lossless  Category = 3040
	Audio_Other     Category = 3050
	Audio_Foreign   Category = 3060

	PC_0day         Category = 4010
	PC_ISO          Category = 4020
	PC_Mac          Category = 4030
	PC_PhoneOther   Category = 4040
	PC_Games        Category = 4050
	PC_PhoneIOS     Category = 4060
	PC_PhoneAndroid Category = 4070

	TV_WEBDL       Category = 5010
	TV_Foreign     Category = 5020
	TV_SD          Category = 5030
	TV_HD          Category = 5040
	TV_Other       Category = 5050
	TV_Sport       Category = 5060
	TV_Anime       Category = 5070
	TV_Documentary Category = 5080

	XXX_DVD      Category = 6010
	XXX_WMV      Category = 6020
	XXX_XviD     Category = 6030
	XXX_x264     Category = 6040
	XXX_Other    Category = 6050
	XXX_Imageset Category = 6060
	XXX_Packs    Category = 6070
	XXX_SD       Category = 6080
	XXX_WEBDL    Category = 6090

	Book_Ebook     Category = 7010
	Book_Comics    Category = 7020
	Book_Magazines Category = 7030
	Book_Technical Category = 7040
	Book_Other     Category = 7050
	Book_Foreign   Category = 7060
)

Category Constants, just for use when matching and setting categories. DB has it's own representation. The INT values here and in the DB IDs must be kept in sync

func CategoryFromInt

func CategoryFromInt(i int64) Category

CategoryFromInt returns a Category corresponding to the given int or Unknown if there isn't one.

func (Category) String

func (c Category) String() string

type DBCategory

type DBCategory struct {
	ID             int64         `json:"id"`
	Name           string        `json:"name"`
	Active         bool          `json:"-"`
	Description    string        `json:"-"`
	DisablePreview bool          `json:"-"`
	MinSize        int           `json:"-"`
	Parent         *DBCategory   `json:"-"`
	ParentID       sql.NullInt64 `json:"-"`
	SubCategories  []DBCategory  `sql:"-" json:"subcat"`
}

DBCategory maps category information from the DB to a struct. Information should be mirrored in the Category constants.

func (*DBCategory) IsParent

func (d *DBCategory) IsParent() bool

IsParent returns true if the Category's parent

func (DBCategory) TableName

func (d DBCategory) TableName() string

TableName sets the name of the table to use when querying the db

type Group

type Group struct {
	ID       int64
	Active   bool `sql:"index"`
	First    int64
	Last     int64
	Name     string `sql:"unique"`
	MinFiles int
	MinSize  int64
}

Group struct

type MessageNumber

type MessageNumber int64

+gen set

type MessageNumberSet

type MessageNumberSet map[MessageNumber]struct{}

MessageNumberSet is the primary type that represents a set

func NewMessageNumberSet

func NewMessageNumberSet(a ...MessageNumber) MessageNumberSet

NewMessageNumberSet creates and returns a reference to an empty set.

func (MessageNumberSet) Add

func (set MessageNumberSet) Add(i MessageNumber) bool

Add adds an item to the current set if it doesn't already exist in the set.

func (MessageNumberSet) Cardinality

func (set MessageNumberSet) Cardinality() int

Cardinality returns how many items are currently in the set.

func (*MessageNumberSet) Clear

func (set *MessageNumberSet) Clear()

Clear clears the entire set to be the empty set.

func (MessageNumberSet) Clone

func (set MessageNumberSet) Clone() MessageNumberSet

Clone returns a clone of the set. Does NOT clone the underlying elements.

func (MessageNumberSet) Contains

func (set MessageNumberSet) Contains(i MessageNumber) bool

Contains determines if a given item is already in the set.

func (MessageNumberSet) ContainsAll

func (set MessageNumberSet) ContainsAll(i ...MessageNumber) bool

ContainsAll determines if the given items are all in the set

func (MessageNumberSet) Difference

func (set MessageNumberSet) Difference(other MessageNumberSet) MessageNumberSet

Difference returns a new set with items in the current set but not in the other set

func (MessageNumberSet) Equal

func (set MessageNumberSet) Equal(other MessageNumberSet) bool

Equal determines if two sets are equal to each other. If they both are the same size and have the same items they are considered equal. Order of items is not relevent for sets to be equal.

func (MessageNumberSet) Intersect

func (set MessageNumberSet) Intersect(other MessageNumberSet) MessageNumberSet

Intersect returns a new set with items that exist only in both sets.

func (MessageNumberSet) IsSubset

func (set MessageNumberSet) IsSubset(other MessageNumberSet) bool

IsSubset determines if every item in the other set is in this set.

func (MessageNumberSet) IsSuperset

func (set MessageNumberSet) IsSuperset(other MessageNumberSet) bool

IsSuperset determines if every item of this set is in the other set.

func (MessageNumberSet) Iter

func (set MessageNumberSet) Iter() <-chan MessageNumber

Iter returns a channel of type MessageNumber that you can range over.

func (MessageNumberSet) Remove

func (set MessageNumberSet) Remove(i MessageNumber)

Remove allows the removal of a single item in the set.

func (MessageNumberSet) SymmetricDifference

func (set MessageNumberSet) SymmetricDifference(other MessageNumberSet) MessageNumberSet

SymmetricDifference returns a new set with items in the current set or the other set but not in both.

func (MessageNumberSet) ToSlice

func (set MessageNumberSet) ToSlice() []MessageNumber

ToSlice returns the elements of the current set as a slice

func (MessageNumberSet) Union

Union returns a new set with all items in both sets.

type MissedMessage

type MissedMessage struct {
	ID            int64
	MessageNumber int64
	GroupName     string
	Attempts      int
}

MissedMessage represents a message we expected to get from the server in an OVERVIEW range but wasn't returned. Save the message id for retry later.

type Part

type Part struct {
	ID            int64
	Hash          string `sql:"index;size:16"`
	Subject       string `sql:"size:512"`
	TotalSegments int    `sql:"index"`
	Posted        time.Time
	From          string
	Xref          string `sql:"size:1024"`
	GroupName     string `sql:"index"`
	Binary        Binary
	BinaryID      sql.NullInt64
	Segments      []Segment
}

Part struct

type Regex

type Regex struct {
	ID                 int
	Regex              string `sql:"size:2048"`
	Description        string
	Status             bool
	Ordinal            int
	GroupRegex         string
	Kind               string
	Compiled           *RegexpUtil `sql:"-"` // Ignore for DB
	CompiledGroupRegex *RegexpUtil `sql:"-"` // Ignore for DB
}

Regex Comment

func (*Regex) Compile

func (r *Regex) Compile() error

Compile the Regex and stores it in the Compiled attribute. CompiledGroupRegex respectively.

func (Regex) TableName

func (r Regex) TableName() string

TableName sets the name of the table to use when querying the db

type RegexpUtil

type RegexpUtil struct {
	Regex *regexp.Regexp
}

RegexpUtil embed regexp.Regexp in a new type so we can extend it

func (*RegexpUtil) FindStringSubmatchMap

func (r *RegexpUtil) FindStringSubmatchMap(s string) map[string]string

FindStringSubmatchMap returns named matches in a map

type Release

type Release struct {
	ID           int64
	Hash         string
	CreatedAt    time.Time
	Posted       time.Time
	Name         string
	SearchName   string
	OriginalName string
	From         string
	Status       int
	Grabs        int
	Size         int64
	Group        Group
	GroupID      sql.NullInt64
	Category     DBCategory `gorm:"column:category"`
	CategoryID   sql.NullInt64
	NZB          string `sql:"size:0" gorm:"column:nzb"`
}

Release struct

func (*Release) CategoryName

func (r *Release) CategoryName() Category

CategoryName returns the constant Category of the Release's Category

type Segment

type Segment struct {
	ID        int64
	Segment   int
	Size      int64
	MessageID string
	Part      Part
	PartID    sql.NullInt64
}

Segment struct

Jump to

Keyboard shortcuts

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