Documentation
¶
Index ¶
- func SetAssistant(svc AssistantService)
- func SetServices(s *Services)
- func SetSubscribeService(s SubscribeService)
- type AssistantService
- type AttendanceOutcome
- type AttendanceService
- type BindingResolver
- type DownloaderOption
- type DownloaderStatusSource
- type IDNameOption
- type RSSWizardService
- type RunLine
- type Services
- type SubscribeCandidate
- type SubscribeLine
- type SubscribeService
- type TodayLine
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetAssistant ¶ added in v1.0.0
func SetAssistant(svc AssistantService)
SetAssistant 接上内置 AI 助手(nil 摘掉)。
func SetServices ¶
func SetServices(s *Services)
func SetSubscribeService ¶ added in v1.0.0
func SetSubscribeService(s SubscribeService)
SetSubscribeService 登记订阅服务(为 nil 时 /sub、/subs 回不可用)。
Types ¶
type AssistantService ¶ added in v1.0.0
type AssistantService interface {
// NewChat 给这个绑定开一个新会话:之后的消息不带以前的上下文。助手没有启用时返回错误。
NewChat(ctx context.Context, src chatops.Source) error
}
AssistantService 是 /newchat 用到的内置 AI 助手能力(路线图 M19)。
type AttendanceOutcome ¶ added in v1.0.0
AttendanceOutcome 是一个站点当天的签到结果;Status 取 signed、already、failed、unsupported、pending。
type AttendanceService ¶ added in v1.0.0
type AttendanceService interface {
// SignIn 立即签到一个站点。
SignIn(ctx context.Context, site string) (AttendanceOutcome, error)
// SignInAll 对开启了自动签到、当天还没有结果的站点各签到一次,返回这些站点当天的结果。
SignInAll(ctx context.Context) ([]AttendanceOutcome, error)
}
AttendanceService 是 /signin 用到的每日签到能力。
type BindingResolver ¶
type BindingResolver interface {
FindByChannelUser(ctx context.Context, confID uint, channelType, channelUserID string) (uint, bool, error)
}
BindingResolver 用于 /unbind 命令解析自身 binding ID。
type DownloaderOption ¶ added in v0.35.0
type DownloaderStatusSource ¶
type DownloaderStatusSource interface {
GetAllDownloaderStatus() []downloader.DownloaderStatus
}
DownloaderStatusSource 抽象 *downloader.DownloaderManager.GetAllDownloaderStatus()。
type IDNameOption ¶ added in v0.35.0
type RSSWizardService ¶ added in v0.35.0
type RSSWizardService interface {
AppendRSSToSite(siteName string, entry models.RSSConfig) (models.RSSConfig, error)
ListRSSForSite(siteName string) ([]models.RSSConfig, error)
DeleteRSSFromSite(siteName string, rssID uint) (models.RSSConfig, error)
ListDownloaders(ctx context.Context) ([]DownloaderOption, error)
ListFilterRules(ctx context.Context) ([]IDNameOption, error)
ListNotificationChannels(ctx context.Context) ([]IDNameOption, error)
}
type Services ¶
type Services struct {
Task app.TaskService
Torrent app.TorrentService
Site app.SiteService
Binding app.BindingService
Downloader DownloaderStatusSource
RSSWizard RSSWizardService
Bindings BindingResolver
Sessions chatops.SessionStoreAPI
Attendance AttendanceService
}
Services 是 chatops 命令访问的业务依赖集合。
type SubscribeCandidate ¶ added in v1.0.0
type SubscribeCandidate struct {
Kind string `json:"kind"`
TMDBID int `json:"tmdb_id"`
Title string `json:"title"`
Year int `json:"year"`
Subscribed bool `json:"subscribed"`
}
SubscribeCandidate 是 /sub 列出的一个条目。
type SubscribeLine ¶ added in v1.0.0
type SubscribeLine struct {
// ID 是订阅的编号(/runs、/unlock 用它)
ID uint
Title string
Status string
Progress string
// Next 是下次主动搜索的时间(暂停、完成的是空)
Next string
}
SubscribeLine 是 /subs 的一行。
type SubscribeService ¶ added in v1.0.0
type SubscribeService interface {
// Search 在 TMDB 上按关键字找电影与剧集(按热度排)。
Search(ctx context.Context, keyword string) ([]SubscribeCandidate, error)
// Subscribe 建订阅(剧集 season 为 0 时订最新一季),返回订阅的名字(剧集带季)。
Subscribe(ctx context.Context, kind string, tmdbID, season int) (string, error)
// Follow 建追剧(season 为 0 时追最新一季),按追剧的默认设置(按播出时间搜索、开着版本锁),返回名字与设置的说明。
Follow(ctx context.Context, tmdbID, season int) (string, error)
// List 列出订阅(新的在前)。
List(ctx context.Context) ([]SubscribeLine, error)
// Runs 是编号为 id 的订阅的名字与最近 limit 次运行(新的在前)。
Runs(ctx context.Context, id uint, limit int) (string, []RunLine, error)
// Unlock 让追剧的第 episode 集不受版本锁限制(并尽快搜一次),返回订阅的名字。
Unlock(ctx context.Context, id uint, episode int) (string, error)
// Today 是今天播出的集与上映的电影(暂停的订阅不算,按播出时刻),day 是今天的日期。
Today(ctx context.Context) (day string, lines []TodayLine, err error)
}
SubscribeService 是 /sub、/subs、/follow、/runs、/unlock、/today 用到的订阅能力。订阅服务比 ChatOps 晚建,用 SetSubscribeService 单独登记。
type TodayLine ¶ added in v1.0.0
type TodayLine struct {
// Title 是订阅名(带年份与季)加集号与集名;电影写上映
Title string
MediaType string
Season int
Episode int
Name string
// AirTime 是播出时刻(按播出时间追剧的才有,例如 21:30)
AirTime string
// State 是 library、downloading、waiting_version、missing、upcoming、skipped
State string
}
TodayLine 是 /today 的一项:今天播出的一集,或上映的电影。