xrel

package
v2.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2016 License: GPL-3.0 Imports: 12 Imported by: 2

Documentation

Overview

Package xrel contains functions to authorize with and access the complete xREL.to API.

Here is an example on how to use the OAuth2 user authentication:

xrel.ConfigureOAuth2("OAUTH2_CLIENT_KEY", "OAUTH2_CLIENT_SECRET", "", []string{"viewnfo", "addproof"})
fmt.Println("(1) Go to: " + xrel.GetOAuth2AuthURL(""))
fmt.Println("(2) Grant access, you should get back a verification code.")
fmt.Print("(3) Enter that verification code here: ")
verificationCode := ""
fmt.Scanln(&verificationCode)
err := xrel.PerformOAuth2UserAuthentication(verificationCode)
ok(err)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddComment

func AddComment(id string, isP2P bool, text string, videoRating, audioRating int) (types.Comment, error)

AddComment adds a comment to a given API release id or API P2P release id. Requires user OAuth2 authentication.

id			API release id or API P2P release id.
isP2P			If the provided id is a P2P release id.
text		:= ""	The comment. You may use BBCode to format the text.
			Can be empty if both video_rating and audio_rating are set.
videoRating	:= 0
audioRating	:= 0	Video and audio rating between 1 (bad) to 10 (good). 0 means no rating.
					You must always rate both or none. You may only vote once, and may not change your vote.

http://www.xrel.to/wiki/6312/api-comments-add.html

func AddFavsListEntry

func AddFavsListEntry(favsListID, extInfoID string) (types.FavListEntryModificationResult, error)

AddFavsListEntry adds an ExtInfo to a favorite list. Requires user OAuth2 authentication.

favsListID	The favorite list ID, as obtained through GetFavsLists().
extInfoID	The Ext Info ID, as obtained through other API calls.

http://www.xrel.to/wiki/6316/api-favs-list-addentry.html

func AddReleaseProofImage

func AddReleaseProofImage(ids []string, imageBase64 string) (types.AddProofResult, error)

AddReleaseProofImage adds the base64 of a proof picture to a given API release id. More info on proof pictures can be found here: https://www.xrel.to/wiki/6305/Proofs.html

Please read the rules before posting proofs: https://www.xrel.to/wiki/6308/Regeln-Proofs.html

https://www.xrel.to/wiki/6444/api-release-addproof.html

func AddReleaseProofImageByPath

func AddReleaseProofImageByPath(ids []string, fp string) (types.AddProofResult, error)

AddReleaseProofImageByPath adds a proof picture to a given API release id by filepath. More info on proof pictures can be found here: https://www.xrel.to/wiki/6305/Proofs.html

Please read the rules before posting proofs: https://www.xrel.to/wiki/6308/Regeln-Proofs.html

https://www.xrel.to/wiki/6444/api-release-addproof.html

func BrowseReleaseCategory

func BrowseReleaseCategory(categoryName, extInfoType string, perPage, page int) (types.Releases, error)

BrowseReleaseCategory returns scene releases from the given category.

categoryName		Category name from GetReleaseCategories()
extInfoType := ""	Use one of: movie|tv|game|console|software|xxx - or leave empty to browse releases of all types

http://www.xrel.to/wiki/3751/api-release-browse-category.html

func ConfigureOAuth2

func ConfigureOAuth2(clientKey, clientSecret, redirectURL string, scopes []string)

ConfigureOAuth2 will set needed oAuth2 variables. If you set no redirectURL xREL will display the code to the user. Get your client key & secret here: http://www.xrel.to/api-apps.html

func GetComments

func GetComments(id string, isP2P bool, perPage int, page int) (types.Comments, error)

GetComments returns comments for a given API release id or API P2P release id. Only the id is required.

isP2P   := false
perPage := 25 		// min. 5, max 100
page    := 1

http://www.xrel.to/wiki/6313/api-comments-get.html

func GetExtInfo

func GetExtInfo(id string) (types.ExtendedExtInfo, error)

GetExtInfo returns information about an ExtInfo.

http://www.xrel.to/wiki/2725/api-ext-info-info.html

func GetExtInfoMedia

