1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2025-02-27 08:33:21 +00:00

Added some logging to PlexServerProxy

This commit is contained in:
Mark McDowall 2014-06-04 21:20:58 -07:00
parent f2da193ef7
commit 0b3e4c48f7

View file

@ -3,6 +3,7 @@
using System.IO;
using System.Linq;
using Newtonsoft.Json.Linq;
using NLog;
using NzbDrone.Common;
using NzbDrone.Common.Cache;
using NzbDrone.Common.Serializer;
@ -19,10 +20,12 @@ public interface IPlexServerProxy
public class PlexServerProxy : IPlexServerProxy
{
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");
_logger = logger;
}
public List<PlexDirectory> GetTvSections(PlexServerSettings settings)
@ -32,6 +35,9 @@ public List<PlexDirectory> GetTvSections(PlexServerSettings settings)
var response = client.Execute(request);
CheckForError(response.Content);
_logger.Trace("Sections response: {0}", response.Content);
return Json.Deserialize<PlexMediaContainer>(response.Content)
.Directories
.Where(d => d.Type == "show")
@ -45,6 +51,9 @@ public void Update(int sectionId, PlexServerSettings settings)
var client = GetPlexServerClient(settings);
var response = client.Execute(request);
CheckForError(response.Content);
_logger.Trace("Update response: {0}", response.Content);
}
private String Authenticate(string username, string password)
@ -53,6 +62,7 @@ private String Authenticate(string username, string password)
var client = GetMyPlexClient(username, password);
var response = client.Execute(request);
CheckForError(response.Content);
var user = Json.Deserialize<PlexUser>(JObject.Parse(response.Content).SelectToken("user").ToString());