Add Jellyfin mappings and optimize cast queries

Performance and settings updates:

- Add a new jellyfin_library_mappings column to the settings table and wire it into the Settings model (update handling and default value). This enables storing Jellyfin library mappings in settings.
- Optimize Cast::list by loading all cast filmography in a single joined query and grouping results per cast to avoid N+1 queries.
- Remove per-item cast/staff loading in Media model to avoid repeated queries during list/search operations.
- Remove game-specific enrichment from MediaController search to stop extra game info lookups during search responses.

These changes reduce repeated DB calls and centralize Jellyfin mapping storage.
This commit is contained in:
Lars Behrends
2026-04-12 02:07:59 +02:00
parent 66f69bc90d
commit eeff824701
5 changed files with 38 additions and 32 deletions

View File

@@ -51,10 +51,14 @@ class Settings extends BaseModel {
if (isset($data['language'])) {
$updateData['language'] = $data['language'];
}
if (isset($data['theme'])) {
$updateData['theme'] = $data['theme'];
}
if (isset($data['jellyfin_library_mappings'])) {
$updateData['jellyfin_library_mappings'] = $data['jellyfin_library_mappings'];
}
// Check if settings row exists
$existing = $this->findById(1);
@@ -72,7 +76,7 @@ class Settings extends BaseModel {
'auto_play_trailers' => 0,
'language' => 'en',
'theme' => 'system',
'theme' => 'system'
'jellyfin_library_mappings' => ''
];
$mergedData = array_merge($defaultData, $updateData);
$this->create($mergedData);