store

package
v0.0.0-...-1c133f8 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MagnetFileTypeFile   = "file"
	MagnetFileTypeFolder = "folder"
)

Variables

View Source
var ErrInvalidName = errors.New("invalid store name")

Functions

This section is empty.

Types

type AddMagnetData

type AddMagnetData struct {
	Id      string       `json:"id"`
	Hash    string       `json:"hash"`
	Magnet  string       `json:"magnet"`
	Name    string       `json:"name"`
	Size    int64        `json:"size"`
	Status  MagnetStatus `json:"status"`
	Files   []MagnetFile `json:"files"`
	Private bool         `json:"private,omitempty"`
	AddedAt time.Time    `json:"added_at"`
}

type AddMagnetParams

type AddMagnetParams struct {
	Ctx
	Magnet   string
	Torrent  *multipart.FileHeader
	ClientIP string
	// contains filtered or unexported fields
}

func (*AddMagnetParams) GetTorrentMeta

func (p *AddMagnetParams) GetTorrentMeta() (*metainfo.MetaInfo, *metainfo.Info, error)

type AddNewzData

type AddNewzData struct {
	Id     string     `json:"id"`
	Hash   string     `json:"hash"`
	Status NewzStatus `json:"status"`
}

type AddNewzParams

type AddNewzParams struct {
	Ctx
	File     *multipart.FileHeader
	Link     string
	ClientIP string
}

type CheckMagnetData

type CheckMagnetData struct {
	Items []CheckMagnetDataItem `json:"items"`
}

type CheckMagnetDataItem

type CheckMagnetDataItem struct {
	Hash   string       `json:"hash"`
	Magnet string       `json:"magnet"`
	Name   string       `json:"name,omitempty"`
	Size   int64        `json:"-"`
	Status MagnetStatus `json:"status"`
	Files  []MagnetFile `json:"files"`
}

type CheckMagnetParams

type CheckMagnetParams struct {
	Ctx
	Magnets          []string
	ClientIP         string
	SId              string
	LocalOnly        bool
	IsTrustedRequest bool
}

type CheckNewzData

type CheckNewzData struct {
	Items []CheckNewzDataItem `json:"items"`
}

type CheckNewzDataItem

type CheckNewzDataItem struct {
	Hash   string     `json:"hash"`
	Status NewzStatus `json:"status"`
	Files  []NewzFile `json:"files"`
}

type CheckNewzParams

type CheckNewzParams struct {
	Ctx
	Hashes []string
}

type Ctx

type Ctx = request.Ctx

type File

type File interface {
	GetIdx() int
	GetPath() string
	GetName() string
	GetSize() int64
	GetLink() string
}

type GenerateLinkData

type GenerateLinkData struct {
	Link   string `json:"link"`
	LinkId string `json:"-"`
}

type GenerateLinkParams

type GenerateLinkParams struct {
	Ctx
	Link     string
	ClientIP string
}

type GenerateNewzLinkData

type GenerateNewzLinkData struct {
	Link string `json:"link"`
}

type GenerateNewzLinkParams

type GenerateNewzLinkParams struct {
	Ctx
	Link     string
	ClientIP string
}

type GetMagnetData

type GetMagnetData struct {
	Id      string       `json:"id"`
	Name    string       `json:"name"`
	Hash    string       `json:"hash"`
	Size    int64        `json:"size"`
	Status  MagnetStatus `json:"status"`
	Files   []MagnetFile `json:"files"`
	Private bool         `json:"private,omitempty"`
	AddedAt time.Time    `json:"added_at"`
}

type GetMagnetParams

type GetMagnetParams struct {
	Ctx
	Id       string
	ClientIP string
}

type GetNewzData

type GetNewzData struct {
	Id      string     `json:"id"`
	Hash    string     `json:"hash"`
	Name    string     `json:"name"`
	Size    int64      `json:"size"`
	Status  NewzStatus `json:"status"`
	Files   []NewzFile `json:"files"`
	AddedAt time.Time  `json:"added_at"`
}

type GetNewzParams

type GetNewzParams struct {
	Ctx
	Id       string
	ClientIP string
}

type GetUserParams

type GetUserParams struct {
	Ctx
}

type GetWebzData

type GetWebzData struct {
	Id      string     `json:"id"`
	Hash    string     `json:"hash"`
	Name    string     `json:"name"`
	Size    int64      `json:"size"`
	Status  string     `json:"status"`
	Files   []WebzFile `json:"files"`
	AddedAt time.Time  `json:"added_at"`
}

type GetWebzParams

type GetWebzParams struct {
	Ctx
	Id       string
	ClientIP string
}

type ListMagnetsData

type ListMagnetsData struct {
	Items      []ListMagnetsDataItem `json:"items"`
	TotalItems int                   `json:"total_items"`
}

