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:
@@ -64,12 +64,7 @@ class Media extends BaseModel {
|
||||
$stmt = $this->pdo->prepare($query);
|
||||
$stmt->execute($params);
|
||||
$items = $stmt->fetchAll();
|
||||
|
||||
// Cast-Mitglieder für jedes Medium laden
|
||||
foreach ($items as &$item) {
|
||||
$item['staff'] = $this->getCastForMedia($item['id']);
|
||||
}
|
||||
|
||||
|
||||
// Count Query
|
||||
$countQuery = "SELECT COUNT(*) FROM {$this->table} WHERE 1=1";
|
||||
$countParams = [];
|
||||
@@ -93,11 +88,6 @@ class Media extends BaseModel {
|
||||
} else {
|
||||
$items = $this->findAll($conditions, 'createdAt DESC', $limit, $offset);
|
||||
$total = $this->count($conditions);
|
||||
|
||||
// Cast-Mitglieder für jedes Medium laden
|
||||
foreach ($items as &$item) {
|
||||
$item['staff'] = $this->getCastForMedia($item['id']);
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user