Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions cmd/prairie/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
"github.com/prairie-server/prairie-server/internal/access"
"github.com/prairie-server/prairie-server/internal/activitylog"
"github.com/prairie-server/prairie-server/internal/adminjob"
"github.com/prairie-server/prairie-server/internal/animeids"
"github.com/prairie-server/prairie-server/internal/api"
"github.com/prairie-server/prairie-server/internal/api/handlers"
"github.com/prairie-server/prairie-server/internal/apiv2"
Expand Down Expand Up @@ -81,13 +82,13 @@ import (
"github.com/prairie-server/prairie-server/internal/markers"
"github.com/prairie-server/prairie-server/internal/mdblist"
"github.com/prairie-server/prairie-server/internal/metadata"
"github.com/prairie-server/prairie-server/internal/metadata/tmdb"
"github.com/prairie-server/prairie-server/internal/netaccess"

// Built-in metadata providers self-register into the metadata package's
// builtin registry on import; buildProviders resolves their seeded chain
// entries in-process (no gRPC).
_ "github.com/prairie-server/prairie-server/internal/metadata/nfo"
"github.com/prairie-server/prairie-server/internal/metadata/tmdb"
"github.com/prairie-server/prairie-server/internal/models"
"github.com/prairie-server/prairie-server/internal/nodeconfig"
"github.com/prairie-server/prairie-server/internal/nodemetrics"
Expand Down Expand Up @@ -3100,14 +3101,17 @@ func main() {
if trendingRefresher != nil {
taskMgr.Register(tasks.NewRefreshTrendingDiscoverTask(trendingRefresher))
}
taskMgr.Register(tasks.NewRefreshAnimeIDsTask(animeids.NewRefresher(deps.DB)))
if userCollectionScheduler != nil {
taskMgr.Register(tasks.NewSyncUserCollectionsTask(userCollectionScheduler))
}
if watchProviderService != nil {
taskMgr.Register(tasks.NewSyncWatchProvidersTask(watchProviderService))
}
// The TMDB client lets a submission started here pick up a TVDB ID
// added on TMDB after the request was created.
// The reconcile pass routes requests, which reads TMDB for requests
// whose routing facts were never captured. The TMDB client also lets a
// submission started here pick up a TVDB ID added on TMDB after the
// request was created.
requestReconcileSvc := mediarequests.NewService(
mediarequests.NewRepository(deps.DB, deps.SecretCipher),
tmdb.NewClient(cfg.TMDBAPIKey, 40),
Expand All @@ -3116,6 +3120,7 @@ func main() {
catalog.NewProviderIDRepository(deps.DB),
),
)
requestReconcileSvc.SetAnimeIndex(animeids.NewStore(deps.DB))
requestReconcileSvc.SetRequesterIdentityResolver(plugins.RequesterIdentityFromLookup(plugins.NewPgUserIdentityLookup(deps.DB)))
if metadataService != nil {
requestReconcileSvc.SetTVDBIDResolver(metadataService)
Expand All @@ -3137,7 +3142,8 @@ func main() {
if notificationSystem != nil {
requestReconcileSvc.SetFulfillmentNotifier(notifications.NewRequestFulfillmentNotifier(notificationSystem))
}
taskMgr.Register(tasks.NewReconcileRequestsTask(requestReconcileSvc, 100))
taskMgr.Register(tasks.NewReconcileRequestsTask(requestReconcileSvc, 100, deps.DB))
taskMgr.Register(tasks.NewRefreshRequestDownloadsTask(requestReconcileSvc, 200, deps.DB))
if deps.FolderRepo != nil && deps.LibraryScanQueue != nil && pluginService != nil && pluginInstallationStore != nil {
autoscanRepo := autoscan.NewRepository(deps.DB, deps.SecretCipher)
if err := autoscanRepo.MarkInterruptedEvents(appCtx); err != nil {
Expand Down
27 changes: 27 additions & 0 deletions contracts/api/v2/fixtures/admin_requests_ok.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"year": 1995,
"status": "approved",
"outcome": "active",
"state": "approved",
"seasons": [],
"season_progress": [],
"requested_by_user_id": "1",
"requested_by_profile_id": "p-owner",
"integration_kind": "radarr",
Expand All @@ -17,9 +20,15 @@
{
"id": "42",
"request_id": "r-3",
"integration_id": "integration-1",
"integration_kind": "radarr",
"instance_name": "Radarr",
"quality": "1080p",
"is_anime": false,
"external_id": "7",
"external_status": "queued",
"status": "queued",
"route_name": "Movies",
"created_at": "2026-01-02T03:04:05.678Z",
"updated_at": "2026-01-02T03:04:05.678Z"
}
Expand All @@ -37,6 +46,9 @@
"year": 1995,
"status": "approved",
"outcome": "active",
"state": "approved",
"seasons": [],
"season_progress": [],
"requested_by_user_id": "1",
"requested_by_profile_id": "p-owner",
"integration_kind": "radarr",
Expand All @@ -45,9 +57,15 @@
{
"id": "42",
"request_id": "r-2",
"integration_id": "integration-1",
"integration_kind": "radarr",
"instance_name": "Radarr",
"quality": "1080p",
"is_anime": false,
"external_id": "7",
"external_status": "queued",
"status": "queued",
"route_name": "Movies",
"created_at": "2026-01-02T03:04:05.678Z",
"updated_at": "2026-01-02T03:04:05.678Z"
}
Expand All @@ -65,6 +83,9 @@
"year": 1995,
"status": "approved",
"outcome": "active",
"state": "approved",
"seasons": [],
"season_progress": [],
"requested_by_user_id": "1",
"requested_by_profile_id": "p-owner",
"integration_kind": "radarr",
Expand All @@ -73,9 +94,15 @@
{
"id": "42",
"request_id": "r-1",
"integration_id": "integration-1",
"integration_kind": "radarr",
"instance_name": "Radarr",
"quality": "1080p",
"is_anime": false,
"external_id": "7",
"external_status": "queued",
"status": "queued",
"route_name": "Movies",
"created_at": "2026-01-02T03:04:05.678Z",
"updated_at": "2026-01-02T03:04:05.678Z"
}
Expand Down
4 changes: 3 additions & 1 deletion contracts/api/v2/fixtures/cancel_request_ok.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
"year": 1995,
"status": "approved",
"outcome": "active",
"state": "approved",
"seasons": [],
"season_progress": [],
"requested_by_user_id": "1",
"requested_by_profile_id": "p-owner",
"integration_kind": "radarr",
"is_anime": false,
"targets": [
{
Expand Down
4 changes: 3 additions & 1 deletion contracts/api/v2/fixtures/create_request_ok.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
"year": 1995,
"status": "pending",
"outcome": "active",
"state": "pending",
"seasons": [],
"season_progress": [],
"requested_by_user_id": "1",
"requested_by_profile_id": "p-owner",
"integration_kind": "radarr",
"is_anime": false,
"targets": [],
"created_at": "2026-01-02T03:04:05.678Z",
Expand Down
2 changes: 1 addition & 1 deletion contracts/api/v2/fixtures/get_system_info_ok.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"server_version": "unavailable",
"api_major": 2,
"contract_digest": "365e4a112e09122bc3b13d7565302ae86f9d290a09c985b76aa66206eb7cfdad",
"contract_digest": "8a3e149d3f46fdf26ac64c411d6b3b6b3a064396961477843ea64e702ab558d7",
"links": {
"openapi": "/api/v2/openapi.json",
"capabilities": "/api/v2/capabilities",
Expand Down
34 changes: 28 additions & 6 deletions contracts/api/v2/fixtures/list_my_requests_ok.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
"year": 1995,
"status": "pending",
"outcome": "active",
"state": "pending",
"seasons": [],
"season_progress": [],
"requested_by_user_id": "1",
"requested_by_profile_id": "p-owner",
"integration_kind": "radarr",
"is_anime": false,
"targets": [
{
Expand All @@ -35,26 +37,46 @@
"tmdb_id": 949,
"title": "Heat",
"year": 1995,
"status": "approved",
"status": "downloading",
"outcome": "active",
"state": "processing",
"seasons": [],
"season_progress": [],
"requested_by_user_id": "1",
"requested_by_profile_id": "p-owner",
"integration_kind": "radarr",
"is_anime": false,
"targets": [
{
"id": "42",
"request_id": "r-1",
"quality": "1080p",
"is_anime": false,
"status": "queued",
"status": "downloading",
"created_at": "2026-01-02T03:04:05.678Z",
"updated_at": "2026-01-02T03:04:05.678Z"
"updated_at": "2026-01-02T03:04:05.678Z",
"download": {
"phase": "downloading",
"percent": 43,
"bytes_total": 4294967296,
"bytes_left": 2448131358,
"estimated_completion_at": "2026-01-02T03:16:05.678Z",
"downloads": 1,
"updated_at": "2026-01-02T03:04:05.678Z"
}
}
],
"created_at": "2026-01-02T03:04:05.678Z",
"updated_at": "2026-01-02T03:04:05.678Z",
"approved_at": "2026-01-02T03:04:05.678Z"
"approved_at": "2026-01-02T03:04:05.678Z",
"download": {
"phase": "downloading",
"percent": 43,
"bytes_total": 4294967296,
"bytes_left": 2448131358,
"estimated_completion_at": "2026-01-02T03:16:05.678Z",
"downloads": 1,
"updated_at": "2026-01-02T03:04:05.678Z"
}
}
],
"page": {
Expand Down
8 changes: 6 additions & 2 deletions contracts/api/v2/fixtures/request_status_ok.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"revision": "9f99fe02e4707e64e2d61ce7d8682b809713f2cad154b46064cc7c16e0b26d61",
"revision": "dc6458db8af9354952b69baa1805dcb12a4cee23a40517a0dea2c3f02e441bb2",
"state": "available",
"allowed": true,
"requests_enabled": true,
"rating_restrictions_enforced": true
"rating_restrictions_enforced": true,
"follow_supported": true,
"season_requests_supported": true,
"missing_seasons_requestable": false,
"download_progress_supported": true
}
Loading
Loading