torrents

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: BSD-3-Clause Imports: 15 Imported by: 0

README

PkgGoDev GitHub license GitHub stars

Overview

go-torrents is a torrents' data provider. Currently, the supported the Rutor only. Each torrent has a lot of information and can get information from the Kinopoisk if it a film.

Install

go get github.com/error0x001/go-torrents/rutor

Examples

See in examples/rutor.go

Documentation

https://pkg.go.dev/github.com/error0x001/go-torrents

Progress

WIP

TODO

  1. Add torrents search by Rutor
  2. Improve the integration with the Rutracker
  3. Add tMDB integration tMDB
  4. Add integration with the Pirate Bay
  5. Release 1.0.0

License

License BSD 3-Clause license

Documentation

Overview

TorrentManager for work with difference torrent trackers.

The main module for work with torrent object.

Index

Constants

View Source
const (
	Anime           = "anime"
	Books           = "books"
	Cartoons        = "cartoons"
	ForeignFilms    = "foreign_films"
	ForeignReleases = "foreign_releases"
	ForeignSeries   = "foreign_series"
	Games           = "games"
	Humor           = "humor"
	Life            = "life"
	Music           = "music"
	Other           = "other"
	RussianFilms    = "russian_films"
	RussianSeries   = "russian_series"
	SciFiFilms      = "sci_fi_films"
	Soft            = "soft"
	Sport           = "sport_and_health"
	TOP24           = "top_24"
	TV              = "tv"

	Video       = "video"
	Forum       = "forum"
	News        = "news"
	Study       = "study"
	Series      = "series"
	Documentary = "documentary"
	AutoMoto    = "auto_moto"
	Apple       = "apple"
	Mobile      = "mobile"
	Audiobooks  = "audiobooks"
	Block       = "block"
	HiRes       = "hi_res"
	Goods       = "goods"
)

Category names.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthData added in v0.1.1

type AuthData struct {
	Login    string
	Password string
}

type Category

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

Category of a torrent.

func (*Category) GetID

func (c *Category) GetID() int

GetID returns the ID of category.

func (*Category) GetIsVideo

func (c *Category) GetIsVideo() bool

GetIsVideo returns the isVideo property of the category.

func (*Category) GetName

func (c *Category) GetName() string

GetName returns the name of the category.

func (*Category) GetSubCategories added in v0.1.1

func (c *Category) GetSubCategories() []*Category

GetSubCategories returns the isVideo property of the category.

func (*Category) GetSubCategoriesIDs added in v0.1.1

func (c *Category) GetSubCategoriesIDs() []uint16

GetSubCategoriesIDs returns the isVideo property of the category.

func (*Category) GetValue

func (c *Category) GetValue() string

GetValue returns the value of the category.

type CommonSettings added in v0.1.1

type CommonSettings struct {
	IsDiscussed uint16
	IsPopular   uint16
}

OPTIONAL CommonSettings is setting to define Torrent. isDiscussed and Torrent. isPopular. If the value in Torrent more than value in the setting, the value in the torrent will be true.

type KPData

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

KPData is a struct with the KP rating and the link to KP.

func (*KPData) GetRating

func (kd *KPData) GetRating() float64

GetRating returns the rating of the movie from KP.

func (*KPData) GetTitle

func (kd *KPData) GetTitle() string

GetTitle returns the title of the movie from KP.

func (*KPData) GetURL

func (kd *KPData) GetURL() string

GetURL returns the URL to the movie from KP.

func (*KPData) GetYear

func (kd *KPData) GetYear() uint16

GetYear returns the year of the movie from KP.

type SearchResult added in v0.1.1

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

SearchResult is a store with searched data.

func (*SearchResult) GetCurrentPage added in v0.1.1

func (sr *SearchResult) GetCurrentPage() uint8

func (*SearchResult) GetNextPage added in v0.1.1

func (sr *SearchResult) GetNextPage(m *TorrentManager) (*SearchResult, error)

GetNextPage returns next page of search data.

func (*SearchResult) GetOtherPages added in v0.1.1

func (sr *SearchResult) GetOtherPages() map[uint8]string

GetOtherPages returns other pages with result data.

func (*SearchResult) GetPageByNumber added in v0.1.1

func (sr *SearchResult) GetPageByNumber(m *TorrentManager, pageNumber uint8) (*SearchResult, error)

