feat: implement multi-provider support in media library
- Introduced IProviderRegistry to manage multiple media providers. - Updated AppState to use provider_registry instead of a single media_provider. - Refactored library routes to support provider-specific queries for collections, series, genres, and items. - Enhanced ProgrammingBlock to include provider_id for algorithmic and manual content types. - Modified frontend components to allow selection of providers and updated API calls to include provider parameters. - Adjusted hooks and types to accommodate provider-specific functionality.
This commit is contained in:
@@ -108,19 +108,25 @@ export const api = {
|
||||
},
|
||||
|
||||
library: {
|
||||
collections: (token: string) =>
|
||||
request<CollectionResponse[]>("/library/collections", { token }),
|
||||
collections: (token: string, provider?: string) => {
|
||||
const params = new URLSearchParams();
|
||||
if (provider) params.set("provider", provider);
|
||||
const qs = params.toString();
|
||||
return request<CollectionResponse[]>(`/library/collections${qs ? `?${qs}` : ""}`, { token });
|
||||
},
|
||||
|
||||
series: (token: string, collectionId?: string) => {
|
||||
series: (token: string, collectionId?: string, provider?: string) => {
|
||||
const params = new URLSearchParams();
|
||||
if (collectionId) params.set("collection", collectionId);
|
||||
if (provider) params.set("provider", provider);
|
||||
const qs = params.toString();
|
||||
return request<SeriesResponse[]>(`/library/series${qs ? `?${qs}` : ""}`, { token });
|
||||
},
|
||||
|
||||
genres: (token: string, contentType?: string) => {
|
||||
genres: (token: string, contentType?: string, provider?: string) => {
|
||||
const params = new URLSearchParams();
|
||||
if (contentType) params.set("type", contentType);
|
||||
if (provider) params.set("provider", provider);
|
||||
const qs = params.toString();
|
||||
return request<string[]>(`/library/genres${qs ? `?${qs}` : ""}`, { token });
|
||||
},
|
||||
@@ -130,6 +136,7 @@ export const api = {
|
||||
filter: Pick<MediaFilter, "content_type" | "series_names" | "collections" | "search_term" | "genres">,
|
||||
limit = 50,
|
||||
strategy?: string,
|
||||
provider?: string,
|
||||
) => {
|
||||
const params = new URLSearchParams();
|
||||
if (filter.search_term) params.set("q", filter.search_term);
|
||||
@@ -138,6 +145,7 @@ export const api = {
|
||||
if (filter.collections?.[0]) params.set("collection", filter.collections[0]);
|
||||
params.set("limit", String(limit));
|
||||
if (strategy) params.set("strategy", strategy);
|
||||
if (provider) params.set("provider", provider);
|
||||
return request<LibraryItemResponse[]>(`/library/items?${params}`, { token });
|
||||
},
|
||||
},
|
||||
|
||||
@@ -57,8 +57,8 @@ export interface RecyclePolicy {
|
||||
}
|
||||
|
||||
export type BlockContent =
|
||||
| { type: "algorithmic"; filter: MediaFilter; strategy: FillStrategy }
|
||||
| { type: "manual"; items: string[] };
|
||||
| { type: "algorithmic"; filter: MediaFilter; strategy: FillStrategy; provider_id?: string }
|
||||
| { type: "manual"; items: string[]; provider_id?: string };
|
||||
|
||||
export interface ProgrammingBlock {
|
||||
id: string;
|
||||
@@ -95,8 +95,16 @@ export interface ProviderCapabilities {
|
||||
rescan: boolean;
|
||||
}
|
||||
|
||||
export interface ProviderInfo {
|
||||
id: string;
|
||||
capabilities: ProviderCapabilities;
|
||||
}
|
||||
|
||||
export interface ConfigResponse {
|
||||
allow_registration: boolean;
|
||||
/** All registered providers. Added in multi-provider update. */
|
||||
providers: ProviderInfo[];
|
||||
/** Primary provider capabilities — kept for backward compat. */
|
||||
provider_capabilities: ProviderCapabilities;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user