diff --git a/src/Ombi/Controllers/V1/LandingPageController.cs b/src/Ombi/Controllers/V1/LandingPageController.cs index 54e1638b4..5f054165b 100644 --- a/src/Ombi/Controllers/V1/LandingPageController.cs +++ b/src/Ombi/Controllers/V1/LandingPageController.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Ombi.Api.Emby; +using Ombi.Api.Jellyfin; using Ombi.Api.Plex; using Ombi.Core.Settings; using Ombi.Core.Settings.Models.External; @@ -18,19 +19,22 @@ namespace Ombi.Controllers.V1 public class LandingPageController : ControllerBase { public LandingPageController(ISettingsService plex, ISettingsService emby, - IPlexApi plexApi, IEmbyApiFactory embyApi) + IPlexApi plexApi, IEmbyApiFactory embyApi, ISettingsService jellyfin, IJellyfinApi jellyfinApi) { _plexSettings = plex; _embySettings = emby; _plexApi = plexApi; _embyApi = embyApi; + _jellyfin = jellyfin; + _jellyfinApi = jellyfinApi; } private readonly IPlexApi _plexApi; private readonly IEmbyApiFactory _embyApi; private readonly ISettingsService _plexSettings; private readonly ISettingsService _embySettings; - + private readonly ISettingsService _jellyfin; + private readonly IJellyfinApi _jellyfinApi; [HttpGet] public async Task GetMediaServerStatus() @@ -86,6 +90,31 @@ public async Task GetMediaServerStatus() } } } + + + var jellyfin = await _jellyfin.GetSettingsAsync(); + if (jellyfin.Enable) + { + foreach (var server in jellyfin.Servers) + { + try + { + var result = await _jellyfinApi.GetUsers(server.FullUri, server.ApiKey); + if (result.Any()) + { + model.ServersAvailable++; + } + else + { + model.ServersUnavailable++; + } + } + catch (Exception) + { + model.ServersUnavailable++; + } + } + } return model; } }