GetPageByNumber returns search page data by page number.

func (*SearchResult) GetTorrents added in v0.1.1

func (sr *SearchResult) GetTorrents() []*Torrent

GetTorrents return list of Torrent -s which were found.

func (*SearchResult) GetTotalPages added in v0.1.1

func (sr *SearchResult) GetTotalPages() uint8

GetTotalPages returns number of pages with result data.

type Torrent

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

Torrent is an object with torrent data.

func (*Torrent) GetCategory

func (t *Torrent) GetCategory() *Category

GetCategory returns the Category from the Torrent object.

func (*Torrent) GetCleanedTitle

func (t *Torrent) GetCleanedTitle() string

GetCleanedTitle returns the Category from the Torrent object.

func (*Torrent) GetCommentsNumber

func (t *Torrent) GetCommentsNumber() uint16

GetCommentsNumber returns the comments number.

func (*Torrent) GetDownloadsNumber

func (t *Torrent) GetDownloadsNumber() uint16

GetDownloadsNumber returns the downloads number.

func (*Torrent) GetIsDiscussed

func (t *Torrent) GetIsDiscussed() bool

GetIsDiscussed returns true if the Torrent is discussed.

func (*Torrent) GetIsPopular

func (t *Torrent) GetIsPopular() bool

GetIsPopular returns true if the Torrent is popular.

func (*Torrent) GetKPRating

func (t *Torrent) GetKPRating() float64

GetKPRating returns the rating from KP data.

func (*Torrent) GetKPTitle

func (t *Torrent) GetKPTitle() string

GetKPTitle returns the title from KP data.

func (*Torrent) GetKPURL

func (t *Torrent) GetKPURL() string

GetKPURL returns the URL from KP data.

func (*Torrent) GetKPYear

func (t *Torrent) GetKPYear() uint16

GetKPYear returns year from KP.

func (t *Torrent) GetMagnetLink() string

GetMagnetLink returns the magnet link.

func (*Torrent) GetReleaseDate

func (t *Torrent) GetReleaseDate() time.Time

GetMagnetLink returns the release date.

func (*Torrent) GetSize

func (t *Torrent) GetSize() string

GetSize returns the size.

func (*Torrent) GetTitle

func (t *Torrent) GetTitle() string

GetTitle returns the title.

func (t *Torrent) GetTorrentFileLink() string

GetTorrentFileLink returns the link to the torrent file.

func (*Torrent) GetURL

func (t *Torrent) GetURL() string

GetURL returns the link to the distribution.

func (*Torrent) GetUploadsNumber

func (t *Torrent) GetUploadsNumber() uint16

GetUploadsNumber returns the currently uploads number.

func (*Torrent) GetYear

func (t *Torrent) GetYear() uint16

GetYear returns year from title of torrent.

func (*Torrent) UpdateKPData

func (t *Torrent) UpdateKPData(client *http.Client, userAgent string) (*KPData, error)

UpdateKPData updates and returns a KP data from current torrent.

type TorrentManager added in v0.1.1

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

TorrentManager is the main struct for work with Torrent.

func New

func New(
	rutorClient, rutrackerClient *http.Client,
	fs *CommonSettings, rutrackerAuthData *AuthData,
) (*TorrentManager, error)

Create a new TorrentManager. rutorClient is simple. Just http client with proxy if it the Rutor is blocked in your country. rutrackerClient should be with cookies. Also for rutracker integration requires login and password. See examples/rutracker.go

func (*TorrentManager) FindOnRutrackerByNameAndCategory added in v0.1.1

func (m *TorrentManager) FindOnRutrackerByNameAndCategory(query string, category *Category) (*SearchResult, error)

FindOnRutrackerByNameAndCategory is implementation of search by Rutracker.org. You can: - find by name in the forum - find name + category list, see examples for more information.

func (*TorrentManager) GetForeignFilms added in v0.1.1

func (m *TorrentManager) GetForeignFilms() (*Category, []*Torrent, error)

GetForeignFilms returns TOP foreign films.

func (*TorrentManager) GetLife added in v0.1.1

func (m *TorrentManager) GetLife() (*Category, []*Torrent, error)

GetLife returns TOP life torrents.

func (*TorrentManager) GetRutorAnime added in v0.1.1

func (m *TorrentManager) GetRutorAnime() (*Category, []*Torrent, error)

GetRutorAnime returns TOP anime.

