Fix Sonarr episode count — episodeFileCount is nested under statistics in v4
This commit is contained in:
@@ -78,7 +78,8 @@ function vv_fetch_arr_live(array $arr): array {
|
||||
if (is_array($data)) {
|
||||
$out['total'] = count($data);
|
||||
$out['monitored'] = count(array_filter($data, fn($x) => !empty($x['monitored'])));
|
||||
$out['episodes'] = array_sum(array_column($data, 'episodeFileCount'));
|
||||
$out['episodes'] = array_sum(array_map(
|
||||
fn($x) => $x['statistics']['episodeFileCount'] ?? $x['episodeFileCount'] ?? 0, $data));
|
||||
}
|
||||
} elseif ($type === 'radarr') {
|
||||
$data = vv_arr_http($url, $key, "$base/movie");
|
||||
|
||||
Reference in New Issue
Block a user