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:
2026-03-14 23:59:21 +01:00
parent c53892159a
commit ead65e6be2
21 changed files with 468 additions and 150 deletions

View File

@@ -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 });
},
},