whatapi

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2019 License: MIT Imports: 15 Imported by: 1

README

whatapi

A Go wrapper for the What.CD JSON API

Install

go get "github.com/kdvh/whatapi"

Example

	wcd, err := whatapi.NewWhatAPI("https://what.cd/")
	if err != nil {
		log.Fatal(err)
	}
	
	err = wcd.Login("username", "password")
	if err != nil {
		log.Fatal(err)
	}
	
	mailboxParams := url.Values{}
	mailboxParams.Set("type", "sentbox")
	mailbox, err := wcd.GetMailbox(mailboxParams)
	if err != nil {
		log.Fatal(err)
	}
	log.Println(mailbox)

	conversation, err := wcd.GetConversation(mailbox.Messages[0].ConvID)
	if err != nil {
		log.Fatal(err)
	}
	log.Println(conversation.Messages[0].Body)

	torrentSearchParams := url.Values{}
	torrentSearch, err := wcd.SearchTorrents("Tool", torrentSearchParams)
	if err != nil {
		log.Fatal(err)
	}

	downloadURL, err := wcd.CreateDownloadURL(torrentSearch.Results[0].Torrents[0].TorrentID)
	if err != nil {
		log.Fatal(downloadURL)
	}
	log.Println(downloadURL)

Documentation

Overview

