Exemplo n.º 1
0
        private void GivenAPlexServerWasFound()
        {
            _plexServers = new ServerBuilder().CreateMany();

            var firstServer = _plexServers.First();

            firstServer.Owned          = "1";
            firstServer.Port           = new Random().Next(1, int.MaxValue).ToString();
            firstServer.LocalAddresses = $"{LocalIp},{LocalIp}1,{LocalIp}2";

            _plexApi.GetServers(Arg.Any <string>()).Returns(_plexServers);
        }
        private async Task CreateAdminServer(User plexUser)
        {
            _logger.LogDebug("Getting PlexServers for Admin user");
            var servers = await _plexApi.GetServers(plexUser.AuthToken);

            var adminServer = servers?.FirstOrDefault(x => x.Owned == "1");

            if (adminServer != null)
            {
                await CreateAdminServer(adminServer, plexUser);
            }
            else
            {
                _logger.LogInformation("No PlexServer found that is owned by the Admin account");
            }
        }
Exemplo n.º 3
0
 private async Task FetchServers()
 {
     Servers = await plexApi.GetServers();
 }