Documentation
¶
Overview ¶
Package servarr 是 Servarr 兼容入口(媒体中心 M10):在主端口的 /servarr/radarr/api/v3/* 与 /servarr/sonarr/api/v3/* 上实现 Radarr v3 与 Sonarr v3 API 的一个子集,让 Seerr 把 pt-tools 当成 Radarr、Sonarr 用:Seerr 里的请求变成 pt-tools 的 电影订阅与追剧,订阅的状态与库里的情况回给 Seerr。
只实现 Seerr 固定 commit dca1af6a(seerr-team/seerr,2026-11-01)用到的接口与字段,契约见 docs/guide/servarr.md 与测试。
Key 放在查询参数 apikey 或请求头 X-Api-Key 里,是有 servarr 权限的 API 令牌;不认会话。写操作(POST、PUT、DELETE, 以及 RefreshMonitoredDownloads 以外的命令)记操作审计(通道 servarr)。删除只删订阅,不删任何文件或种子。
Index ¶
Constants ¶
View Source
const ( // Prefix 是兼容入口在主端口上的路径前缀。 Prefix = "/servarr/" // ChannelType 是审计里的通道。 ChannelType = "servarr" // RadarrVersion、SonarrVersion 是报给 Seerr 的版本:Sonarr 的主版本大于 3 时 Seerr 不再请求语言档案。 RadarrVersion = "5.0.0.0" SonarrVersion = "4.0.0.0" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuditRecorder ¶
type AuditRecorder interface {
Record(ctx context.Context, e app.AuditEntry) error
}
AuditRecorder 记一条操作审计(app.AuditService 实现了它)。
type Deps ¶
type Deps struct {
// DB 存 Servarr 的标签(servarr_tags、servarr_tag_links)
DB *gorm.DB
Tokens TokenStore
Audit AuditRecorder
Subs Subscriptions
// Libraries 是全部媒体库(organize.Service.Libraries)
Libraries func(ctx context.Context) ([]models.MediaLibrary, error)
// TMDB 取按当前设置建的 TMDB 客户端(recognize.Service.TMDB)
TMDB func(ctx context.Context) (*tmdb.Client, error)
// DiskUsage 读目录所在磁盘的空间;为空时用 fsutil.DiskUsage
DiskUsage func(path string) (fsutil.Usage, error)
Now func() time.Time
}
Deps 是兼容入口要的服务,cmd 里接上。
type Subscriptions ¶
type Subscriptions interface {
SubscriptionsOf(ctx context.Context, kind string, tmdbID int) ([]models.MediaSubscription, error)
SubscriptionRow(ctx context.Context, id uint) (models.MediaSubscription, error)
CreateSubscription(ctx context.Context, in subscribe.SubscriptionInput, source string) (*models.MediaSubscription, error)
SetMonitored(ctx context.Context, id uint, on, searchNow bool) (*models.MediaSubscription, error)
SetProfile(ctx context.Context, id, profileID uint) (*models.MediaSubscription, error)
DeleteSubscription(ctx context.Context, id uint) error
SearchSoon(ctx context.Context, id uint) error
Profiles(ctx context.Context) ([]subscribe.Profile, error)
Episodes(ctx context.Context, id uint) ([]subscribe.EpisodeState, error)
AiredEpisodes(ctx context.Context, row *models.MediaSubscription) int
MovieLibrary(ctx context.Context, tmdbID int) (subscribe.LibraryMovie, error)
LibrarySeasons(ctx context.Context, tmdbID int) (map[int]subscribe.LibrarySeason, error)
}
Subscriptions 是兼容入口要的订阅服务(subscribe.Service 实现了它)。
Click to show internal directories.
Click to hide internal directories.