func GetExtInfoMedia(id string) ([]types.ExtInfoMediaItem, error)

GetExtInfoMedia returns media associated with an Ext Info.

http://www.xrel.to/wiki/6314/api-ext-info-media.html

func GetFavsListEntries

func GetFavsListEntries(favsListID string, getReleases bool) ([]types.ExtendedExtInfo, error)

GetFavsListEntries returns entries of a favorite list. Requires user OAuth2 authentication.

favsListID			The favorite list ID, as obtained through GetFavsLists().
getReleases	:= false	If true, an inline list of unread(!) releases will be returned with each ext_info entry.

http://www.xrel.to/wiki/1823/api-favs-list-entries.html

func GetFavsLists

func GetFavsLists() ([]types.FavList, error)

GetFavsLists returns a list of all the current user's favorite lists. Requires user OAuth2 authentication.

http://www.xrel.to/wiki/1754/api-favs-lists.html

func GetLatestReleases

func GetLatestReleases(perPage, page int, filter, archive string) (types.Releases, error)

GetLatestReleases returns the latest releases. Also allows to browse the archive by month.

perPage	:= 25	Number of releases per page. Min. 5, max. 100.
page	:= 1	Page number (1 to N).
filter	:= ""	Filter ID (from GetReleaseFilters()) or "overview" to use the currently logged in user's overview filter.
archive	:= ""	Empty = current releases, YYYY-MM for archive.

http://www.xrel.to/wiki/2994/api-release-latest.html

func GetNFOByID

func GetNFOByID(id string, isP2P bool) ([]byte, error)

GetNFOByID returns PNG image data of a NFO file for a given release id. Requires user or application OAuth2 authentication.

id		The release id as obtained trough over methods.
isP2P	Is the release a P2P release?

Please cache the file on your device. You may not modify the image in any way or hide the footer.

https://www.xrel.to/wiki/6438/api-nfo-release.html https://www.xrel.to/wiki/6437/api-nfo-p2p-rls.html

func GetOAuth2AuthURL

func GetOAuth2AuthURL(state string) string

GetOAuth2AuthURL returns an URL where the user can login and get a verification code from. State can be any string. You may set this value to any value, and it will be returned after the authentication. It might also be useful to prevent CSRF attacks. Use this after ConfigureOAuth2.

func GetP2PCategories

func GetP2PCategories() ([]types.P2PCategory, error)

GetP2PCategories returns a list of available P2P release categories and their IDs. You can use the category ID in GetP2PReleases().

http://www.xrel.to/wiki/3698/api-p2p-categories.html

func GetP2PReleaseInfo

func GetP2PReleaseInfo(query string, isID bool) (types.P2PRelease, error)

GetP2PReleaseInfo returns information about a single release, specified by the complete dirname or an API release id.

http://www.xrel.to/wiki/3697/api-p2p-rls-info.html

func GetP2PReleases

func GetP2PReleases(perPage, page int, categoryID, groupID, extInfoID string) (types.P2PReleases, error)

GetP2PReleases allows to browse P2P/non-scene releases.

perPage		:= 25	Number of releases per page. Min. 5, max. 100.
page     	:= 1	Page number (1 to N).

Set only one of the following:
categoryID	:= ""	P2P category ID from GetP2PCategories()
groupID		:= ""	P2P release group ID
extInfoID	:= ""	Ext Info ID

http://www.xrel.to/wiki/3699/api-p2p-releases.html

func GetReleaseByExtInfoID

func GetReleaseByExtInfoID(id string, perPage, page int) (types.Releases, error)

GetReleaseByExtInfoID returns all releases associated with a given ExtInfo.

id				ExtInfoID.
perPage	:= 25	Number of releases per page. Min. 5, max. 100.
page	:= 1	Page number (1 to N).

http://www.xrel.to/wiki/2822/api-release-ext-info.html

func GetReleaseCategories

func GetReleaseCategories() ([]types.Category, error)

GetReleaseCategories returns a list of available release categories. You can use the category name in BrowseReleaseCategory().

http://www.xrel.to/wiki/6318/api-release-categories.html

func GetReleaseFilters

func GetReleaseFilters() ([]types.Filter, error)

