2013-04-01 02:43:58 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
using NzbDrone.Common;
|
|
|
|
using NzbDrone.Core.Configuration;
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.DataAugmentation.Scene
|
|
|
|
{
|
|
|
|
public interface ISceneMappingProxy
|
|
|
|
{
|
|
|
|
List<SceneMapping> Fetch();
|
|
|
|
}
|
|
|
|
|
|
|
|
public class SceneMappingProxy : ISceneMappingProxy
|
|
|
|
{
|
2013-04-10 23:41:45 +00:00
|
|
|
private readonly IHttpProvider _httpProvider;
|
2013-04-01 02:43:58 +00:00
|
|
|
private readonly IConfigService _configService;
|
|
|
|
|
2013-04-10 23:41:45 +00:00
|
|
|
public SceneMappingProxy(IHttpProvider httpProvider, IConfigService configService)
|
2013-04-01 02:43:58 +00:00
|
|
|
{
|
|
|
|
_httpProvider = httpProvider;
|
|
|
|
_configService = configService;
|
|
|
|
}
|
|
|
|
|
|
|
|
public List<SceneMapping> Fetch()
|
|
|
|
{
|
|
|
|
var mappingsJson = _httpProvider.DownloadString(_configService.ServiceRootUrl + "/SceneMapping/Active");
|
|
|
|
return JsonConvert.DeserializeObject<List<SceneMapping>>(mappingsJson);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|