Package whatapi is a wrapper for the What.CD JSON API (https://github.com/WhatCD/Gazelle/wiki/JSON-API-Documentation).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GroupString

func GroupString(g Group) string

func ReleaseTypeString

func ReleaseTypeString(r int) string

func TorrentString

func TorrentString(t Torrent) string

Types

type Account

type Account struct {
	Username      string `json:"username"`
	ID            int    `json:"id"`
	AuthKey       string `json:"authKey"`
	PassKey       string `json:"passKey"`
	Notifications struct {
		Messages       int  `json:"messages"`
		Notifications  int  `json:"notifications"`
		NewAnnouncment bool `json:"newAnnouncment"`
		NewBlog        bool `json:"newBlog"`
	} `json:"notifications"`
	UserStats struct {
		Uploaded      int64   `json:"uploaded"`
		Downloaded    int64   `json:"downloaded"`
		Ratio         float64 `json:"ratio"`
		RequiredRatio float64 `json:"requiredRatio"`
		Class         string  `json:"class"`
	} `json:"userstats"`
}

type AccountResponse

type AccountResponse struct {
	Status   string  `json:"status"`
	Error    string  `json:"error"`
	Response Account `json:"response"`
}

type Announcements

type Announcements struct {
	Announcements []struct {
		NewsID   int    `json:"newsId"`
		Title    string `json:"title"`
		BbBody   string `json:"bbBody"`
		Body     string `json:"body"`
		NewsTime string `json:"newsTime"`
	} `json:"announcements"`
	BlogPosts []struct {
		BlogID   int    `json:"blogId"`
		Author   string `json:"author"`
		Title    string `json:"title"`
		BbBody   string `json:"bbBody"`
		Body     string `json:"body"`
		BlogTime string `json:"blogTime"`
		ThreadID int    `json:"threadId"`
	} `json:"blogPosts"`
}

type AnnouncementsResponse

type AnnouncementsResponse struct {
	Status   string        `json:"status"`
	Error    string        `json:"error"`
	Response Announcements `json:"response"`
}

type Artist

type Artist struct {
	ID                   int    `json:"id"`
	NameF                string `json:"name"`
	NotificationsEnabled bool   `json:"notificationsEnabled"`
	HasBookmarked        bool   `json:"hasBookmarked"`
	Image                string `json:"image"`
	Body                 string `json:"body"`
	VanityHouse          bool   `json:"vanityHouse"`
	Tags                 []struct {
		Name  string `json:"name"`
		Count int    `json:"count"`
	} `json:"tags"`
	SimilarArtists []struct {
		ArtistID  int    `json:"artistId"`
		Name      string `json:"name"`
		Score     int    `json:"score"`
		SimilarID int    `json:"similarId"`
	} `json:"similarArtists"`
	Statistics struct {
		NumGroups   int `json:"numGroups"`
		NumTorrents int `json:"numTorrents"`
		NumSeeders  int `json:"numSeeders"`
		NumLeechers int `json:"numLeechers"`
		NumSnatches int `json:"numSnatches"`
	} `json:"statistics"`
	TorrentGroup []ArtistGroupStruct `json:"torrentgroup"`
	Requests     []struct {
		RequestID  int    `json:"requestId"`
		CategoryID int    `json:"categoryId"`
		Title      string `json:"title"`
		Year       int    `json:"year"`
		TimeAdded  string `json:"timeAdded"`
		Votes      int    `json:"votes"`
		Bounty     int64  `json:"bounty"`
	} `json:"requests"`
}

func (Artist) Name

func (a Artist) Name() string

type ArtistAlias added in v0.0.5

type ArtistAlias struct {
	ID      int    `json:"id"`
	Name    string `json:"name"`
	AliasID int    `json:"aliasid"`
}

type ArtistBookmarks

type ArtistBookmarks struct {
	Artists []ArtistID `json:"artists"`
}

type ArtistBookmarksResponse

type ArtistBookmarksResponse struct {
	Status   string          `json:"status"`
	Error    string          `json:"error"`
	Response ArtistBookmarks `json:"response"`
}

type ArtistGroupStruct

type ArtistGroupStruct struct {
	GroupID               int                   `json:"groupId"`
	GroupYearF            int                   `json:"groupYear"`
	GroupRecordLabelF     string                `json:"groupRecordLabel"`
	GroupCatalogueNumberF string                `json:"groupCatalogueNumber"`
	GroupCategoryID       string                `json:"groupCategoryID"`
	TagsF                 []string              `json:"tags"`
	ReleaseTypeF          int                   `json:"releaseType"`
	GroupVanityHouse      bool                  `json:"groupVanityHouse"`
	HasBookmarked         bool                  `json:"hasBookmarked"`
	Torrent               []ArtistTorrentStruct `json:"torrent"`
	GroupNameF            string                `json:"groupName"`
	ArtistsF              []ArtistAlias         `json:"artists"`
	ExtendedArtists       ExtendedArtistMap     `json:"extendedArtists"`
	WikiImage             string                `json:"wikiImage"`
	// contains filtered or unexported fields
}

func (ArtistGroupStruct) Artist

func (g ArtistGroupStruct) Artist() string

func (ArtistGroupStruct) Artists

func (g ArtistGroupStruct) Artists() []string

func (ArtistGroupStruct) CatalogueNumber

func (g ArtistGroupStruct) CatalogueNumber() string

func (ArtistGroupStruct) ID

func (g ArtistGroupStruct) ID() int

func (ArtistGroupStruct) Importance

func (g ArtistGroupStruct) Importance() []int

func (ArtistGroupStruct) Name

func (g ArtistGroupStruct) Name() string

func (ArtistGroupStruct) RecordLabel

func (g ArtistGroupStruct) RecordLabel() string

func (ArtistGroupStruct) ReleaseType

func (g ArtistGroupStruct) ReleaseType() int

func (ArtistGroupStruct) String

func (g ArtistGroupStruct) String() string

func (ArtistGroupStruct) Tags

func (g ArtistGroupStruct) Tags() []string

func (ArtistGroupStruct) Year

func (g ArtistGroupStruct) Year() int

type ArtistID added in v0.0.5

type ArtistID struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type ArtistResponse

type ArtistResponse struct {
	Status   string `json:"status"`
	Error    string `json:"error"`
	Response Artist `json:"response"`
}

type ArtistTorrentStruct

type ArtistTorrentStruct struct {
	IDF                  int    `json:"id"`
	GroupIDF             int    `json:"groupId"`
	MediaF               string `json:"media"`
	FormatF              string `json:"format"`
	EncodingF            string `json:"encoding"`
	RemasterYearF        int    `json:"remasterYear"`
	RemasteredF          bool   `json:"remastered"`
	RemasterTitleF       string `json:"remasterTitle"`
	RemasterRecordLabelF string `json:"remasterRecordLabel"`
	SceneF               bool   `json:"scene"`
	HasLogF              bool   `json:"hasLog"`
	HasCue               bool   `json:"hasCue"`
	LogScore             int    `json:"logScore"`
	FileCountF           int    `json:"fileCount"`
	FreeTorrent          bool   `json:"freeTorrent"`
	Size                 int64  `json:"size"`
	Leechers             int    `json:"leechers"`
	Seeders              int    `json:"seeders"`
	Snatched             int    `json:"snatched"`
	Time                 string `json:"time"`
	HasFile              int    `json:"hasFile"`
}

func (ArtistTorrentStruct) Encoding

func (t ArtistTorrentStruct) Encoding() string

func (ArtistTorrentStruct) FileCount

func (t ArtistTorrentStruct) FileCount() int

func (ArtistTorrentStruct) FileSize

func (t ArtistTorrentStruct) FileSize() int64

func (ArtistTorrentStruct) Format

func (t ArtistTorrentStruct) Format() string

func (ArtistTorrentStruct) GroupID

func (t ArtistTorrentStruct) GroupID() int

func (ArtistTorrentStruct) HasLog

func (t ArtistTorrentStruct) HasLog() bool

func (ArtistTorrentStruct) ID

func (t ArtistTorrentStruct) ID() int

func (ArtistTorrentStruct) Media

func (t ArtistTorrentStruct) Media() string

func (ArtistTorrentStruct) RemasterRecordLabel

func (t ArtistTorrentStruct) RemasterRecordLabel() string

func (ArtistTorrentStruct) RemasterTitle

func (t ArtistTorrentStruct) RemasterTitle() string

func (ArtistTorrentStruct) RemasterYear

func (t ArtistTorrentStruct) RemasterYear() int

func (ArtistTorrentStruct) Remastered

func (t ArtistTorrentStruct) Remastered() bool

func (ArtistTorrentStruct) Scene

func (t ArtistTorrentStruct) Scene() bool

func (ArtistTorrentStruct) String

func (t ArtistTorrentStruct) String() string

type Categories

type Categories struct {
	Categories []struct {
		CategoryID   int    `json:"categoryId"`
		CategoryName string `json:"categoryName"`
		Forums       []struct {
			ForumID            int      `json:"forumId"`
			ForumName          string   `json:"forumName"`
			ForumDescription   string   `json:"forumDescription"`
			NumTopics          int      `json:"numTopics"`
			NumPosts           int      `json:"numPosts"`
			LastPostID         int      `json:"lastPostId"`
			LastAuthorID       int      `json:"lastAuthorId"`
			LastPostAuthorName string   `json:"lastPostAuthorName"`
			LastTopicID        int      `json:"lastTopicId"`
			LastTime           string   `json:"lastTime"`
			SpecificRules      []string `json:"specificRules"`
			LastTopic          string   `json:"lastTopic"`
			Read               bool     `json:"read"`
			Locked             bool     `json:"locked"`
			Sticky             bool     `json:"sticky"`
		} `json:"forums"`
	} `json:"categories"`
}

type CategoriesResponse

type CategoriesResponse struct {
	Status   string     `json:"status"`
	Error    string     `json:"error"`
	Response Categories `json:"response"`
}

type Client added in v0.3.0

type Client interface {
	GetJSON(requestURL string, responseObj interface{}) error
	Do(action string, params url.Values, result interface{}) error
	CreateDownloadURL(id int) (string, error)
	CreateUploadURL() (url.URL, string, error)
	Login(username, password string) error
	Logout() error
	GetAccount() error
	GetMailbox(params url.Values) (Mailbox, error)
	GetConversation(id int) (Conversation, error)
	GetNotifications(params url.Values) (Notifications, error)
	GetAnnouncements() (Announcements, error)
	GetSubscriptions(params url.Values) (Subscriptions, error)
	GetCategories() (Categories, error)
	GetForum(id int, params url.Values) (Forum, error)
	GetThread(id int, params url.Values) (Thread, error)
	GetArtistBookmarks() (ArtistBookmarks, error)
	GetTorrentBookmarks() (TorrentBookmarks, error)
	GetArtist(id int, params url.Values) (Artist, error)
	GetRequest(id int, params url.Values) (Request, error)
	GetTorrent(id int, params url.Values) (GetTorrentStruct, error)
	GetTorrentGroup(id int, params url.Values) (TorrentGroup, error)
	SearchTorrents(searchStr string, params url.Values) (TorrentSearch, error)
	SearchRequests(searchStr string, params url.Values) (RequestsSearch, error)
	SearchUsers(searchStr string, params url.Values) (UserSearch, error)
	GetTopTenTorrents(params url.Values) (TopTenTorrents, error)
	GetTopTenTags(params url.Values) (TopTenTags, error)
	GetTopTenUsers(params url.Values) (TopTenUsers, error)
	GetSimilarArtists(id, limit int) (SimilarArtists, error)
}

Client represents a client for the What.CD API.

func Cache added in v0.2.0

func Cache(whatAPI Client, db *sql.DB, cacheFor time.Duration) (Client, error)

Cache caches requests and responses from a What.CD API client using the provided sql db as a cache. It returns cached responses newer than the cacheFor duration. It initialises the cache if needed.

func NewClient added in v0.3.0

func NewClient(ur, agent string) (Client, error)

NewClient creates a new client for the What.CD API using the provided URL.

type ClientStruct added in v0.3.0

type ClientStruct struct {
	// contains filtered or unexported fields
}

ClientStruct represents a client for the What.CD API.

func (ClientStruct) Client added in v0.3.0

func (w ClientStruct) Client() *http.Client

Client gets the http client for low level requests

func (ClientStruct) CreateDownloadURL added in v0.3.0

func (w ClientStruct) CreateDownloadURL(id int) (string, error)

CreateDownloadURL constructs a download URL using the provided torrent id.

func (ClientStruct) CreateUploadURL added in v0.3.0

func (w ClientStruct) CreateUploadURL() (u url.URL, a string, err error)

CreateUploadURL constructs an upload URL for this tracker, and returns the url and autheky

func (ClientStruct) Do added in v0.3.0

func (w ClientStruct) Do(action string, params url.Values, result interface{}) error

func (*ClientStruct) GetAccount added in v0.3.0

func (w *ClientStruct) GetAccount() error

GetAccount retrieves account information for the current user.

func (*ClientStruct) GetAnnouncements added in v0.3.0

func (w *ClientStruct) GetAnnouncements() (Announcements, error)

GetAnnouncements retrieves announcement information.

func (*ClientStruct) GetArtist added in v0.3.0

func (w *ClientStruct) GetArtist(id int, params url.Values) (Artist, error)

GetArtist retrieves artist information using the provided artist id and parameters.

func (*ClientStruct) GetArtistBookmarks added in v0.3.0

func (w *ClientStruct) GetArtistBookmarks() (ArtistBookmarks, error)

GetArtistBookmarks retrieves artist bookmark information for the current user.

func (*ClientStruct) GetCategories added in v0.3.0

func (w *ClientStruct) GetCategories() (Categories, error)

GetCategories retrieves forum category information.

func (*ClientStruct) GetConversation added in v0.3.0

func (w *ClientStruct) GetConversation(id int) (Conversation, error)

GetConversation retrieves conversation information for the current user using the provided conversation id and parameters.

func (*ClientStruct) GetForum added in v0.3.0

func (w *ClientStruct) GetForum(id int, params url.Values) (Forum, error)

GetForum retrieves forum information using the provided forum id and parameters.

func (*ClientStruct) GetJSON added in v0.3.0

func (w *ClientStruct) GetJSON(requestURL string, responseObj interface{}) (err error)

GetJSON sends a HTTP GET request to the API and decodes the JSON response into responseObj.

func (*ClientStruct) GetMailbox added in v0.3.0

func (w *ClientStruct) GetMailbox(params url.Values) (Mailbox, error)

GetMailbox retrieves mailbox information for the current user using the provided parameters.

func (*ClientStruct) GetNotifications added in v0.3.0

func (w *ClientStruct) GetNotifications(params url.Values) (Notifications, error)

GetNotifications retrieves notification information using the specifed parameters.

func (*ClientStruct) GetRequest added in v0.3.0

func (w *ClientStruct) GetRequest(id int, params url.Values) (Request, error)

GetRequest retrieves request information using the provided request id and parameters.

func (*ClientStruct) GetSimilarArtists added in v0.3.0

func (w *ClientStruct) GetSimilarArtists(id, limit int) (SimilarArtists, error)

GetSimilarArtists retrieves similar artist information using the provided artist id and limit.

func (*ClientStruct) GetSubscriptions added in v0.3.0

func (w *ClientStruct) GetSubscriptions(params url.Values) (Subscriptions, error)

GetSubscriptions retrieves forum subscription information for the current user using the provided parameters.

func (*ClientStruct) GetThread added in v0.3.0

func (w *ClientStruct) GetThread(id int, params url.Values) (Thread, error)

GetThread retrieves forum thread information using the provided thread id and parameters.

func (*ClientStruct) GetTopTenTags added in v0.3.0

func (w *ClientStruct) GetTopTenTags(params url.Values) (TopTenTags, error)

GetTopTenTags retrieves "top ten tags" information using the provided parameters.

func (*ClientStruct) GetTopTenTorrents added in v0.3.0

func (w *ClientStruct) GetTopTenTorrents(params url.Values) (TopTenTorrents, error)

GetTopTenTorrents retrieves "top ten torrents" information using the provided parameters.

func (*ClientStruct) GetTopTenUsers added in v0.3.0

func (w *ClientStruct) GetTopTenUsers(params url.Values) (TopTenUsers, error)

GetTopTenUsers retrieves "top tem users" information using the provided parameters.

func (*ClientStruct) GetTorrent added in v0.3.0

func (w *ClientStruct) GetTorrent(id int, params url.Values) (GetTorrentStruct, error)

GetTorrent retrieves torrent information using the provided torrent id and parameters.

func (*ClientStruct) GetTorrentBookmarks added in v0.3.0

func (w *ClientStruct) GetTorrentBookmarks() (TorrentBookmarks, error)

GetTorrentBookmarks retrieves torrent bookmark information for the current user.

func (*ClientStruct) GetTorrentGroup added in v0.3.0

func (w *ClientStruct) GetTorrentGroup(id int, params url.Values) (TorrentGroup, error)

GetTorrentGroup retrieves torrent group information using the provided torrent group id and parameters.

func (*ClientStruct) Login added in v0.3.0

func (w *ClientStruct) Login(username, password string) error

Login logs in to the API using the provided credentials.

func (*ClientStruct) Logout added in v0.3.0

func (w *ClientStruct) Logout() error

Logout logs out of the API, ending the current session.

func (*ClientStruct) SearchRequests added in v0.3.0

func (w *ClientStruct) SearchRequests(searchStr string, params url.Values) (RequestsSearch, error)

SearchRequests retrieves request search results using the provided search string and parameters.

func (*ClientStruct) SearchTorrents added in v0.3.0

func (w *ClientStruct) SearchTorrents(searchStr string, params url.Values) (TorrentSearch, error)

SearchTorrents retrieves torrent search results using the provided search string and parameters.

func (*ClientStruct) SearchUsers added in v0.3.0

func (w *ClientStruct) SearchUsers(searchStr string, params url.Values) (UserSearch, error)

SearchUsers retrieves user search results using the provided search string and parameters.

type Conversation

type Conversation struct {
	ConvID   int    `json:"convId"`
	Subject  string `json:"subject"`
	Sticky   bool   `json:"sticky"`
	Messages []struct {
		MessageID  int    `json:"messageId"`
		SenderID   int    `json:"senderId"`
		SenderName string `json:"senderName"`
		SentDate   string `json:"sentDate"`
		BbBody     string `json:"bbBody"`
		Body       string `json:"body"`
	} `json:"messages"`
}

type ConversationResponse

type ConversationResponse struct {
	Status   string       `json:"status"`
	Error    string       `json:"error"`
	Response Conversation `json:"response"`
}

type ExtendedArtistMap

type ExtendedArtistMap map[string][]ArtistAlias

type FileStruct

type FileStruct struct {
	NameF string
	Size  int64
}

FileStruct represents what we know about the files in a torrent

func (FileStruct) Name

func (fs FileStruct) Name() string

type Forum

type Forum struct {
	ForumName     string `json:"forumName"`
	SpecificRules []struct {
		ThreadID int    `json:"threadID"`
		Thread   string `json:"thread"`
	} `json:"specificRules"`
	CurrentPage int `json:"currentPage"`
	Pages       int `json:"pages"`
	Threads     []struct {
		TopicID        int    `json:"topicId"`
		Title          string `json:"title"`
		AuthorID       int    `json:"authorId"`
		AuthorName     string `json:"authorName"`
		Locked         bool   `json:"locked"`
		Sticky         bool   `json:"sticky"`
		PostCount      int    `json:"postCount"`
		LastID         int    `json:"lastID"`
		LastTime       string `json:"lastTime"`
		LastAuthorId   int    `json:"lastAuthorId"`
		LastAuthorName string `json:"lastAuthorNam"`
		LastReadPage   int    `json:"lastReadPage"`
		LastReadPostID int    `json:"lastReadPostId"`
		Read           bool   `json:"read"`
	} `json:"threads"`
}

type ForumResponse

type ForumResponse struct {
	Status   string `json:"status"`
	Error    string `json:"error"`
	Response Forum  `json:"response"`
}

type GenericResponse

type GenericResponse struct {
	Status string `json:"status"`
	Error  string `json:"error"`
}

type GetTorrentStruct

type GetTorrentStruct struct {
	Group   GroupStruct   `json:"group"`
	Torrent TorrentStruct `json:"torrent"`
}

type Group

type Group interface {
	ID() int
	Name() string
	Artist() string
	Year() int
	ReleaseType() int
	Tags() []string
	String() string
}

type GroupExt

type GroupExt interface {
	GroupRelease
	WikiImage() string
	Artists() []string
	Importance() []int
	WikiBody() string
}

type GroupRelease

type GroupRelease interface {
	Group
	RecordLabel() string
	CatalogueNumber() string
}

type GroupStruct

type GroupStruct struct {
	WikiBodyF        string    `json:"wikiBody"`
	WikiImageF       string    `json:"wikiImage"`
	IDF              int       `json:"id"`
	NameF            string    `json:"name"`
	YearF            int       `json:"year"`
	RecordLabelF     string    `json:"recordLabel"`
	CatalogueNumberF string    `json:"catalogueNumber"`
	ReleaseTypeF     int       `json:"releaseType"`
	CategoryID       int       `json:"categoryId"`
	CategoryName     string    `json:"categoryName"`
	Time             string    `json:"time"`
	VanityHouse      bool      `json:"vanityHouse"`
	IsBookmarked     bool      `json:"isBookmarked"`
	MusicInfo        MusicInfo `json:"musicInfo"`
	TagsF            []string  `json:"tags"`
	// contains filtered or unexported fields
}

func (GroupStruct) Artist

func (g GroupStruct) Artist() string

func (GroupStruct) Artists

func (g GroupStruct) Artists() []string

func (GroupStruct) CatalogueNumber

func (g GroupStruct) CatalogueNumber() string

func (GroupStruct) ID

func (g GroupStruct) ID() int

func (GroupStruct) Importance

func (g GroupStruct) Importance() []int

func (GroupStruct) Name

func (g GroupStruct) Name() string

func (GroupStruct) RecordLabel

func (g GroupStruct) RecordLabel() string

func (GroupStruct) ReleaseType

func (g GroupStruct) ReleaseType() int

func (GroupStruct) String

func (g GroupStruct) String() string

func (GroupStruct) Tags

func (g GroupStruct) Tags() []string

func (GroupStruct) WikiBody

func (g GroupStruct) WikiBody() string

func (GroupStruct) WikiImage

func (g GroupStruct) WikiImage() string

func (GroupStruct) Year

func (g GroupStruct) Year() int

type Mailbox

type Mailbox struct {
	CurrentPage int `json:"currentPage"`
	Pages       int `json:"pages"`
	Messages    []struct {
		ConvID        int    `json:"convId"`
		Subject       string `json:"subject"`
		Unread        bool   `json:"unread"`
		Sticky        bool   `json:"sticky"`
		ForwardedID   int    `json:"forwardedID"`
		ForwardedName string `json:"forwardedName"`
		SenderID      int    `json:"senderId"`
		Username      string `json:"username"`
		Donor         bool   `json:"donor"`
		Warned        bool   `json:"warned"`
		Enabled       bool   `json:"enabled"`
		Date          string `json:"date"`
	} `json:"messages"`
}

type MailboxResponse

type MailboxResponse struct {
	Status   string  `json:"status"`
	Error    string  `json:"error"`
	Response Mailbox `json:"response"`
}

type MusicInfo

type MusicInfo struct {
	Composers []MusicInfoStruct `json:"composers"`
	DJ        []MusicInfoStruct `json:"dj"`
	Artists   []MusicInfoStruct `json:"artists"`
	With      []MusicInfoStruct `json:"with"`
	Conductor []MusicInfoStruct `json:"conductor"`
	RemixedBy []MusicInfoStruct `json:"remixedBy"`
	Producer  []MusicInfoStruct `json:"producer"`
}

type MusicInfoStruct

type MusicInfoStruct struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type Notifications

type Notifications struct {
	CurrentPages int `json:"currentPages"`
	Pages        int `json:"pages"`
	NumNew       int `json:"numNew"`
	Results      []struct {
		TorrentID        int    `json:"torrentId"`
		GroupID          int    `json:"groupId"`
		GroupName        string `json:"groupName"`
		GroupCategoryID  int    `json:"groupCategoryId"`
		TorrentTags      string `json:"torrentTags"`
		Size             int64  `json:"size"`
		FileCount        int    `json:"filecount"`
		Format           string `json:"format"`
		Encoding         string `json:"encoding"`
		Media            string `json:"mdia"`
		Scene            bool   `json:"scene"`
		GroupYear        int    `json:"groupYear"`
		RemasterYear     int    `json:"remasterYear"`
		RemasterTitle    string `json:"remasterTitle"`
		Snatched         int    `json:"snatched"`
		Seeders          int    `json:"seeders"`
		Leechers         int    `json:"leechers"`
		NotificationTime string `json:"notificationTime"`
		HasLog           bool   `json:"hasLog"`
		HasCue           bool   `json:"hasCue"`
		LogScore         int    `json:"logScore"`
		FreeTorrent      bool   `json:"freeTorrent"`
		LogInDB          bool   `json:"logInDb"`
		Unread           bool   `json:"unread"`
	} `json:"results"`
}

type NotificationsResponse

type NotificationsResponse struct {
	Status   string        `json:"status"`
	Error    string        `json:"error"`
	Response Notifications `json:"response"`
}

type PSList added in v0.0.13

type PSList struct{}

func (PSList) PublicSuffix added in v0.0.13

func (p PSList) PublicSuffix(d string) string

func (PSList) String added in v0.0.13

func (p PSList) String() string

type Request

type Request struct {
	RequestID       int     `json:"requestId"`
	RequestiorID    int     `json:"requestorId"`
	RequestorName   string  `json:"requestorName"`
	RequestTax      float64 `json:"requestTax"`
	TimeAdded       string  `json:"timeAdded"`
	CanEdit         bool    `json:"canEdit"`
	CanVote         bool    `json:"canVote"`
	MinimumVote     int     `json:"minimumVote"`
	VoteCount       int     `json:"voteCount"`
	LastVote        string  `json:"lastVote"`
	TopContributors []struct {
		UserID   int    `json:"userId"`
		UserName string `json:"userName"`
		Bounty   int64  `json:"bounty"`
	} `json:"topContributers"`
	TotalBounty  int64  `json:"totalBounty"`
	CategoryID   int    `json:"categoryId"`
	CategoryName string `json:"categoryName"`
	Title        string `json:"title"`
	Year         int    `json:"year"`
	Image        string `json:"image"`
	Description  string `json:"description"`
	MusicInfo    struct {
		Composers []string `json:"composers"`
		DJ        []string `json:"dj"`
		Artists   []struct {
			ID   int    `json:"id"`
			Name string `json:"name"`
		} `json:"artists"`
		With []struct {
			ID   int    `json:"id"`
			Name string `json:"name"`
		} `json:"with"`
		Conductor []string `json:"conductor"`
		RemixedBy []string `json:"remixedBy"`
		Producer  []string `json:"producer"`
	} `json:"musicInfo"`
	CatalogueNumber string   `json:"catalogueNumber"`
	ReleaseType     int      `json:"releaseType"`
	ReleaseName     string   `json:"releaseName"`
	BitrateList     []string `json:"bitrateList"`
	FormatList      []string `json:"formatList"`
	MediaList       []string `json:"mediaList"`
	LogCue          string   `json:"logCue"`
	IsFilled        bool     `json:"isFilled"`
	FillerID        int      `json:"fillerID"`
	FillerName      string   `json:"fillerName"`
	TorrentID       int      `json:"torrentID"`
	TimeFilled      string   `json:"timeFilled"`
	Tags            []string `json:"tags"`
	Comments        []struct {
		PostID       int    `json:"postId"`
		AuthorID     int    `json:"authorId"`
		Name         string `json:"name"`
		Donor        bool   `json:"donor"`
		Warned       bool   `json:"warned"`
		Enabled      bool   `json:"enabled"`
		Class        string `json:"class"`
		AddedTime    string `json:"addedTime"`
		Avatar       string `json:"avatar"`
		Comment      string `json:"comment"`
		EditUserID   int    `json:"editUserId"`
		EditUsername string `json:"editUsername"`
		EditedTime   string `json:"editedTime"`
	} `json:"comments"`
	CommentPage  int `json:"commentPage"`
	CommentPages int `json:"commentPages"`
}

type RequestResponse

type RequestResponse struct {
	Status   string  `json:"status"`
	Error    string  `json:"error"`
	Response Request `json:"response"`
}

type RequestsSearch

type RequestsSearch struct {
	CurrentPage int `json:"currentPage"`
	Pages       int `json:"pages"`
	Results     []struct {
		RequestID       int          `json:"requestId"`
		RequestorID     int          `json:"requestorId"`
		ReqyestorName   string       `json:"requestorName"`
		TimeAdded       string       `json:"timeAdded"`
		LastVote        string       `json:"lastVote"`
		VoteCount       int          `json:"voteCount"`
		Bounty          int64        `json:"bounty"`
		CategoryID      int          `json:"categoryId"`
		CategoryName    string       `json:"categoryName"`
		Artists         [][]ArtistID `json:"artists"`
		Title           string       `json:"title"`
		Year            int          `json:"year"`
		Image           string       `json:"image"`
		Description     string       `json:"description"`
		CatalogueNumber string       `json:"catalogueNumber"`
		ReleaseType     string       `json:"releaseType"`
		BitrateList     string       `json:"bitrateList"`
		FormatList      string       `json:"formatList"`
		MediaList       string       `json:"mediaList"`
		LogCue          string       `json:"logCue"`
		IsFilled        bool         `json:"isFilled"`
		FillerID        int          `json:"fillerId"`
		FillerName      string       `json:"fillerName"`
		TorrentID       int          `json:"torrentId"`
		TimeFilled      string       `json:"timeFilled"`
	} `json:"results"`
}

type RequestsSearchResponse

type RequestsSearchResponse struct {
	Status   string         `json:"status"`
	Error    string         `json:"error"`
	Response RequestsSearch `json:"response"`
}

type SearchTorrentStruct

type SearchTorrentStruct struct {
	TorrentID                int           `json:"torrentId"`
	EditionID                int           `json:"editionId"`
	Artists                  []ArtistAlias `json:"artists"`
	RemasteredF              bool          `json:"remastered"`
	RemasterYearF            int           `json:"remasterYear"`
	RemasterCatalogueNumberF string        `json:"remasterCatalogueNumber"`
	RemasterTitleF           string        `json:"remasterTitle"`
	MediaF                   string        `json:"media"`
	EncodingF                string        `json:"encoding"`
	FormatF                  string        `json:"format"`
	HasLogF                  bool          `json:"hasLog"`
	LogScore                 int           `json:"logScore"`
	HasCue                   bool          `json:"hasCue"`
	SceneF                   bool          `json:"scene"`
	VanityHouse              bool          `json:"vanityHouse"`
	FileCountF               int           `json:"fileCount"`
	Time                     string        `json:"time"`
	Size                     int64         `json:"size"`
	Snatches                 int           `json:"snatches"`
	Seeders                  int           `json:"seeders"`
	Leechers                 int           `json:"leechers"`
	IsFreeleech              bool          `json:"isFreeleech"`
	IsNeutralLeech           bool          `json:"isNeutralLeech"`
	IsPersonalFreeleech      bool          `json:"isPersonalFreeleech"`
	CanUseToken              bool          `json:"canUseToken"`
}

func (SearchTorrentStruct) Encoding

func (ts SearchTorrentStruct) Encoding() string

func (SearchTorrentStruct) FileCount

func (ts SearchTorrentStruct) FileCount() int

func (SearchTorrentStruct) FileSize

func (ts SearchTorrentStruct) FileSize() int64

func (SearchTorrentStruct) Format

func (ts SearchTorrentStruct) Format() string

func (SearchTorrentStruct) HasLog

func (ts SearchTorrentStruct) HasLog() bool

func (SearchTorrentStruct) ID

func (ts SearchTorrentStruct) ID() int

func (SearchTorrentStruct) Media

func (ts SearchTorrentStruct) Media() string

func (SearchTorrentStruct) RemasterCatalogueNumber

func (ts SearchTorrentStruct) RemasterCatalogueNumber() string

func (SearchTorrentStruct) RemasterTitle

func (ts SearchTorrentStruct) RemasterTitle() string

func (SearchTorrentStruct) RemasterYear

func (ts SearchTorrentStruct) RemasterYear() int

func (SearchTorrentStruct) Remastered

func (ts SearchTorrentStruct) Remastered() bool

func (SearchTorrentStruct) Scene

func (ts SearchTorrentStruct) Scene() bool

func (SearchTorrentStruct) String

func (ts SearchTorrentStruct) String() string

type SimilarArtists

type SimilarArtists []struct {
	ID    int    `json:"id"`
	Name  string `json:"name"`
	Score int    `json:"score"`
}

type Subscriptions

type Subscriptions struct {
	Threads []struct {
		ForumID     int    `json:"forumId"`
		ForumName   string `json:"forumName"`
		ThreadID    int    `json:"threadId"`
		ThreadTitle string `json:"threadTitle"`
		PostID      int    `json:"postId"`
		Locked      bool   `json:"locked"`
		New         bool   `json:"new"`
	} `json:"threads"`
}

type SubscriptionsResponse

type SubscriptionsResponse struct {
	Status   string        `json:"status"`
	Error    string        `json:"error"`
	Response Subscriptions `json:"response"`
}

type Thread

type Thread struct {
	ForumID     int    `json:"forumId"`
	ForumName   string `json:"forumName"`
	ThreadID    int    `json:"threadId"`
	ThreadTitle string `json:"threadTitle"`
	Subscribed  bool   `json:"subscribed"`
	Locked      bool   `json:"locked"`
	Sticky      bool   `json:"sticky"`
	CurrentPage int    `json:"currentPage"`
	Pages       int    `json:"pages"`
	Poll        struct {
		Closed     bool   `json:"closed"`
		Featured   string `json:"featured"`
		Question   string `json:"question"`
		MaxVotes   int    `json:"maxVotes"`
		TotalVotes int    `json:"totalVotes"`
		Voted      bool   `json:"voted"`
		Answers    []struct {
			Answer  string  `json:"answer"`
			Ratio   float64 `json:"ratio"`
			Percent float64 `json:"percent"`
		} `json:"answers"`
	} `json:"poll"`
	Posts []struct {
		PostID         int    `json:"postId"`
		AddedTime      string `json:"addedTime"`
		BbBody         string `json:"bbBody"`
		Body           string `json:"body"`
		EditedUserID   int    `json:"editedUserId"`
		EditedTime     string `json:"editedTime"`
		EditedUsername string `json:"editedUsername"`
		Author         struct {
			AuthorID   int      `json:"authorId"`
			AuthorName string   `json:"authorName"`
			Paranoia   []string `json:"paranoia"`
			Artist     bool     `json:"artist"`
			Donor      bool     `json:"donor"`
			Warned     bool     `json:"warned"`
			Avatar     string   `json:"avatar"`
			Enabled    bool     `json:"enabled"`
			UserTitle  string   `json:"userTitle"`
		} `json:"author"`
	} `json:"posts"`
}

type ThreadResponse

type ThreadResponse struct {
	Status   string `json:"status"`
	Error    string `json:"error"`
	Response Thread `json:"response"`
}

type TopTenResult

type TopTenResult struct {
	TorrentID      int      `json:"torrentId"`
	GroupID        int      `json:"groupId"`
	Artist         string   `json:"artist"`
	GroupNameF     string   `json:"groupName"`
	GroupCategory  int      `json:"groupCategory"`
	GroupYear      int      `json:"groupYear"`
	RemasterTitleF string   `json:"remasterTitle"`
	Format         string   `json:"format"`
	Encoding       string   `json:"encoding"`
	HasLog         bool     `json:"hasLog"`
	HasCue         bool     `json:"hasCue"`
	HasLogDB       bool     `json:"hasLogDB"`
	LogScore       string   `json:"logScore"`
	LogChecksum    string   `json:"logChecksum"`
	Media          string   `json:"media"`
	Scene          bool     `json:"scene"`
	Year           int      `json:"year"`
	Tags           []string `json:"tags"`
	Snatched       int      `json:"snatched"`
	Seeders        int      `json:"seeders"`
	Leechers       int      `json:"leechers"`
	Data           int64    `json:"data"`
	Size           int64    `json:"size"`
	WikiImage      string   `json:"wikiImage"`
	ReleaseType    string   `json:"releaseType"`
}

func (TopTenResult) Name added in v0.1.1

func (r TopTenResult) Name() string

func (TopTenResult) RemasterTitle

func (r TopTenResult) RemasterTitle() string

type TopTenTags

type TopTenTags []struct {
	Caption string `json:"caption"`
	Tag     string `json:"tag"`
	Limit   int    `json:"limit"`
	Results []struct {
		Name     string `json:"name"`
		Uses     int    `json:"uses"`
		PosVotes int    `json:"posVotes"`
		NegVotes int    `json:"negVotes"`
	} `json:"results"`
}

type TopTenTagsResponse

type TopTenTagsResponse struct {
	Status   string     `json:"status"`
	Error    string     `json:"error"`
	Response TopTenTags `json:"response"`
}

type TopTenTorrents

type TopTenTorrents []struct {
	Caption string         `json:"caption"`
	Tag     string         `json:"tag"`
	Limit   int            `json:"limit"`
	Results []TopTenResult `json:"results"`
}

type TopTenTorrentsResponse

type TopTenTorrentsResponse struct {
	Status   string         `json:"status"`
	Error    string         `json:"error"`
	Response TopTenTorrents `json:"response"`
}

type TopTenUsers

type TopTenUsers []struct {
	Caption string `json:"caption"`
	Tag     string `json:"tag"`
	Limit   int    `json:"limit"`
	Results []struct {
		ID         int     `json:"id"`
		Username   string  `json:"username"`
		Uploaded   float64 `json:"uploaded"`
		UpSpeed    float64 `json:"upSpeed"`
		Downloaded float64 `json:"downloaded"`
		DownSpeed  float64 `json:"downSpeed"`
		NumUploads int     `json:"numUploads"`
		JoinDate   string  `json:"joinDate"`
	} `json:"results"`
}

type TopTenUsersResponse

type TopTenUsersResponse struct {
	Status   string      `json:"status"`
	Error    string      `json:"error"`
	Response TopTenUsers `json:"response"`
}

type Torrent

type Torrent interface {
	ID() int
	Format() string
	Encoding() string
	Media() string
	Remastered() bool
	RemasterTitle() string
	RemasterYear() int
	Scene() bool
	HasLog() bool
	String() string
	FileCount() int
	FileSize() int64
}

type TorrentBookmarks

type TorrentBookmarks struct {
	Bookmarks []struct {
		ID              int             `json:"id"`
		Name            string          `json:"name"`
		Year            int             `json:"year"`
		RecordLabel     string          `json:"recordLabel"`
		CatalogueNumber string          `json:"catalogueNumber"`
		TagList         string          `json:"tagList"`
		ReleaseType     string          `json:"releastType"`
		VanityHouse     bool            `json:"vanityHouse"`
		Image           string          `json:"image"`
		Torrents        []TorrentStruct `json:"torrents"`
	} `json:"bookmarks"`
}

type TorrentBookmarksResponse

type TorrentBookmarksResponse struct {
	Status   string           `json:"status"`
	Error    string           `json:"error"`
	Response TorrentBookmarks `json:"response"`
}

type TorrentCatalogueNumber

type TorrentCatalogueNumber interface {
	RemasterCatalogueNumber() string
}

type TorrentExt

type TorrentExt interface {
	TorrentFiles
	Description() string
}

type TorrentFiles

type TorrentFiles interface {
	Torrent
	TorrentRecordLabel
	TorrentCatalogueNumber
	FilePath() string
	Files() ([]FileStruct, error)
}

type TorrentGroup

type TorrentGroup struct {
	Group   GroupStruct     `json:"group"`
	Torrent []TorrentStruct `json:"torrents"`
}

type TorrentGroupResponse

type TorrentGroupResponse struct {
	Status   string       `json:"status"`
	Error    string       `json:"error"`
	Response TorrentGroup `json:"response"`
}

type TorrentRecordLabel

type TorrentRecordLabel interface {
	RemasterRecordLabel() string
}

type TorrentResponse

type TorrentResponse struct {
	Status   string           `json:"status"`
	Error    string           `json:"error"`
	Response GetTorrentStruct `json:"response"`
}

type TorrentSearch

type TorrentSearch struct {
	CurrentPage int                         `json:"currentPage"`
	Pages       int                         `json:"pages"`
	Results     []TorrentSearchResultStruct `json:"results"`
}

type TorrentSearchResponse

type TorrentSearchResponse struct {
	Status   string        `json:"status"`
	Error    string        `json:"error"`
	Response TorrentSearch `json:"response"`
}

type TorrentSearchResultStruct

type TorrentSearchResultStruct struct {
	GroupID       int                   `json:"groupId"`
	GroupName     string                `json:"groupName"`
	ArtistF       string                `json:"artist"`
	TagsF         []string              `json:"tags"`
	Bookmarked    bool                  `json:"bookmarked"`
	VanityHouse   bool                  `json:"vanityHouse"`
	GroupYear     int                   `json:"groupYear"`
	ReleaseTypeF  int                   `json:"releasetType,string"`
	GroupTime     string                `json:"groupTime"`
	TotalSnatched int                   `json:"totalSnatched"`
	TotalSeeders  int                   `json:"totalSeeders"`
	TotalLeechers int                   `json:"totalLeechers"`
	Torrents      []SearchTorrentStruct `json:"torrents"`
}

func (TorrentSearchResultStruct) Artist

func (ts TorrentSearchResultStruct) Artist() string

func (TorrentSearchResultStruct) ID

func (TorrentSearchResultStruct) Name

func (TorrentSearchResultStruct) ReleaseType

func (ts TorrentSearchResultStruct) ReleaseType() int

func (TorrentSearchResultStruct) String

func (ts TorrentSearchResultStruct) String() string

func (TorrentSearchResultStruct) Tags

func (ts TorrentSearchResultStruct) Tags() []string

func (TorrentSearchResultStruct) Year

func (ts TorrentSearchResultStruct) Year() int

type TorrentStruct

type TorrentStruct struct {
	IDF                      int    `json:"id"`
	InfoHash                 string `json:"infoHash"`
	MediaF                   string `json:"media"`
	FormatF                  string `json:"format"`
	EncodingF                string `json:"encoding"`
	RemasteredF              bool   `json:"remastered"`
	RemasterYearF            int    `json:"remasterYear"`
	RemasterTitleF           string `json:"remasterTitle"`
	RemasterRecordLabelF     string `json:"remasterRecordLabel"`
	RemasterCatalogueNumberF string `json:"remasterCatalogueNumber"`
	SceneF                   bool   `json:"scene"`
	HasLogF                  bool   `json:"hasLog"`
	HasCue                   bool   `json:"hasCue"`
	LogScore                 int    `json:"logScore"`
	FileCountF               int    `json:"fileCount"`
	Size                     int64  `json:"size"`
	Seeders                  int    `json:"seeders"`
	Leechers                 int    `json:"leechers"`
	Snatched                 int    `json:"snatched"`
	FreeTorrent              bool   `json:"freeTorrent"`
	Reported                 bool   `json:"reported"`
	Time                     string `json:"time"`
	DescriptionF             string `json:"description"`
	FileList                 string `json:"fileList"`
	FilePathF                string `json:"filePath"`
	UserID                   int    `json:"userID"`
	Username                 string `json:"username"`
	// contains filtered or unexported fields
}

func (TorrentStruct) Description

func (t TorrentStruct) Description() string

func (TorrentStruct) Encoding

func (t TorrentStruct) Encoding() string

func (TorrentStruct) FileCount

func (t TorrentStruct) FileCount() int

func (TorrentStruct) FilePath

func (t TorrentStruct) FilePath() string

func (TorrentStruct) FileSize

func (t TorrentStruct) FileSize() int64

func (*TorrentStruct) Files

func (t *TorrentStruct) Files() ([]FileStruct, error)

func (TorrentStruct) Format

func (t TorrentStruct) Format() string

func (TorrentStruct) HasLog

func (t TorrentStruct) HasLog() bool

func (TorrentStruct) ID

func (t TorrentStruct) ID() int

func (TorrentStruct) Media

func (t TorrentStruct) Media() string

func (TorrentStruct) ParseFileList

func (t TorrentStruct) ParseFileList() ([]FileStruct, error)

ParseFileList returns a slice of FileStruts for a torrent

func (TorrentStruct) RemasterCatalogueNumber

func (t TorrentStruct) RemasterCatalogueNumber() string

func (TorrentStruct) RemasterRecordLabel

func (t TorrentStruct) RemasterRecordLabel() string

func (TorrentStruct) RemasterTitle

func (t TorrentStruct) RemasterTitle() string

func (TorrentStruct) RemasterYear

func (t TorrentStruct) RemasterYear() int

func (TorrentStruct) Remastered

func (t TorrentStruct) Remastered() bool

func (TorrentStruct) Scene

func (t TorrentStruct) Scene() bool

func (TorrentStruct) String

func (t TorrentStruct) String() string

type User

type User struct {
	Username    string `json:"username"`
	Avatar      string `json:"avatar"`
	IsFriend    bool   `json:"isFriend"`
	ProfileText string `json:"profileText"`
	Stats       struct {
		JoinedDate    string  `json:"joinedDate"`
		LastAccess    string  `json:"lastAccess"`
		Uploaded      int64   `json:"uploaded"`
		Downloaded    int64   `json:"downloaded"`
		Ratio         string  `json:"ratio"`
		RequiredRatio float64 `json:"requiredRatio"`
	} `json:"stats"`
	Ranks struct {
		Uploaded   int `json:"uploaded"`
		Downloaded int `json:"downloaded"`
		Uploads    int `json:"uploads"`
		Requests   int `json:"requests"`
		Bounty     int `json:"bounty"`
		Posts      int `json:"posts"`
		Artists    int `json:"artists"`
		Overall    int `json:"overall"`
	} `json:"ranks"`
	Personal struct {
		Class        string `json:"class"`
		Paranoia     int    `json:"paranoia"`
		ParanoiaText string `json:"paranoiaText"`
		Donor        bool   `json:"donor"`
		Warned       bool   `json:"warned"`
		Enabled      bool   `json:"enabled"`
		PassKey      string `json:"passKey"`
	} `json:"personal"`
	Community struct {
		Posts           int `json:"posts"`
		TorrentComments int `json:"torrentComments"`
		CollagesStarted int `json:"collagesStarted"`
		CollagesContrib int `json:"collagesContrib"`
		RequestsFilled  int `json:"requestsFilled"`
		RequestsVoted   int `json:"requestsVoted"`
		PerfectFlacs    int `json:"perfectFlacs"`
		Uploaded        int `json:"uploaded"`
		Groups          int `json:"groups"`
		Seeding         int `json:"seeding"`
		Leeching        int `json:"leeching"`
		Snatched        int `json:"snatched"`
		Invited         int `json:"invited"`
	} `json:"community"`
}

type UserResponse

type UserResponse struct {
	Status   string `json:"status"`
	Error    string `json:"error"`
	Response User   `json:"response"`
}

type UserSearch

type UserSearch struct {
	CurrentPage int `json:"currentPage"`
	Pages       int `json:"pages"`
	Results     []struct {
		UserID   int    `json:"userId"`
		Username string `json:"username"`
		Donor    bool   `json:"donor"`
		Warned   bool   `json:"warned"`
		Enabled  bool   `json:"enabled"`
		Class    string `json:"class"`
	} `json:"results"`
}

type UserSearchResponse

type UserSearchResponse struct {
	Status   string     `json:"status"`
	Error    string     `json:"error"`
	Response UserSearch `json:"response"`
}

Jump to

Keyboard shortcuts

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