json serializer updates.

This commit is contained in:
Keivan Beigi 2013-04-17 16:32:06 -07:00
commit f9bb4178ed
13 changed files with 46 additions and 37 deletions

View file

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using NLog;
using Newtonsoft.Json;
using NzbDrone.Common;
using NzbDrone.Core.Configuration;
@ -17,12 +16,14 @@ namespace NzbDrone.Core.DataAugmentation.DailySeries
{
private readonly IHttpProvider _httpProvider;
private readonly IConfigService _configService;
private readonly IJsonSerializer _jsonSerializer;
private readonly Logger _logger;
public DailySeriesDataProxy(IHttpProvider httpProvider, IConfigService configService, Logger logger)
public DailySeriesDataProxy(IHttpProvider httpProvider, IConfigService configService, IJsonSerializer jsonSerializer, Logger logger)
{
_httpProvider = httpProvider;
_configService = configService;
_jsonSerializer = jsonSerializer;
_logger = logger;
}
@ -32,7 +33,7 @@ namespace NzbDrone.Core.DataAugmentation.DailySeries
{
var dailySeriesIds = _httpProvider.DownloadString(_configService.ServiceRootUrl + "/DailySeries/AllIds");
var seriesIds = JsonConvert.DeserializeObject<List<int>>(dailySeriesIds);
var seriesIds = _jsonSerializer.Deserialize<List<int>>(dailySeriesIds);
return seriesIds;
}

View file

@ -1,5 +1,4 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using NzbDrone.Common;
using NzbDrone.Core.Configuration;
@ -14,17 +13,19 @@ namespace NzbDrone.Core.DataAugmentation.Scene
{
private readonly IHttpProvider _httpProvider;
private readonly IConfigService _configService;
private readonly IJsonSerializer _jsonSerializer;
public SceneMappingProxy(IHttpProvider httpProvider, IConfigService configService)
public SceneMappingProxy(IHttpProvider httpProvider, IConfigService configService, IJsonSerializer jsonSerializer)
{
_httpProvider = httpProvider;
_configService = configService;
_jsonSerializer = jsonSerializer;
}
public List<SceneMapping> Fetch()
{
var mappingsJson = _httpProvider.DownloadString(_configService.ServiceRootUrl + "/SceneMapping/Active");
return JsonConvert.DeserializeObject<List<SceneMapping>>(mappingsJson);
return _jsonSerializer.Deserialize<List<SceneMapping>>(mappingsJson);
}
}
}