Documentation ¶
Index ¶
- func Bint(b bool) int
- func FileSimilarity(f1, f2 whatapi.FileStruct) float64
- func NullableBInt(b *bool) *int
- func NullableString(s *string) string
- func Similarity(a, b string) float64
- func SizeSimilarity(s1, s2 int64) float64
- type Artist
- type ArtistList
- type Artists
- type Candidate
- type Candidates
- type Group
- type Role
- type Roles
- type Torrent
- func NewArtist(tracker Tracker, a whatapi.Artist) (torrents []Torrent, err error)
- func NewGetTorrentStruct(tracker Tracker, tr whatapi.GetTorrentStruct) (Torrent, error)
- func NewSearchTorrentStruct(g Group, rt whatapi.SearchTorrentStruct) (Torrent, error)
- func NewTopTenTorrents(tracker Tracker, tt whatapi.TopTenTorrents) ([]Torrent, error)
- func NewTorrentGroup(tracker Tracker, tg whatapi.TorrentGroup) ([]Torrent, error)
- func NewTorrentSearch(tracker Tracker, ts whatapi.TorrentSearch) ([]Torrent, error)
- func NewTorrentStruct(g Group, t whatapi.TorrentStruct) (Torrent, error)
- func (t Torrent) FileSimilarity(t2 Torrent) float64
- func (t *Torrent) Fill(tx *sqlx.Tx) error
- func (t Torrent) Find(db *sqlx.DB, disc discogs.DB, dst Tracker) (Candidates, error)
- func (t *Torrent) GetArtists(db *sqlx.DB) error
- func (t *Torrent) GetFiles(db *sqlx.DB) error
- func (t Torrent) ReleaseSimilarity(t2 Torrent) float64
- func (t *Torrent) Remaster() string
- func (t Torrent) ShortName() string
- func (t Torrent) Similarity(t2 Torrent) float64
- func (t *Torrent) String() string
- func (t Torrent) Update(tx *sqlx.Tx) error
- func (t Torrent) UpdateFiles(tx *sqlx.Tx) error
- type Tracker
- func (t Tracker) GetArtist(id int) ([]Torrent, error)
- func (t Tracker) GetArtistByName(n string) ([]Torrent, error)
- func (t Tracker) GetGroup(id int) ([]Torrent, error)
- func (t Tracker) GetGroupByHash(h string) ([]Torrent, error)
- func (t Tracker) GetTorrent(id int) (Torrent, error)
- func (t Tracker) GetTorrentByHash(h string) (Torrent, error)
- func (t Tracker) Search(params url.Values) ([]Torrent, error)
- func (t Tracker) Top10(params url.Values) ([]Torrent, error)
- type WeightedScore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileSimilarity ¶ added in v0.3.0
func FileSimilarity(f1, f2 whatapi.FileStruct) float64
FileSimilarity measures how similar two files are, considring their names and lengths, with 0.0 being not similar at all, and 1.0 being identical
func NullableBInt ¶
func NullableString ¶
func Similarity ¶ added in v0.3.0
Similarity measures how similar two strings are from [0.0..1.0] where 0.0 is no similarity at all and 1.0 is equal strings
func SizeSimilarity ¶ added in v0.7.0
SizeSimilarity measures how similar two file sizes are with 0.0 being not similar at all, and 1.0 being identical Arbitrarily, if one file is 1/2 the size of the other, it's 0.1 similar
Types ¶
type Artist ¶
Artist is a single gazelle artist
func (Artist) Similarity ¶ added in v0.3.0
Similarity measures how similar two artists are with 0.0 being not at all and 1.0 being the same
type ArtistList ¶ added in v0.3.0
type ArtistList []Artist
ArtistList is just a list of Artist
func (ArtistList) DisplayName ¶ added in v0.3.0
func (a ArtistList) DisplayName(role string) string
DisplayName for an artist list is the human readable form of the list, or "Various <role>" if multiple
func (ArtistList) Names ¶ added in v0.3.0
func (a ArtistList) Names() []string
Names returns the names of all the artists in the list
func (ArtistList) Similarity ¶ added in v0.4.0
func (a ArtistList) Similarity(a2 ArtistList) float64
Similarity returns how similar two list of artists are with 0.0 being not at all similar and 1.0 being completely the same
type Artists ¶
Artists is a tracker and a set of artists and their roles usually associated with a group
func NewExtendedArtistMap ¶
func NewExtendedArtistMap(tracker Tracker, am whatapi.ExtendedArtistMap) Artists
NewExtendedArtistMap creates Artists from a tracker and a whatapi.ExtendedArtistMap
func NewMusicInfo ¶
NewMusicInfo creates Artists from a tracker and whatapi.MusicInfo struct
func (Artists) DisplayName ¶
DisplayName for artists is the human readable string formatting of the artists, intended to replicate the internal gazelle logic for formatting artist names
func (Artists) Similarity ¶ added in v0.3.0
Similarity measures the similarities of two Artists structs, where 0.0 is not at all similar, and 1.0 is identical it is just the similarity of the roles
type Candidate ¶ added in v0.7.0
Candidate is a possible match for a torrent on another tracker P is the probability that it's a match
type Candidates ¶ added in v0.7.0
type Candidates []Candidate
Candidates is a list of candidate matches
func (Candidates) Len ¶ added in v0.7.0
func (c Candidates) Len() int
func (Candidates) Less ¶ added in v0.7.0
func (c Candidates) Less(i, j int) bool
func (Candidates) Swap ¶ added in v0.7.0
func (c Candidates) Swap(i, j int)
type Group ¶
type Group struct { Artists ID int `db:"groupid"` Name string `db:"groupname"` Year int `db:"year"` RecordLabel *string `db:"recordlabel"` CatalogueNumber *string `db:"cataloguenumber"` ReleaseTypeF int `db:"releasetype"` CategoryID *int `db:"categoryid"` CategoryName *string `db:"categoryname"` Time *time.Time `db:"time"` VanityHouse bool `db:"vanityhouse"` WikiImage *string `db:"wikiimage"` WikiBody *string `db:"wikibody"` IsBookmarked *bool `db:"isbookmarked"` Tags string `db:"tags"` }
func NewGroupSearchResult ¶
func NewGroupSearchResult(tracker Tracker, srs whatapi.TorrentSearchResultStruct) (Group, error)
func NewGroupStruct ¶
func NewGroupStruct(tracker Tracker, gs whatapi.GroupStruct) (g Group, err error)
func (Group) ReleaseType ¶
func (Group) Similarity ¶ added in v0.4.0
Similarity measures how similar two groups are with 0.0 for not at all similar, and 1.0 as the same
type Role ¶ added in v0.4.0
type Role string
Role is the name of an artist's role on a release
func (Role) Importance ¶ added in v0.5.1
Importance maps a role name onto its integer encoding
type Roles ¶ added in v0.4.0
type Roles map[Role]ArtistList
Roles maps from roles onto lists of artists
func (Roles) Similarity ¶ added in v0.4.0
Similarity returns how similar two sets of roles are with 0.0 being not at all similar and 1.0 being completely the same
type Torrent ¶
type Torrent struct { Group ID int `db:"id"` Hash *string `db:"hash"` Media string `db:"media"` Format string `db:"format"` Encoding string `db:"encoding"` Remastered bool `db:"remastered"` RemasterYear int `db:"remasteryear"` RemasterTitle string `db:"remastertitle"` RemasterRecordLabel *string `db:"remasterlabel"` RemasterCatalogueNumber *string `db:"cataloguenumber"` Scene bool `db:"scene"` HasLog bool `db:"haslog"` HasCue bool `db:"hascue"` LogScore int `db:"logscore"` LogChecksum *bool `db:"logchecksum"` FileCount int `db:"filecount"` Size int64 `db:"size"` Seeders int `db:"seeders"` Leechers int `db:"leechers"` Snatched int `db:"snatched"` FreeTorrent bool `db:"freetorrent"` Reported *bool `db:"reported"` Time time.Time `db:"time"` Description *string `db:"description"` FilePath *string `db:"filepath"` UserID *int `db:"userid"` Username *string `db:"username"` Files []whatapi.FileStruct CanUseToken *bool `db:"canusetoken"` }
func NewGetTorrentStruct ¶
func NewGetTorrentStruct(tracker Tracker, tr whatapi.GetTorrentStruct) (Torrent, error)
func NewSearchTorrentStruct ¶
func NewSearchTorrentStruct(g Group, rt whatapi.SearchTorrentStruct) (Torrent, error)
func NewTopTenTorrents ¶
func NewTopTenTorrents(tracker Tracker, tt whatapi.TopTenTorrents) ([]Torrent, error)
func NewTorrentGroup ¶
func NewTorrentGroup(tracker Tracker, tg whatapi.TorrentGroup) ([]Torrent, error)
func NewTorrentSearch ¶
func NewTorrentSearch( tracker Tracker, ts whatapi.TorrentSearch) ([]Torrent, error)
func NewTorrentStruct ¶
func NewTorrentStruct(g Group, t whatapi.TorrentStruct) (Torrent, error)
func (Torrent) FileSimilarity ¶ added in v0.4.0
FileSimilarity measures how similar the files are between two torrents with 0.0 being not at all similar, and 1.0 being identical
func (Torrent) Find ¶ added in v0.4.0
Find tries to find the equivalent of this torrent on another tracker it returns a candidate, a probability, and if there was an error
func (*Torrent) GetArtists ¶
GetArtists gets all of the artists for a torrent. Usually used when initially populating a torrent (and should probably just be part of get torrent)
func (Torrent) ReleaseSimilarity ¶ added in v0.4.0
ReleaseSimilarity measures how similar two torrent releases are with 0.0 being not at all similar, and 1.0 being identical
func (*Torrent) Remaster ¶ added in v0.5.0
Remaster returns a printable form of the torrents remaster information or an empty string if not remastered
func (Torrent) Similarity ¶ added in v0.7.0
Similarity measures the similarity between two torrents where 0.0 is not at all similar, and 1.0 is identical
type Tracker ¶
type Tracker struct { whatapi.Client Name string `db:"tracker"` Other string Path string Host string Conf string ReleaseTypes map[int]string Categories map[int]string TokenSize int64 // torrents bigger than this, try to use a token // contains filtered or unexported fields }
Tracker represents a gazelle tracker and implements the Client interface
type WeightedScore ¶ added in v0.3.0
type WeightedScore struct {
// contains filtered or unexported fields
}
WeightedScore lets you compute a single weighted score from a series of scores and weights. It uses the geometric mean (distance) as the Score
func (WeightedScore) Score ¶ added in v0.3.0
func (s WeightedScore) Score() float64
Score is the current value of the WeightedScore
func (*WeightedScore) Update ¶ added in v0.3.0
func (s *WeightedScore) Update(sc, w float64)
Update adds a score and weight to the WeightedScore