sntrn

package module
v0.0.0-...-82588b8 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: MIT Imports: 15 Imported by: 0

README

sntrn

Go Reference Go Report Card

An easy to use library to interact with the unofficial api of senturion.

Installation

Pretty standard go stuff:

go get github.com/jdingbat/sntrn

Examples

Examples are available in ./examples

License

See LICENSE

Documentation

Index

Constants

View Source
const LOGIN_PATH = "/session/userlogin"
View Source
const LOGOUT_PATH = "/session/logout"

Variables

View Source
var (
	ErrFailedLogin = errors.New("failed login")

	ErrFailedLogout = errors.New("failed logout")

	ErrNotLoggedIn = errors.New("client not logged in")
)
View Source
var BaseUrl = url.URL{
	Scheme: "https",
	Host:   "senturion.to",
}

If this changes users can pass a new url as an option to our initializer

Functions

This section is empty.

Types

type Client

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

func New

func New(opts *Options) *Client

func NewWithToken

func NewWithToken(opts *Options, token string) *Client

Unlikely that anyone will use this but its here if you already have a token.

func (*Client) Close

func (c *Client) Close() error
func (c *Client) Links(ctx context.Context, sr SearchResponse) ([]LinksResponse, error)

func (*Client) Login

func (c *Client) Login(ctx context.Context, username, password string) error

func (*Client) Search

func (c *Client) Search(ctx context.Context, query string) ([]SearchResponse, error)

type EpisodeData

type EpisodeData struct {
	EpisodeNumber string `json:"episode_number"`
	Title         string `json:"title"`
	Plot          string `json:"plot"`
	Poster        string `json:"poster"`
	ReleaseDate   string `json:"release_date"`
}

type LinksResponse

type LinksResponse struct {
	Jwplayer []struct {
		File  string `json:"file"`
		Type  string `json:"type"`
		Label string `json:"label"`
	} `json:"jwplayer"`

	Dl   string `json:"dl"`
	DlHd string `json:"dl_hd"`

	Server struct {
		List     map[string]string `json:"list"`
		Host     string            `json:"host"`
		Selected int               `json:"selected"`
		Scheme   string            `json:"scheme"`
		P720     string            `json:"720"`
		P1080    string            `json:"1080"`
	} `json:"server"`
}

type Options

type Options struct {
	Host   *url.URL
	Client *http.Client

	LogLevel log.Level
}

type SearchResponse

type SearchResponse struct {
	Id         string `json:"id"`
	Title      string `json:"title"`
	Year       string `json:"year"`
	Genre      string `json:"genre"`
	ImdbRating string `json:"imdb_rating"`
	Poster     string `json:"poster"`
	Link       string `json:"link"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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