binb

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2016 License: AGPL-3.0 Imports: 17 Imported by: 1

Documentation

Overview

A helper package to make calls to the API served by BinB Reader.

Index

Constants

This section is empty.

Variables

View Source
var StaticImageSizes = []string{"M_H", "S_H", "M_L", "S_L"}

The various image sizes. Presumably:

M/S = Medium/Small resolution
H/L = High/Low quality

There's also SS, but it's unscrambled and extremely low resoution and quality. If you really want SS, use get_nec_image with regular filenames. L has pretty bad artifacting, so most of the time S_H > M_L. I've never seen anything over M, so for now I'm assuming it doesn't exist.

Functions

This section is empty.

Types

type Api

type Api struct {
	Bib, Cid, ContentServer string
	ContentInfo             *ContentInfoResponse
	Content                 *ContentResponse
	Descrambler             *Descrambler
	Pages, FullPages        []string
	K                       string
	ServerType              ContentServerType
	Session                 *http.Client
	Params                  ParamsGetter
}

func NewApi

func NewApi(bib, cid string, session *http.Client, params ParamsGetter) *Api

func (*Api) GetContent

func (binb *Api) GetContent() error

func (*Api) GetContentInfo

func (binb *Api) GetContentInfo() error

func (*Api) GetImage

func (binb *Api) GetImage(page int) (io.ReadCloser, error)

type ContentInfoResponse

type ContentInfoResponse struct {
	Abstract string
	Authors  []struct {
		Name, Role, Ruby string
	}
	Categories                             []string
	ContentID, ContentType, ContentsServer string
	ServerType                             ContentServerType
	Title, TitleRuby                       string
	P, Ctbl, Ptbl, Atbl, Ttbl              string
}

type ContentResponse

type ContentResponse struct {
	ContentDate, ConverterType, ConverterVersion string
	SmlImageCnt, NecImageSize, NecImageCnt       int
	Ttx, Prop, SBCVersion                        string
}

type ContentServerType

type ContentServerType int

The API doesn't always serve images over the API, but often redirects to a CDN.

const (
	ServerTypeUnset  ContentServerType = iota - 1
	ServerTypeSbc                      // means the images should be downloaded through the provided sbc API
	ServerTypeStatic                   // means the images should be downloaded directly from the provided CDN
)

type Descrambler

type Descrambler struct {
	Ctbl, Ptbl []string
	// contains filtered or unexported fields
}

func NewDescrambler

func NewDescrambler(ctbl, ptbl []string) (*Descrambler, error)

func (*Descrambler) Descramble

func (ds *Descrambler) Descramble(filename string, reader io.Reader) (image.Image, error)

type ParamsGetter

type ParamsGetter func(binb *Api, method string) map[string][]string

type Response

type Response struct {
	Result int
	Items  []json.RawMessage
}

Jump to

Keyboard shortcuts

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