type ListMagnetsDataItem

type ListMagnetsDataItem struct {
	Id      string       `json:"id"`
	Hash    string       `json:"hash"`
	Name    string       `json:"name"`
	Size    int64        `json:"size"`
	Status  MagnetStatus `json:"status"`
	Private bool         `json:"private,omitempty"`
	AddedAt time.Time    `json:"added_at"`
}

type ListMagnetsParams

type ListMagnetsParams struct {
	Ctx
	Limit    int // min 1, max 500, default 100
	Offset   int // default 0
	ClientIP string
}

type ListNewzData

type ListNewzData struct {
	Items      []ListNewzDataItem `json:"items"`
	TotalItems int                `json:"total_items"`
}

type ListNewzDataItem

type ListNewzDataItem struct {
	Id      string     `json:"id"`
	Hash    string     `json:"hash"`
	Name    string     `json:"name"`
	Size    int64      `json:"size"`
	Status  NewzStatus `json:"status"`
	AddedAt time.Time  `json:"added_at"`
}

type ListNewzParams

type ListNewzParams struct {
	Ctx
	Limit    int // min 1, max 500, default 100
	Offset   int // default 0
	ClientIP string
}

type ListWebzData

type ListWebzData struct {
	Items      []ListWebzDataItem `json:"items"`
	TotalItems int                `json:"total_items"`
}

type ListWebzDataItem

type ListWebzDataItem struct {
	Id      string     `json:"id"`
	Hash    string     `json:"hash"`
	Name    string     `json:"name"`
	Size    int64      `json:"size"`
	Status  string     `json:"status"`
	AddedAt time.Time  `json:"added_at"`
	Files   []WebzFile `json:"files"`
}

type ListWebzParams

type ListWebzParams struct {
	Ctx
	Limit    int // min 1, max 500, default 100
	Offset   int // default 0
	ClientIP string
}

type MagnetFile

type MagnetFile struct {
	Idx       int                   `json:"index"`
	Link      string                `json:"link,omitempty"`
	Path      string                `json:"path"`
	Name      string                `json:"name"`
	Size      int64                 `json:"size"`
	VideoHash string                `json:"video_hash,omitempty"`
	MediaInfo *media_info.MediaInfo `json:"media_info,omitempty"`
	Source    string                `json:"source,omitempty"`
}

func (*MagnetFile) GetIdx

func (f *MagnetFile) GetIdx() int
func (f *MagnetFile) GetLink() string

func (*MagnetFile) GetName

func (f *MagnetFile) GetName() string

func (*MagnetFile) GetPath

func (f *MagnetFile) GetPath() string

func (*MagnetFile) GetSize

func (f *MagnetFile) GetSize() int64

type MagnetFileType

type MagnetFileType string

type MagnetStatus

type MagnetStatus string
const (
	MagnetStatusCached      MagnetStatus = "cached" // cached in store, ready to download instantly
	MagnetStatusQueued      MagnetStatus = "queued"
	MagnetStatusDownloading MagnetStatus = "downloading"
	MagnetStatusProcessing  MagnetStatus = "processing" // compressing / moving
	MagnetStatusDownloaded  MagnetStatus = "downloaded"
	MagnetStatusUploading   MagnetStatus = "uploading"
	MagnetStatusFailed      MagnetStatus = "failed"
	MagnetStatusInvalid     MagnetStatus = "invalid"
	MagnetStatusUnknown     MagnetStatus = "unknown"
)

type NewzFile

type NewzFile struct {
	Idx       int    `json:"index"`
	Link      string `json:"link,omitempty"`
	Path      string `json:"path"`
	Name      string `json:"name"`
	Size      int64  `json:"size"`
	VideoHash string `json:"video_hash,omitempty"`
}

func (*NewzFile) GetIdx

func (f *NewzFile) GetIdx() int
func (f *NewzFile) GetLink() string

func (*NewzFile) GetName

func (f *NewzFile) GetName() string

func (*NewzFile) GetPath

func (f *NewzFile) GetPath() string

func (*NewzFile) GetSize

func (f *NewzFile) GetSize() int64

type NewzStatus

type NewzStatus string
const (
	NewzStatusCached      NewzStatus = "cached"
	NewzStatusQueued      NewzStatus = "queued"
	NewzStatusDownloading NewzStatus = "downloading"
	NewzStatusProcessing  NewzStatus = "processing"
	NewzStatusDownloaded  NewzStatus = "downloaded"
	NewzStatusFailed      NewzStatus = "failed"
	NewzStatusInvalid     NewzStatus = "invalid"
	NewzStatusUnknown     NewzStatus = "unknown"
)

type NewzStore

