gazelle

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 License: MIT Imports: 8 Imported by: 0

README

Go interface to Gazelle API

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bint

func Bint(b bool) int

func NullableBInt

func NullableBInt(b *bool) *int

func NullableString

func NullableString(s *string) string

Types

type Artist

type Artist struct {
	ID   int    `db:"id"`
	Name string `db:"name"`
}

Artist is a single gazelle artist

func (Artist) Update

func (a Artist) Update(tx *sqlx.Tx, tracker Tracker) error

Update artist stores the artist in the db

type Artists

type Artists struct {
	Tracker
	Artists map[string][]Artist
}

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

func NewMusicInfo(tracker Tracker, mi whatapi.MusicInfo) Artists

NewMusicInfo creates Artists from a tracker and whatapi.MusicInfo struct

func (Artists) DisplayName

func (a Artists) DisplayName() string

Display name for artists is the human readable string formatting of the artists, intended to replicate the internal gazelle logic for formatting artist names

func (Artists) Names

func (a Artists) Names() []string

Names returns a list of the main artists names from an artist list

func (Artists) Update

func (a Artists) Update(tx *sqlx.Tx) error

Update artists just updates each artist in the aggregate

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 (g Group) ReleaseType() string

func (Group) Update

func (g Group) Update(tx *sqlx.Tx) error

func (Group) UpdateArtistsGroups

func (g Group) UpdateArtistsGroups(tx *sqlx.Tx) error

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 NewArtist

func NewArtist(tracker Tracker, a whatapi.Artist) (torrents []Torrent, err error)

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) Fill

func (t *Torrent) Fill(tx *sqlx.Tx) error

func (*Torrent) GetArtists

func (t *Torrent) GetArtists(db *sqlx.DB) error

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) GetFiles

func (t *Torrent) GetFiles(db *sqlx.DB) error

func (Torrent) ShortName

func (t Torrent) ShortName() string

func (*Torrent) String

func (t *Torrent) String() string

func (Torrent) Update

func (t Torrent) Update(tx *sqlx.Tx) error

func (Torrent) UpdateCross

func (t Torrent) UpdateCross(tx *sqlx.Tx, dst Torrent) error

func (Torrent) UpdateFiles

func (t Torrent) UpdateFiles(tx *sqlx.Tx) error

type Tracker

type Tracker struct {
	whatapi.WhatAPI
	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 WhatAPI interface

func (Tracker) GetArtist

func (t Tracker) GetArtist(id int) ([]Torrent, error)

func (Tracker) GetArtistByName

func (t Tracker) GetArtistByName(n string) ([]Torrent, error)

func (Tracker) GetGroup

func (t Tracker) GetGroup(id int) ([]Torrent, error)

func (Tracker) GetGroupByHash

func (t Tracker) GetGroupByHash(h string) ([]Torrent, error)

func (Tracker) GetTorrent

func (t Tracker) GetTorrent(id int) (Torrent, error)

func (Tracker) GetTorrentByHash

func (t Tracker) GetTorrentByHash(h string) (Torrent, error)

func (Tracker) Search

func (t Tracker) Search(params url.Values) ([]Torrent, error)

func (Tracker) Top10

func (t Tracker) Top10(params url.Values) ([]Torrent, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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