|
|
@ -50,16 +50,22 @@ namespace Ombi.Controllers.External
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var server = await PlexApi.GetServer(result.user.authentication_token);
|
|
|
|
var server = await PlexApi.GetServer(result.user.authentication_token);
|
|
|
|
var servers = server.Server.FirstOrDefault();
|
|
|
|
var servers = server.Server.FirstOrDefault();
|
|
|
|
|
|
|
|
if (servers == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_log.LogWarning("Looks like we can't find any Plex Servers");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
settings.Enable = true;
|
|
|
|
settings.Enable = true;
|
|
|
|
settings.Servers = new List<PlexServers> { new PlexServers{
|
|
|
|
settings.Servers = new List<PlexServers> {
|
|
|
|
|
|
|
|
new PlexServers
|
|
|
|
|
|
|
|
{
|
|
|
|
PlexAuthToken = result.user.authentication_token,
|
|
|
|
PlexAuthToken = result.user.authentication_token,
|
|
|
|
Id = new Random().Next(),
|
|
|
|
Id = new Random().Next(),
|
|
|
|
Ip = servers.LocalAddresses.Split(new []{','}, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault(),
|
|
|
|
Ip = servers?.LocalAddresses?.Split(new []{','}, StringSplitOptions.RemoveEmptyEntries)?.FirstOrDefault() ?? string.Empty,
|
|
|
|
MachineIdentifier = servers.MachineIdentifier,
|
|
|
|
MachineIdentifier = servers?.MachineIdentifier ?? string.Empty,
|
|
|
|
Port = int.Parse(servers.Port),
|
|
|
|
Port = int.Parse(servers?.Port ?? "0"),
|
|
|
|
Ssl = servers.Scheme != "http",
|
|
|
|
Ssl = (servers?.Scheme ?? "http") != "http",
|
|
|
|
Name = $"Server 1",
|
|
|
|
Name = "Server 1",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
//var serverNumber = 0;
|
|
|
|
//var serverNumber = 0;
|
|
|
|