GetReleaseFilters returns a list of public, predefined release filters. You can use the filter ID in GetLatestReleases().

http://www.xrel.to/wiki/2996/api-release-filters.html

func GetReleaseInfo

func GetReleaseInfo(query string, isID bool) (types.Release, error)

GetReleaseInfo returns information about a single release, specified by the complete dirname or an API release id.

http://www.xrel.to/wiki/1680/api-release-info.html

func GetUpcomingTitles

func GetUpcomingTitles(country string) ([]types.UpcomingTitle, error)

GetUpcomingTitles returns a list upcoming movies and their releases. The `country` parameter can be either 'de' (default) for upcoming movies in germany or `us` for upcoming movies in the US/international.

http://www.xrel.to/wiki/1827/api-calendar-upcoming.html

func GetUserInfo

func GetUserInfo() (types.User, error)

GetUserInfo returns information about the currently active user. Requires user OAuth authentication.

https://www.xrel.to/wiki/6441/api-user-info.html

func MarkFavsListEntryAsRead

func MarkFavsListEntryAsRead(favsListID, releaseID string, isP2P bool) (types.ShortFavList, error)

MarkFavsListEntryAsRead marks a release on a favorite list as read. Requires user OAuth2 authentication.

favsListID	The favorite list ID, as obtained through GetFavsLists().
releaseID	The API release ID, as obtained through other API calls.
isP2P		Is the release ID a P2P release?

https://www.xrel.to/wiki/6344/api-favs-list-markread.html

func PerformOAuth2ApplicationAuthentication

func PerformOAuth2ApplicationAuthentication() error

PerformOAuth2UserAuthentication will perform an application authentication. Use this after ConfigureOAuth2.

func PerformOAuth2UserAuthentication

func PerformOAuth2UserAuthentication(code string) error

PerformOAuth2UserAuthentication will perform an user authentication with the code you received from GetOAuth2URL.

func RateExtInfo

func RateExtInfo(id string, rating int) (types.ExtendedExtInfo, error)

RateExtInfo rates an ExtInfo. Requires user OAuth authentication.

id	Ext Info ID.
rating	Rating between 1 (bad) to 10 (good). You may only vote once, and may not change your vote.

http://www.xrel.to/wiki/6315/api-ext-info-rate.html

func RemoveFavsListEntry

func RemoveFavsListEntry(favsListID, extInfoID string) (types.FavListEntryModificationResult, error)

RemoveFavsListEntry removes an ExtInfo from a favorite list. Requires user OAuth2 authentication.

favsListID	The favorite list ID, as obtained through GetFavsLists().
extInfoID	The ExtInfo ID, as obtained through other API calls.

http://www.xrel.to/wiki/6317/api-favs-list-delentry.html

func SearchExtInfos

func SearchExtInfos(query, extInfoType string, limit int) (types.ExtInfoSearchResult, error)

SearchExtInfos searches for ExtInfos. Please note that additional search rate limiting applies. See http://www.xrel.to/wiki/2727/api-rate-limiting.html

query			Search keyword.
extInfoType	:= ""	One of: movie|tv|game|console|software|xxx - or leave empty to search Ext Infos of all types.
limit		:= 25	Number of returned search results. Maximum and default 25.

http://www.xrel.to/wiki/6319/api-search-ext-info.html

func SearchReleases

func SearchReleases(query string, includeScene, includeP2P bool, limit int) (types.ReleaseSearchResult, error)

SearchReleases searches for Scene and P2P releases. Please note that additional search rate limiting applies. See http://www.xrel.to/wiki/2727/api-rate-limiting.html

query					Search keyword.	(required)
includeScene		:= false	If true, Scene releases will be included in the search results.
includeP2P		:= false	If true, P2P releases will be included in the search results.
limit			:= 25		Number of returned search results. Maximum and default 25.

http://www.xrel.to/wiki/6320/api-search-releases.html

Types

This section is empty.

Directories

Path Synopsis
Package types contains structs and constants for the xREL package, reflecting the xREL API JSON returns.
Package types contains structs and constants for the xREL package, reflecting the xREL API JSON returns.

Jump to

Keyboard shortcuts

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