func (*TorrentManager) GetRutorBooks added in v0.1.1

func (m *TorrentManager) GetRutorBooks() (*Category, []*Torrent, error)

GetRutorBooks returns TOP books.

func (*TorrentManager) GetRutorCartoons added in v0.1.1

func (m *TorrentManager) GetRutorCartoons() (*Category, []*Torrent, error)

GetRutorCartoons returns TOP cartoons.

func (*TorrentManager) GetRutorForeignRelease added in v0.1.1

func (m *TorrentManager) GetRutorForeignRelease() (*Category, []*Torrent, error)

GetRutorForeignRelease returns TOP foreign releases.

func (*TorrentManager) GetRutorForeignSeries added in v0.1.1

func (m *TorrentManager) GetRutorForeignSeries() (*Category, []*Torrent, error)

GetRutorForeignSeries returns TOP foreign series.

func (*TorrentManager) GetRutorGames added in v0.1.1

func (m *TorrentManager) GetRutorGames() (*Category, []*Torrent, error)

GetRutorGames returns TOP games.

func (*TorrentManager) GetRutorHumor added in v0.1.1

func (m *TorrentManager) GetRutorHumor() (*Category, []*Torrent, error)

GetRutorHumor returns TOP humor shows.

func (*TorrentManager) GetRutorMusic added in v0.1.1

func (m *TorrentManager) GetRutorMusic() (*Category, []*Torrent, error)

GetRutorMusic returns TOP music.

func (*TorrentManager) GetRutorOther added in v0.1.1

func (m *TorrentManager) GetRutorOther() (*Category, []*Torrent, error)

GetRutorOther returns TOP torrents in other categories.

func (*TorrentManager) GetRutorRussianFilms added in v0.1.1

func (m *TorrentManager) GetRutorRussianFilms() (*Category, []*Torrent, error)

GetRutorRussianFilms returns TOP russian films.

func (*TorrentManager) GetRutorRussianSeries added in v0.1.1

func (m *TorrentManager) GetRutorRussianSeries() (*Category, []*Torrent, error)

GetRutorRussianSeries returns TOP russian series.

func (*TorrentManager) GetRutorSciFiFilms added in v0.1.1

func (m *TorrentManager) GetRutorSciFiFilms() (*Category, []*Torrent, error)

GetRutorSciFiFilms returns TOP sci-fi films.

func (*TorrentManager) GetRutorSoft added in v0.1.1

func (m *TorrentManager) GetRutorSoft() (*Category, []*Torrent, error)

GetRutorSoft returns TOP soft.

func (*TorrentManager) GetRutorSport added in v0.1.1

func (m *TorrentManager) GetRutorSport() (*Category, []*Torrent, error)

GetRutorSport returns TOP sport shows.

func (*TorrentManager) GetRutorTV added in v0.1.1

func (m *TorrentManager) GetRutorTV() (*Category, []*Torrent, error)

GetRutorTV returns TOP TV shows.

func (*TorrentManager) GetRutorTop added in v0.1.1

func (m *TorrentManager) GetRutorTop() (map[*Category][]*Torrent, error)

GetRutorTop returns ALL torrents in map format where k is a Category and v is a Torrent list.

func (*TorrentManager) GetRutorTop24 added in v0.1.1

func (m *TorrentManager) GetRutorTop24() (*Category, []*Torrent, error)

GetRutorTop24 returns TOP torrents in the last 24 hours.

func (*TorrentManager) GetRutrackerCategories added in v0.1.1

func (m *TorrentManager) GetRutrackerCategories() (map[uint16]*Category, error)

Get list of Category -ies from the rutracker.

func (*TorrentManager) RefreshCategoriesFromRutracker added in v0.1.1

func (m *TorrentManager) RefreshCategoriesFromRutracker() (map[uint16]*Category, error)

RefreshCategoriesFromRutracker updates categories.

func (*TorrentManager) RefreshRutorTOP added in v0.1.1

func (m *TorrentManager) RefreshRutorTOP() (*http.Response, error)

RefreshRutorTOP torrents for your manager.

Directories

Path Synopsis
Example with custom HTTP client via SOCKS5 VPN
Example with custom HTTP client via SOCKS5 VPN
The package can get the most wanted data by the title of the film.
The package can get the most wanted data by the title of the film.
rutor module

Jump to

Keyboard shortcuts

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