api

package
v0.0.0-...-3c0921f Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterFlags

func RegisterFlags(f []cli.Flag) []cli.Flag

Types

type Api

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

func New

func New(c *cli.Context, cl *http.Client) *Api

func (*Api) AttachExternalFile

func (s *Api) AttachExternalFile(ei ra.ExportItem, u string) string

func (*Api) AttachExternalSubtitle

func (s *Api) AttachExternalSubtitle(ei ra.ExportItem, u string) string

func (*Api) Download

func (s *Api) Download(ctx context.Context, u string) (io.ReadCloser, error)

func (*Api) DownloadWithRange

func (s *Api) DownloadWithRange(ctx context.Context, u string, start int, end int) (io.ReadCloser, error)

func (*Api) ExportResourceContent

func (s *Api) ExportResourceContent(ctx context.Context, c *Claims, infohash string, itemID string) (e *ra.ExportResponse, err error)

func (*Api) GetMediaProbe

func (s *Api) GetMediaProbe(ctx context.Context, u string) (*MediaProbe, error)

func (*Api) GetOpenSubtitles

func (s *Api) GetOpenSubtitles(ctx context.Context, u string) ([]OpenSubtitleTrack, error)

func (*Api) GetResource

func (s *Api) GetResource(ctx context.Context, c *Claims, infohash string) (e *ra.ResourceResponse, err error)

func (*Api) ListResourceContent

func (s *Api) ListResourceContent(ctx context.Context, c *Claims, infohash string, args *ListResourceContentArgs) (e *ra.ListResponse, err error)

func (*Api) MakeClaimsFromContext

func (s *Api) MakeClaimsFromContext(c *gin.Context) (*Claims, error)

func (*Api) RegisterHandler

func (s *Api) RegisterHandler(c *cli.Context, r *gin.Engine) error

func (*Api) Stats

func (s *Api) Stats(ctx context.Context, u string) (chan EventData, error)

func (*Api) StoreResource

func (s *Api) StoreResource(ctx context.Context, c *Claims, resource []byte) (e *ra.ResourceResponse, err error)

type ApiClaimsContext

type ApiClaimsContext struct{}

type Claims

type Claims struct {
	jwt.StandardClaims
	Rate          string `json:"rate,omitempty"`
	Role          string `json:"role,omitempty"`
	SessionID     string `json:"sessionID"`
	Domain        string `json:"domain"`
	Agent         string `json:"agent"`
	RemoteAddress string `json:"remoteAddress"`
}

func GetClaimsFromContext

func GetClaimsFromContext(c *gin.Context) *Claims

type EventData

type EventData struct {
	Total     int64 `json:"total"`
	Completed int   `json:"completed"`
	Peers     int   `json:"peers"`
	Status    int   `json:"status"`
	Pieces    []struct {
		Position int  `json:"position"`
		Complete bool `json:"complete"`
		Priority int  `json:"priority"`
	} `json:"pieces"`
	Seeders  int `json:"seeders"`
	Leechers int `json:"leechers"`
}

type ExtSubtitle

type ExtSubtitle struct {
	Srclang string `json:"srclang"`
	Label   string `json:"label"`
	Src     string `json:"src"`
	Format  string `json:"format"`
	Id      string `json:"id"`
	Hash    string `json:"hash"`
}

type ListResourceContentArgs

type ListResourceContentArgs struct {
	Limit  uint
	Offset uint
	Path   string
	Output ListResourceContentOutputType
}

func (*ListResourceContentArgs) ToQuery

func (s *ListResourceContentArgs) ToQuery() url.Values

type ListResourceContentOutputType

type ListResourceContentOutputType string
const (
	OutputList ListResourceContentOutputType = "list"
	OutputTree ListResourceContentOutputType = "tree"
)

type MediaProbe

type MediaProbe struct {
	Format struct {
		FormatName string `json:"format_name"`
		BitRate    string `json:"bit_rate"`
		Duration   string `json:"duration"`
		Tags       struct {
			CompatibleBrands string    `json:"compatible_brands"`
			Copyright        string    `json:"copyright"`
			CreationTime     time.Time `json:"creation_time"`
			Description      string    `json:"description"`
			Encoder          string    `json:"encoder"`
			MajorBrand       string    `json:"major_brand"`
			MinorVersion     string    `json:"minor_version"`
			Title            string    `json:"title"`
		} `json:"tags"`
	} `json:"format"`
	Streams []struct {
		CodecName string `json:"codec_name"`
		CodecType string `json:"codec_type"`
		Width     int    `json:"width,omitempty"`
		Height    int    `json:"height,omitempty"`
		BitRate   string `json:"bit_rate"`
		Duration  string `json:"duration"`
		Tags      struct {
			CreationTime time.Time `json:"creation_time"`
			HandlerName  string    `json:"handler_name"`
			Language     string    `json:"language"`
			VendorId     string    `json:"vendor_id"`
			Title        string    `json:"title"`
		} `json:"tags"`
		Index         int    `json:"index,omitempty"`
		Channels      int    `json:"channels,omitempty"`
		ChannelLayout string `json:"channel_layout,omitempty"`
		SampleRate    string `json:"sample_rate,omitempty"`
	} `json:"streams"`
}

type OpenSubtitleTrack

type OpenSubtitleTrack struct {
	ID string
	*ra.ExportTrack
}

Jump to

Keyboard shortcuts

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