type NewzStore interface {
	GetName() StoreName
	GetUser(params *GetUserParams) (*User, error)
	CheckNewz(params *CheckNewzParams) (*CheckNewzData, error)
	AddNewz(params *AddNewzParams) (*AddNewzData, error)
	GetNewz(params *GetNewzParams) (*GetNewzData, error)
	ListNewz(params *ListNewzParams) (*ListNewzData, error)
	RemoveNewz(params *RemoveNewzParams) (*RemoveNewzData, error)
	GenerateNewzLink(params *GenerateNewzLinkParams) (*GenerateNewzLinkData, error)
}

type RemoveMagnetData

type RemoveMagnetData struct {
	Id string `json:"id"`
}

type RemoveMagnetParams

type RemoveMagnetParams struct {
	Ctx
	Id string
}

type RemoveNewzData

type RemoveNewzData struct {
	Id string `json:"id"`
}

type RemoveNewzParams

type RemoveNewzParams struct {
	Ctx
	Id string
}

type Store

type Store interface {
	GetName() StoreName
	GetUser(params *GetUserParams) (*User, error)
	CheckMagnet(params *CheckMagnetParams) (*CheckMagnetData, error)
	AddMagnet(params *AddMagnetParams) (*AddMagnetData, error)
	GetMagnet(params *GetMagnetParams) (*GetMagnetData, error)
	ListMagnets(params *ListMagnetsParams) (*ListMagnetsData, error)
	RemoveMagnet(params *RemoveMagnetParams) (*RemoveMagnetData, error)
	GenerateLink(params *GenerateLinkParams) (*GenerateLinkData, error)
}

type StoreCode

type StoreCode string
const (
	StoreCodeAllDebrid  StoreCode = "ad"
	StoreCodeDebrider   StoreCode = "dr"
	StoreCodeDebridLink StoreCode = "dl"
	StoreCodeEasyDebrid StoreCode = "ed"
	StoreCodeOffcloud   StoreCode = "oc"
	StoreCodePikPak     StoreCode = "pp"
	StoreCodePremiumize StoreCode = "pm"
	StoreCodeRealDebrid StoreCode = "rd"
	StoreCodeStremThru  StoreCode = "st"
	StoreCodeTorBox     StoreCode = "tb"
)

func (StoreCode) IsValid

func (sc StoreCode) IsValid() bool

func (StoreCode) Name

func (sc StoreCode) Name() StoreName

type StoreName

type StoreName string
const (
	StoreNameAlldebrid  StoreName = "alldebrid"
	StoreNameDebrider   StoreName = "debrider"
	StoreNameDebridLink StoreName = "debridlink"
	StoreNameEasyDebrid StoreName = "easydebrid"
	StoreNameOffcloud   StoreName = "offcloud"
	StoreNamePikPak     StoreName = "pikpak"
	StoreNamePremiumize StoreName = "premiumize"
	StoreNameRealDebrid StoreName = "realdebrid"
	StoreNameStremThru  StoreName = "stremthru"
	StoreNameTorBox     StoreName = "torbox"
)

func (StoreName) Code

func (sn StoreName) Code() StoreCode

func (StoreName) IsValid

func (sn StoreName) IsValid() bool

func (StoreName) String

func (n StoreName) String() string

func (StoreName) Validate

func (sn StoreName) Validate() (StoreName, error)

type User

type User struct {
	Id                 string                 `json:"id"`
	Email              string                 `json:"email"`
	SubscriptionStatus UserSubscriptionStatus `json:"subscription_status"`
	HasUsenet          bool                   `json:"has_usenet"`
}

type UserSubscriptionStatus

type UserSubscriptionStatus string
const (
	UserSubscriptionStatusPremium UserSubscriptionStatus = "premium"
	UserSubscriptionStatusTrial   UserSubscriptionStatus = "trial"
	UserSubscriptionStatusExpired UserSubscriptionStatus = "expired"
)

type WebzFile

type WebzFile struct {
	Idx       int    `json:"index"`
	Link      string `json:"link,omitempty"`
	Path      string `json:"path"`
	Name      string `json:"name"`
	Size      int64  `json:"size"`
	VideoHash string `json:"video_hash,omitempty"`
}

func (*WebzFile) GetIdx

func (f *WebzFile) GetIdx() int
func (f *WebzFile) GetLink() string

func (*WebzFile) GetName

func (f *WebzFile) GetName() string

func (*WebzFile) GetPath

func (f *WebzFile) GetPath() string

func (*WebzFile) GetSize

func (f *WebzFile) GetSize() int64

type WebzStore

type WebzStore interface {
	GetWebz(params *GetWebzParams) (*GetWebzData, error)
	ListWebz(params *ListWebzParams) (*ListWebzData, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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