mirror of https://github.com/Sonarr/Sonarr
Added some logging to PlexServerProxy
This commit is contained in:
parent
f2da193ef7
commit
0b3e4c48f7
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Common.Cache;
|
using NzbDrone.Common.Cache;
|
||||||
using NzbDrone.Common.Serializer;
|
using NzbDrone.Common.Serializer;
|
||||||
|
@ -19,10 +20,12 @@ namespace NzbDrone.Core.Notifications.Plex
|
||||||
public class PlexServerProxy : IPlexServerProxy
|
public class PlexServerProxy : IPlexServerProxy
|
||||||
{
|
{
|
||||||
private readonly ICached<String> _authCache;
|
private readonly ICached<String> _authCache;
|
||||||
|
private readonly Logger _logger;
|
||||||
|
|
||||||
public PlexServerProxy(ICacheManager cacheManager)
|
public PlexServerProxy(ICacheManager cacheManager, Logger logger)
|
||||||
{
|
{
|
||||||
_authCache = cacheManager.GetCache<String>(GetType(), "authCache");
|
_authCache = cacheManager.GetCache<String>(GetType(), "authCache");
|
||||||
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PlexDirectory> GetTvSections(PlexServerSettings settings)
|
public List<PlexDirectory> GetTvSections(PlexServerSettings settings)
|
||||||
|
@ -32,6 +35,9 @@ namespace NzbDrone.Core.Notifications.Plex
|
||||||
|
|
||||||
var response = client.Execute(request);
|
var response = client.Execute(request);
|
||||||
|
|
||||||
|
CheckForError(response.Content);
|
||||||
|
_logger.Trace("Sections response: {0}", response.Content);
|
||||||
|
|
||||||
return Json.Deserialize<PlexMediaContainer>(response.Content)
|
return Json.Deserialize<PlexMediaContainer>(response.Content)
|
||||||
.Directories
|
.Directories
|
||||||
.Where(d => d.Type == "show")
|
.Where(d => d.Type == "show")
|
||||||
|
@ -45,6 +51,9 @@ namespace NzbDrone.Core.Notifications.Plex
|
||||||
var client = GetPlexServerClient(settings);
|
var client = GetPlexServerClient(settings);
|
||||||
|
|
||||||
var response = client.Execute(request);
|
var response = client.Execute(request);
|
||||||
|
|
||||||
|
CheckForError(response.Content);
|
||||||
|
_logger.Trace("Update response: {0}", response.Content);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String Authenticate(string username, string password)
|
private String Authenticate(string username, string password)
|
||||||
|
@ -53,6 +62,7 @@ namespace NzbDrone.Core.Notifications.Plex
|
||||||
var client = GetMyPlexClient(username, password);
|
var client = GetMyPlexClient(username, password);
|
||||||
|
|
||||||
var response = client.Execute(request);
|
var response = client.Execute(request);
|
||||||
|
|
||||||
CheckForError(response.Content);
|
CheckForError(response.Content);
|
||||||
|
|
||||||
var user = Json.Deserialize<PlexUser>(JObject.Parse(response.Content).SelectToken("user").ToString());
|
var user = Json.Deserialize<PlexUser>(JObject.Parse(response.Content).SelectToken("user").ToString());
|
||||||
|
|
Loading…
Reference in New Issue