added more logging for #1643

pull/1648/head^2
tidusjar 7 years ago
parent 2a842e3786
commit 03445937db

@ -42,18 +42,26 @@ namespace Ombi.Controllers.External
public async Task<PlexAuthentication> SignIn([FromBody] UserRequest request)
{
// Do we already have settings?
_log.LogDebug("OK, signing into Plex");
var settings = await PlexSettings.GetSettingsAsync();
if (!settings.Servers?.Any() ?? false) return null;
_log.LogDebug("This is our first time, good to go!");
var result = await PlexApi.SignIn(request);
_log.LogDebug("Attempting to sign in to Plex.Tv");
if (!string.IsNullOrEmpty(result.user?.authentication_token))
{
_log.LogDebug("Sign in successful");
_log.LogDebug("Getting servers");
var server = await PlexApi.GetServer(result.user.authentication_token);
var servers = server.Server.FirstOrDefault();
if (servers == null)
{
_log.LogWarning("Looks like we can't find any Plex Servers");
}
_log.LogDebug("Adding first server");
settings.Enable = true;
settings.Servers = new List<PlexServers> {
@ -72,6 +80,7 @@ namespace Ombi.Controllers.External
await PlexSettings.SaveSettingsAsync(settings);
}
_log.LogDebug("Finished");
return result;
}

Loading…
Cancel
Save