Add Jellyfin library mapping support

Add support for Jellyfin library-to-category mappings used during import. Key changes:

- UI: ImporterView now lets users fetch Jellyfin libraries, configure per-library category (TV/Anime/Movies/Music/skip) and optional path segments, and persists mappings to API settings and localStorage.
- API/types: Add jellyfin_library_mappings to ApiSettingsItem/CreateSettingsInput and UserSettings (JSON string of LibraryMapping[]), and wire conversion helpers in src/api.ts and src/types.ts.
- Jellyfin importer: Introduce LibraryMapping type, fetchJellyfinLibraries, helper functions to resolve library from ParentId or Path (extractLibraryFromPath, findLibraryForItem), and update item conversion (movies/series/albums) to apply mappings and skip items marked 'skip'. Import flow now fetches libraries to build id->name map and passes mappings through to converters.

This enables category-aware imports and allows skipping libraries during Jellyfin imports.
This commit is contained in:
Lars Behrends
2026-04-12 02:08:31 +02:00
parent dff599e5af
commit 9c7e5a2b19
5 changed files with 510 additions and 15 deletions

View File

@@ -663,6 +663,7 @@ export interface ApiSettingsItem {
auto_play_trailers: boolean;
language: string;
theme: string;
jellyfin_library_mappings?: string; // JSON string of LibraryMapping[]
created_at?: string;
updated_at?: string;
}
@@ -676,6 +677,7 @@ export interface CreateSettingsInput {
auto_play_trailers?: boolean;
language?: string;
theme?: string;
jellyfin_library_mappings?: string;
}
export interface UpdateSettingsInput extends Partial<CreateSettingsInput> {}
@@ -691,6 +693,7 @@ export function convertApiToSettings(apiItem: ApiSettingsItem): UserSettings {
autoPlayTrailers: apiItem.auto_play_trailers || false,
language: apiItem.language || 'en',
theme: (apiItem.theme as 'light' | 'dark' | 'system') || 'system',
jellyfinLibraryMappings: apiItem.jellyfin_library_mappings,
createdAt: apiItem.created_at,
updatedAt: apiItem.updated_at,
};
@@ -706,6 +709,7 @@ export function convertSettingsToApi(settings: UserSettings): CreateSettingsInpu
auto_play_trailers: settings.autoPlayTrailers,
language: settings.language,
theme: settings.theme,
jellyfin_library_mappings: settings.jellyfinLibraryMappings,
};
}