Documentation ¶
Overview ¶
Package gozelle provides access to the Gazelle API.
Index ¶
- Variables
- func Downloadlink(host, authkey, passkey string, torrentid int) (string, error)
- type ArtistResponse
- type Client
- func (c *Client) Artist(id int, name string) (ArtistResponse, error)
- func (c *Client) Do(action string, v url.Values, resp interface{}) error
- func (c *Client) Download(id int) (io.ReadCloser, error)
- func (c *Client) Downloadlink(id int) (string, error)
- func (c *Client) Index() (IndexResponse, error)
- func (c *Client) Login(host, user, pass string) (r IndexResponse, err error)
- func (c *Client) SearchTorrents(search string, page int, filters *TorrentsFilter) (TorrentSearchResponse, error)
- func (c *Client) Torrent(id int, hash string) (TorrentResponse, error)
- func (c *Client) TorrentGroup(id int, hash string) (TorrentGroupResponse, error)
- func (c *Client) User(id int) (UserResponse, error)
- type IndexResponse
- type TorrentGroupResponse
- type TorrentResponse
- type TorrentSearchResponse
- type TorrentsFilter
- type UserResponse
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type ArtistResponse ¶
type ArtistResponse struct { Response struct { Body string `json:"body"` HasBookmarked bool `json:"hasBookmarked"` ID int `json:"id"` Image string `json:"image"` Name string `json:"name"` NotificationsEnabled bool `json:"notificationsEnabled"` Requests []struct { Bounty int `json:"bounty"` CategoryId int `json:"categoryId"` RequestId int `json:"requestId"` TimeAdded string `json:"timeAdded"` Title string `json:"title"` Votes int `json:"votes"` Year int `json:"year"` } `json:"requests"` SimilarArtists []interface{} `json:"similarArtists"` Statistics struct { NumGroups int `json:"numGroups"` NumLeechers int `json:"numLeechers"` NumSeeders int `json:"numSeeders"` NumSnatches int `json:"numSnatches"` NumTorrents int `json:"numTorrents"` } `json:"statistics"` Tags []struct { Count int `json:"count"` Name string `json:"name"` } `json:"tags"` Torrentgroup []struct { GroupCatalogueNumber string `json:"groupCatalogueNumber"` GroupId int `json:"groupId"` GroupName string `json:"groupName"` GroupRecordLabel string `json:"groupRecordLabel"` GroupVanityHouse bool `json:"groupVanityHouse"` GroupYear int `json:"groupYear"` HasBookmarked bool `json:"hasBookmarked"` ReleaseType int `json:"releaseType"` Tags []string `json:"tags"` Torrent []struct { Encoding string `json:"encoding"` FileCount int `json:"fileCount"` Format string `json:"format"` FreeTorrent bool `json:"freeTorrent"` GroupId int `json:"groupId"` HasCue bool `json:"hasCue"` HasFile int `json:"hasFile"` HasLog bool `json:"hasLog"` ID int `json:"id"` Leechers int `json:"leechers"` LogScore int `json:"logScore"` Media string `json:"media"` RemasterRecordLabel string `json:"remasterRecordLabel"` RemasterTitle string `json:"remasterTitle"` RemasterYear int `json:"remasterYear"` Remastered bool `json:"remastered"` Scene bool `json:"scene"` Seeders int `json:"seeders"` Size int `json:"size"` Snatched int `json:"snatched"` Time string `json:"time"` } `json:"torrent"` } `json:"torrentgroup"` VanityHouse bool `json:"vanityHouse"` } `json:"response"` Status string `json:"status"` }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A client handles the connection to the API.
func NewWithClient ¶
NewWithClient creates a new Gazelle API client with a custom HTTP client. The HTTP client must support cookie storage.
func (*Client) Artist ¶
func (c *Client) Artist(id int, name string) (ArtistResponse, error)
Artist retrieves info of a specific artist, either by providing an exact id greater than 0 or a non-empty artist name.
func (*Client) Do ¶
Do makes a generic request to the API with the specified arguments and unmarshals the JSON response into resp.
func (*Client) Download ¶
func (c *Client) Download(id int) (io.ReadCloser, error)
Download fetches a torrent file. The file body is returned as an ReadCloser and can be zero length if the torrent id / authentication is wrong.
func (*Client) Downloadlink ¶
Downloadlink generates a download link for the specified torrent file that can be used externally. The link includes personal authentication data.
func (*Client) Index ¶
func (c *Client) Index() (IndexResponse, error)
Index retrieves a few user stats.
func (*Client) Login ¶
func (c *Client) Login(host, user, pass string) (r IndexResponse, err error)
Login connects to the Gazelle host with username and password. It returns user stats on successful login, or an error message otherwise.
func (*Client) SearchTorrents ¶
func (c *Client) SearchTorrents(search string, page int, filters *TorrentsFilter) (TorrentSearchResponse, error)
SearchTorrents retrieves torrents based on a search query. If filters is not nil, the search is narrowed down.
func (*Client) Torrent ¶
func (c *Client) Torrent(id int, hash string) (TorrentResponse, error)
Torrent retrieves info of a specific torrent, either by providing an exact id greater than 0 or a non-empty torrent hash.
func (*Client) TorrentGroup ¶
func (c *Client) TorrentGroup(id int, hash string) (TorrentGroupResponse, error)
TorrentGroup retrieves info of a specific torrent group, either by providing an exact id greater than 0 or a non-empty torrent hash.of a torrent in the group.
type IndexResponse ¶
type IndexResponse struct { Response struct { Authkey string `json:"authkey"` ID int `json:"id"` Notifications struct { Messages int `json:"messages"` NewAnnouncement bool `json:"newAnnouncement"` NewBlog bool `json:"newBlog"` Notifications int `json:"notifications"` } `json:"notifications"` Passkey string `json:"passkey"` Username string `json:"username"` Userstats struct { Class string `json:"class"` Downloaded int `json:"downloaded"` Ratio float64 `json:"ratio"` Requiredratio float64 `json:"requiredratio"` Uploaded int `json:"uploaded"` } `json:"userstats"` } `json:"response"` Status string `json:"status"` }
type TorrentGroupResponse ¶
type TorrentGroupResponse struct { Response struct { Group struct { CatalogueNumber string `json:"catalogueNumber"` CategoryId int `json:"categoryId"` CategoryName string `json:"categoryName"` ID int `json:"id"` MusicInfo struct { Artists []struct { ID int `json:"id"` Name string `json:"name"` } `json:"artists"` Composers []interface{} `json:"composers"` Conductor []interface{} `json:"conductor"` Dj []interface{} `json:"dj"` Producer []interface{} `json:"producer"` RemixedBy []interface{} `json:"remixedBy"` With []struct { ID int `json:"id"` Name string `json:"name"` } `json:"with"` } `json:"musicInfo"` Name string `json:"name"` RecordLabel string `json:"recordLabel"` ReleaseType int `json:"releaseType"` Time string `json:"time"` VanityHouse bool `json:"vanityHouse"` WikiBody string `json:"wikiBody"` WikiImage string `json:"wikiImage"` Year int `json:"year"` } `json:"group"` Torrents []struct { Description string `json:"description"` Encoding string `json:"encoding"` FileCount int `json:"fileCount"` FileList string `json:"fileList"` FilePath string `json:"filePath"` Format string `json:"format"` FreeTorrent bool `json:"freeTorrent"` HasCue bool `json:"hasCue"` HasLog bool `json:"hasLog"` ID int `json:"id"` Leechers int `json:"leechers"` LogScore int `json:"logScore"` Media string `json:"media"` RemasterCatalogueNumber string `json:"remasterCatalogueNumber"` RemasterRecordLabel string `json:"remasterRecordLabel"` RemasterTitle string `json:"remasterTitle"` RemasterYear int `json:"remasterYear"` Remastered bool `json:"remastered"` Scene bool `json:"scene"` Seeders int `json:"seeders"` Size int `json:"size"` Snatched int `json:"snatched"` Time string `json:"time"` UserId int `json:"userId"` Username interface{} `json:"username"` } `json:"torrents"` } `json:"response"` Status string `json:"status"` }
type TorrentResponse ¶
type TorrentResponse struct { Response struct { Group struct { CatalogueNumber string `json:"catalogueNumber"` CategoryId int `json:"categoryId"` CategoryName string `json:"categoryName"` ID int `json:"id"` MusicInfo struct { Artists []struct { ID int `json:"id"` Name string `json:"name"` } `json:"artists"` Composers []interface{} `json:"composers"` Conductor []interface{} `json:"conductor"` Dj []interface{} `json:"dj"` Producer []interface{} `json:"producer"` RemixedBy []interface{} `json:"remixedBy"` With []struct { ID int `json:"id"` Name string `json:"name"` } `json:"with"` } `json:"musicInfo"` Name string `json:"name"` RecordLabel string `json:"recordLabel"` ReleaseType int `json:"releaseType"` Time string `json:"time"` VanityHouse bool `json:"vanityHouse"` WikiBody string `json:"wikiBody"` WikiImage string `json:"wikiImage"` Year int `json:"year"` } `json:"group"` Torrent struct { Description string `json:"description"` Encoding string `json:"encoding"` FileCount int `json:"fileCount"` FileList string `json:"fileList"` FilePath string `json:"filePath"` Format string `json:"format"` FreeTorrent bool `json:"freeTorrent"` HasCue bool `json:"hasCue"` HasLog bool `json:"hasLog"` ID int `json:"id"` Leechers int `json:"leechers"` LogScore int `json:"logScore"` Media string `json:"media"` RemasterCatalogueNumber string `json:"remasterCatalogueNumber"` RemasterRecordLabel string `json:"remasterRecordLabel"` RemasterTitle string `json:"remasterTitle"` RemasterYear int `json:"remasterYear"` Remastered bool `json:"remastered"` Scene bool `json:"scene"` Seeders int `json:"seeders"` Size int `json:"size"` Snatched int `json:"snatched"` Time string `json:"time"` UserId int `json:"userId"` Username interface{} `json:"username"` } `json:"torrent"` } `json:"response"` Status string `json:"status"` }
type TorrentSearchResponse ¶
type TorrentSearchResponse struct { Response struct { CurrentPage int `json:"currentPage"` Pages int `json:"pages"` Results []struct { Artist string `json:"artist"` Bookmarked bool `json:"bookmarked"` GroupId int `json:"groupId"` GroupName string `json:"groupName"` GroupTime string `json:"groupTime"` GroupYear int `json:"groupYear"` MaxSize int `json:"maxSize"` ReleaseType string `json:"releaseType"` Tags []string `json:"tags"` Torrents []struct { Artists []struct { Aliasid int `json:"aliasid"` ID int `json:"id"` Name string `json:"name"` } `json:"artists"` CanUseToken bool `json:"canUseToken"` EditionId int `json:"editionId"` Encoding string `json:"encoding"` FileCount int `json:"fileCount"` Format string `json:"format"` HasCue bool `json:"hasCue"` HasLog bool `json:"hasLog"` IsFreeleech bool `json:"isFreeleech"` IsNeutralLeech bool `json:"isNeutralLeech"` IsPersonalFreeleech bool `json:"isPersonalFreeleech"` Leechers int `json:"leechers"` LogScore int `json:"logScore"` Media string `json:"media"` RemasterCatalogueNumber string `json:"remasterCatalogueNumber"` RemasterTitle string `json:"remasterTitle"` RemasterYear int `json:"remasterYear"` Remastered bool `json:"remastered"` Scene bool `json:"scene"` Seeders int `json:"seeders"` Size int `json:"size"` Snatches int `json:"snatches"` Time string `json:"time"` TorrentId int `json:"torrentId"` VanityHouse bool `json:"vanityHouse"` } `json:"torrents"` TotalLeechers int `json:"totalLeechers"` TotalSeeders int `json:"totalSeeders"` TotalSnatched int `json:"totalSnatched"` VanityHouse bool `json:"vanityHouse"` } `json:"results"` } `json:"response"` Status string `json:"status"` }
type TorrentsFilter ¶
type TorrentsFilter struct { TagList string TagsType string OrderBy string OrderWay string FilterCat string Freetorrent bool Vanityhouse bool Scene bool HasLog bool ReleaseType string Media string Format string Encoding string ArtistName string FileList string GroupName string RecordLabel string CatalogueNumber string Year int RemasterTitle string RemasterYear string RemasterRecordLabel string RemasterCatalogueNumber string }
TorrentsFilter represents a set of search filters.
type UserResponse ¶
type UserResponse struct { Response struct { Avatar string `json:"avatar"` Community struct { CollagesContrib int `json:"collagesContrib"` CollagesStarted int `json:"collagesStarted"` Groups int `json:"groups"` Invited int `json:"invited"` Leeching int `json:"leeching"` PerfectFlacs int `json:"perfectFlacs"` Posts int `json:"posts"` RequestsFilled int `json:"requestsFilled"` RequestsVoted int `json:"requestsVoted"` Seeding int `json:"seeding"` Snatched int `json:"snatched"` TorrentComments int `json:"torrentComments"` Uploaded int `json:"uploaded"` } `json:"community"` IsFriend bool `json:"isFriend"` Personal struct { Class string `json:"class"` Donor bool `json:"donor"` Enabled bool `json:"enabled"` Paranoia int `json:"paranoia"` ParanoiaText string `json:"paranoiaText"` Passkey string `json:"passkey"` Warned bool `json:"warned"` } `json:"personal"` ProfileText string `json:"profileText"` Ranks struct { Artists int `json:"artists"` Bounty int `json:"bounty"` Downloaded int `json:"downloaded"` Overall int `json:"overall"` Posts int `json:"posts"` Requests int `json:"requests"` Uploaded int `json:"uploaded"` Uploads int `json:"uploads"` } `json:"ranks"` Stats struct { Downloaded int `json:"downloaded"` JoinedDate string `json:"joinedDate"` LastAccess string `json:"lastAccess"` Ratio string `json:"ratio"` RequiredRatio float64 `json:"requiredRatio"` Uploaded int `json:"uploaded"` } `json:"stats"` Username string `json:"username"` } `json:"response"` Status string `json:"status"` }