1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-16 16:04:08 +01:00
Radarr/NzbDrone.Core/DataAugmentation/Scene/SceneMappingProxy.cs

32 lines
1.0 KiB
C#
Raw Normal View History

2013-04-01 04:43:58 +02:00
using System.Collections.Generic;
using NzbDrone.Common;
2013-05-12 17:18:17 +02:00
using NzbDrone.Common.Serializer;
2013-04-01 04:43:58 +02:00
using NzbDrone.Core.Configuration;
namespace NzbDrone.Core.DataAugmentation.Scene
{
public interface ISceneMappingProxy
{
List<SceneMapping> Fetch();
}
public class SceneMappingProxy : ISceneMappingProxy
{
2013-04-11 01:41:45 +02:00
private readonly IHttpProvider _httpProvider;
2013-04-01 04:43:58 +02:00
private readonly IConfigService _configService;
2013-04-18 01:32:06 +02:00
private readonly IJsonSerializer _jsonSerializer;
2013-04-01 04:43:58 +02:00
2013-04-18 01:32:06 +02:00
public SceneMappingProxy(IHttpProvider httpProvider, IConfigService configService, IJsonSerializer jsonSerializer)
2013-04-01 04:43:58 +02:00
{
_httpProvider = httpProvider;
_configService = configService;
2013-04-18 01:32:06 +02:00
_jsonSerializer = jsonSerializer;
2013-04-01 04:43:58 +02:00
}
public List<SceneMapping> Fetch()
{
var mappingsJson = _httpProvider.DownloadString(_configService.ServiceRootUrl + "/SceneMapping/Active");
2013-04-18 01:32:06 +02:00
return _jsonSerializer.Deserialize<List<SceneMapping>>(mappingsJson);
2013-04-01 04:43:58 +02:00
}
}
}