Fixed: Updating Plex

This commit is contained in:
Mark McDowall 2014-04-18 20:22:35 -07:00
parent 0a125c485b
commit 8414890017
3 changed files with 5 additions and 4 deletions

View File

@ -16,6 +16,8 @@ namespace NzbDrone.Core.Notifications.Plex
[JsonProperty("_children")] [JsonProperty("_children")]
public List<PlexSection> Sections { get; set; } public List<PlexSection> Sections { get; set; }
public Int32 Key { get; set; }
} }
public class PlexMediaContainer public class PlexMediaContainer

View File

@ -12,7 +12,7 @@ namespace NzbDrone.Core.Notifications.Plex
{ {
public interface IPlexServerProxy public interface IPlexServerProxy
{ {
List<PlexSection> GetTvSections(PlexServerSettings settings); List<PlexDirectory> GetTvSections(PlexServerSettings settings);
void Update(int sectionId, PlexServerSettings settings); void Update(int sectionId, PlexServerSettings settings);
} }
@ -25,7 +25,7 @@ namespace NzbDrone.Core.Notifications.Plex
_authCache = cacheManager.GetCache<String>(GetType(), "authCache"); _authCache = cacheManager.GetCache<String>(GetType(), "authCache");
} }
public List<PlexSection> GetTvSections(PlexServerSettings settings) public List<PlexDirectory> GetTvSections(PlexServerSettings settings)
{ {
var request = GetPlexServerRequest("library/sections", Method.GET, settings); var request = GetPlexServerRequest("library/sections", Method.GET, settings);
var client = GetPlexServerClient(settings); var client = GetPlexServerClient(settings);
@ -35,7 +35,6 @@ namespace NzbDrone.Core.Notifications.Plex
return Json.Deserialize<PlexMediaContainer>(response.Content) return Json.Deserialize<PlexMediaContainer>(response.Content)
.Directories .Directories
.Where(d => d.Type == "show") .Where(d => d.Type == "show")
.SelectMany(d => d.Sections)
.ToList(); .ToList();
} }

View File

@ -61,7 +61,7 @@ namespace NzbDrone.Core.Notifications.Plex
{ {
_logger.Debug("Getting sections from Plex host: {0}", settings.Host); _logger.Debug("Getting sections from Plex host: {0}", settings.Host);
return _plexServerProxy.GetTvSections(settings).Select(s => s.Id).ToList(); return _plexServerProxy.GetTvSections(settings).Select(s => s.Key).ToList();
} }
private void UpdateSection(int key, PlexServerSettings settings) private void UpdateSection(int key, PlexServerSettings settings)