Documentation ¶
Index ¶
- Constants
- func ErrUnsupportedMessageType(messageType string) error
- func ErrUnsupportedOpcode(op Opcode) error
- func MustBytes[D Data](opcode Opcode, data D) []byte
- func NewBytes[D Data](opcode Opcode, data D) ([]byte, error)
- type Anime
- type Data
- type DataAcknowledged
- type DataActivityCancel
- type DataActivityDifference
- type DataActivityDifferences
- type DataActivityDownload
- type DataActivityGetProgress
- type DataActivityMetadata
- type DataActivityProgress
- type DataActivityProgressItem
- type DataDownloadCancelItem
- type DataDownloadItem
- type DataException
- type DataStatusIRC
- type DataStatusJob
- type DifferenceToken
- type Error
- type JobState
- type Opcode
- type Payload
- type ProgressType
Constants ¶
View Source
const ( ErrAcknowledgedTimeout = Error("acknowledged timeout") ErrIDMustBeGreaterThan0 = Error("`id` must be greater than 0") ErrQualityIDMustBeGreaterThan0 = Error("`q` must be greater than 0") ErrReleaseGroupIDMustBeGreaterThan0 = Error("`rg` must be greater than 0") ErrUnexpectedNilItem = Error("unexpected `nil` item") ErrExpectedValidJSON = Error("expected a valid JSON") ErrUnexpectedRequestType = Error("unexpected request type") ErrTypeIsRequired = Error("`typ` is required") ErrPercentageIsRequired = Error("`pct` is required") ErrAddressIsRequired = Error("`addr` (address) is required") ErrAddressIsInvalid = Error("`addr` (address) is not a valid address") ErrSizeIsRequired = Error("`sz` (size) is required") ErrSizeIsNotValid = Error("`sz` (size) is not valid (>0)") ErrNameIsRequired = Error("`n` (name) is required") ErrDataIsRequired = Error("`d` (data) is required") ErrMessageIsRequired = Error("`m` (message) is required") ErrMessageIsEmpty = Error("`m` (message) is empty") )
Variables ¶
This section is empty.
Functions ¶
func ErrUnsupportedOpcode ¶
Types ¶
type Anime ¶
type DataAcknowledged ¶
type DataAcknowledged struct{}
func (DataAcknowledged) Validate ¶
func (DataAcknowledged) Validate() error
type DataActivityCancel ¶
type DataActivityCancel []*DataDownloadCancelItem
func (DataActivityCancel) Validate ¶
func (items DataActivityCancel) Validate() error
type DataActivityDifference ¶
type DataActivityDifference struct { Token DifferenceToken `json:"tkn"` Anime Anime `json:"an"` Progress *DataActivityProgressItem `json:"pg"` }
func (DataActivityDifference) String ¶
func (d DataActivityDifference) String() string
func (DataActivityDifference) Validate ¶
func (d DataActivityDifference) Validate() error
type DataActivityDifferences ¶
type DataActivityDifferences []*DataActivityDifference
func (DataActivityDifferences) String ¶
func (d DataActivityDifferences) String() string
func (DataActivityDifferences) Validate ¶
func (d DataActivityDifferences) Validate() error
type DataActivityDownload ¶
type DataActivityDownload []*DataDownloadItem
func (DataActivityDownload) Len ¶
func (d DataActivityDownload) Len() int
func (DataActivityDownload) Less ¶
func (d DataActivityDownload) Less(i, j int) bool
Less primarily sorts by the priority
func (DataActivityDownload) Swap ¶
func (d DataActivityDownload) Swap(i, j int)
func (DataActivityDownload) Validate ¶
func (items DataActivityDownload) Validate() error
type DataActivityGetProgress ¶
type DataActivityGetProgress struct{}
func (DataActivityGetProgress) Validate ¶
func (d DataActivityGetProgress) Validate() error
type DataActivityMetadata ¶
type DataActivityMetadata struct { Title string `json:"t"` Episode string `json:"e"` Height int `json:"h"` ReleaseGroup string `json:"rg"` Thumbnail string `json:"th"` CRC32 string `json:"crc32"` Duration float64 `json:"dur"` Size int64 `json:"sz"` VideoPath string `json:"vp"` }
func (DataActivityMetadata) Validate ¶
func (DataActivityMetadata) Validate() error
type DataActivityProgress ¶
type DataActivityProgress map[string]struct { ID int64 `json:"d"` ReleaseGroups map[string]map[string]map[int]*DataActivityProgressItem `json:"rg"` }
func (DataActivityProgress) Validate ¶
func (d DataActivityProgress) Validate() error
type DataActivityProgressItem ¶
type DataActivityProgressItem struct { Type ProgressType `json:"typ"` Percentage float64 `json:"pct"` Speed float64 `json:"sp"` // Download/upload properties CurrentFilesize *float64 `json:"cur_sz,omitempty"` Filesize *float64 `json:"sz,omitempty"` // Transcode properties CurrentDuration *float64 `json:"cur_dur,omitempty"` Duration *float64 `json:"dur,omitempty"` }
DataActivityProgressItem is used show the progress for the possible progress types.
func (DataActivityProgressItem) String ¶
func (p DataActivityProgressItem) String() string
func (DataActivityProgressItem) Validate ¶
func (p DataActivityProgressItem) Validate() error
type DataDownloadCancelItem ¶
type DataDownloadItem ¶
type DataDownloadItem struct { ID int64 `json:"d"` QualityID *int64 `json:"q,omitempty"` ReleaseGroupID int64 `json:"rg"` Prioritize *bool `json:"p,omitempty"` }
func (*DataDownloadItem) Equals ¶
func (d *DataDownloadItem) Equals(in *DataDownloadItem) bool
func (*DataDownloadItem) String ¶
func (d *DataDownloadItem) String() string
type DataException ¶
type DataException struct {
Message string `json:"m"`
}
func (DataException) Validate ¶
func (d DataException) Validate() error
type DataStatusIRC ¶
type DataStatusIRC struct {
Connected bool `json:"c"`
}
func (DataStatusIRC) Validate ¶
func (DataStatusIRC) Validate() error
type DataStatusJob ¶
type DataStatusJob struct { State JobState `json:"s"` ID string `json:"d"` LastActivity time.Time `json:"la,omitempty"` NextActivity *time.Time `json:"na,omitempty"` StartedAt *time.Time `json:"sat,omitempty"` EndedAt *time.Time `json:"eat,omitempty"` Period time.Duration `json:"p"` }
func (DataStatusJob) Validate ¶
func (DataStatusJob) Validate() error
type DifferenceToken ¶
type DifferenceToken rune
const ( DifferenceToken_Undefined DifferenceToken = '?' DifferenceToken_Add DifferenceToken = '+' DifferenceToken_Remove DifferenceToken = '-' DifferenceToken_Modify DifferenceToken = '.' )
func ParseDifferenceToken ¶
func ParseDifferenceToken(t string) DifferenceToken
func (DifferenceToken) MarshalJSON ¶
func (d DifferenceToken) MarshalJSON() ([]byte, error)
func (*DifferenceToken) UnmarshalJSON ¶
func (d *DifferenceToken) UnmarshalJSON(b []byte) error
type Opcode ¶
type Opcode uint16
const ( // Bidirectional between the website and the server Acknowledged Opcode = 0 Exception Opcode = 1 // Activity Activity_Progress Opcode = 10 Activity_Metadata Opcode = 11 Activity_Download Opcode = 12 Activity_Cancel Opcode = 13 Activity_Difference Opcode = 14 Activity_GetProgress Opcode = 15 // Status Status_IRC Opcode = 20 Status_Job Opcode = 21 )
type ProgressType ¶
type ProgressType string
ProgressType defines the progression type
const ( // Progress_Download is the type when the file is currently being uploaded Progress_Download ProgressType = "download" // Progress_Transcode is the type when the file is currently being transcoded // (generally from mkv to mp4/ main purpose is to prepare it for the web) Progress_Transcode ProgressType = "transcode" // Progress_Upload is the type when the runner is uploading the finalized transcode back // to the host. Progress_Upload ProgressType = "upload" // Progress_Metadata is when we receive metadata related information for the file // (duration, crc32, thumbnail), Progress_Metadata ProgressType = "metadata" )
Click to show internal directories.
Click to hide internal directories.